Skip to content

Cirru/cirru-edn

Repository files navigation

Cirru EDN

EDN data in Cirru format.

Demo http://repo.cirru.org/cirru-edn/

Usage

Respo

[cirru/edn "0.0.9"]
(cirru-edn.core/parse "a b")

(cirru-edn.core/write {:a 1})
(cirru-edn.core/write {:a 1} {:inline? false}) ; by default, :inline? is set true

To represent single liternals, Cirru EDN requires an extra do x syntax, for example:

do :something

use Nim parser(experimental. can be slow)

To use parser from nim:

yarn add @cirru/parser.nim
(cirru-edn.nim/parse "a b")

Syntax

Cirru EDN is based on Cirru Text Syntax, on top of which there is specific syntax for EDN:

Vectors, lists and sets:

[] 1 2 3
list 1 2 3
#{} 1 2 3

Hashmap:

{}
  :a 1
  :b 3

Literals, since Cirru use lines for expressions, need do for extracting values:

do 1
do :k
do nil

Strings need to be prefixed with a |:

do |short
do "|long text"

Quoted Cirru format

For vectors of Cirru data, use (with-meta [] :quoted-cirru) to generate an embeded quoted syntax. For example:

(write {:a 1, :b (with-meta ["def" "a" ["x" "y"] ["+" "x" "y"]] :quoted-cirru)})

generates:

{} (:a 1)
  :b $ quote
    def a (x y) (+ x y)

Workflow

Workflow https://github.com/mvc-works/calcit-workflow

License

MIT