Skip to content

feature request: optional parameters for primitives #13

@trevor

Description

@trevor

Perhaps something like {:native-keywords true :native-symbols true :native-vectors false}

  • With native keywords and symbols:
=>  (println (yaml-dump ['a/b/c :d/e/f (symbol "stuff and/or things") (keyword "other and/or widgets")]))

---
- !!clojure.lang.Symbol
  name: c
  namespace: a/b
- !!clojure.lang.Keyword
  name: f
  namespace: d/e
  sym:
    name: f
    namespace: d/e
- !!clojure.lang.Symbol
  name: or things
  namespace: stuff and
- !!clojure.lang.Keyword
  name: or widgets
  namespace: other and
  sym:
    name: or widgets
    namespace: other and
...
  • With common denominator:
  clojure.lang.Keyword
  (encode [data]
    (.substring (str data) 1))

  clojure.lang.Symbol
  (encode [data]
    (str data))
=> (println (yaml-dump ['a/b/c :d/e/f (symbol "stuff and/or things") (keyword "other and/or widgets")]))

---
- a/b/c
- d/e/f
- stuff and/or things
- other and/or widgets
...

(Encoding style similar to cheshire: https://github.com/dakrone/cheshire/blob/6d78a56929f3cb4e925e2d09617465314d3114ba/src/cheshire/generate.clj#L134 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions