Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A example of `cr --emit-ir`
{} (:package |demo)
:configs $ {} (:init-fn |demo.main/main!) (:reload-fn |demo.main/reload!) (:version |0.0.1)
:files $ {}
|demo.main $ {}
:ns $ quote
ns demo.main $ :require ([] demo.core :as demo)
:defs $ {}
|main! $ quote
defn main! () (println "|Started.") (demo/show-something)
|reload! $ quote
defn reload! () (println "|Reload.")
|demo.core $ {}
:ns $ quote
ns demo.core $ :require
:defs $ {}
|show-something $ quote
defn show-something ()
echo "|DEMO"
{
"configs": {
"initFn": "demo.main/main!",
"reloadFn": "demo.main/reload!"
},
"files": {
"demo.main": {
"import": {
"demo": {
"ns": "demo.core",
"nsInStr": false,
"kind": "ns",
"def": null
}
},
"defs": {
"reload!": {
"kind": "fn",
"ns": "demo.main",
"name": "reload!",
"args": [],
"code": [
[
{
"kind": "symbol",
"val": "println",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "println",
"nsInStr": false
}
},
"Reload."
]
]
},
"main!": {
"kind": "fn",
"ns": "demo.main",
"name": "main!",
"args": [],
"code": [
[
{
"kind": "symbol",
"val": "println",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "println",
"nsInStr": false
}
},
"Started."
],
[
{
"kind": "symbol",
"val": "demo/show-something",
"ns": "demo.main",
"dynamic": false,
"resolved": {
"ns": "demo.core",
"def": "show-something",
"nsInStr": false
}
}
]
]
}
}
},
"demo.core": {
"import": {},
"defs": {
"show-something": {
"kind": "fn",
"ns": "demo.core",
"name": "show-something",
"args": [],
"code": [
[
{
"kind": "symbol",
"val": "echo",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "echo",
"nsInStr": false
}
},
"DEMO"
]
]
}
}
},
"calcit.core": {
"import": {},
"defs": {
"echo": {
"kind": "fn",
"ns": "calcit.core",
"name": "println",
"args": [
{
"kind": "symbol",
"val": "&",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
"code": [
[
{
"kind": "symbol",
"val": "print",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "print",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "&",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
[
{
"kind": "symbol",
"val": "if",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "=",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "=",
"nsInStr": false
}
},
[
{
"kind": "symbol",
"val": "&get-calcit-backend",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "&get-calcit-backend",
"nsInStr": false
}
}
],
{
"kind": "keyword",
"val": "nim"
}
],
[
{
"kind": "symbol",
"val": "do",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "print",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "print",
"nsInStr": false
}
},
"\n"
]
]
]
]
},
"add-watch": {
"kind": "proc"
},
"defn": "...TODO",
"parse-json": {
"kind": "proc"
},
"init-canvas": {
"kind": "proc"
},
"&/": {
"kind": "proc"
},
"parse-time": {
"kind": "proc"
},
"dbt-digits": {
"kind": "proc"
},
"first": {
"kind": "proc"
},
"re-matches": {
"kind": "proc"
},
"foldl-compare": {
"kind": "fn",
"ns": "calcit.core",
"name": "foldl-compare",
"args": [
{
"kind": "symbol",
"val": "f",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "acc",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
"code": [
[
{
"kind": "symbol",
"val": "if",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "empty?",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "empty?",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
true,
[
{
"kind": "symbol",
"val": "if",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "f",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "acc",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "first",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "first",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
]
],
[
{
"kind": "symbol",
"val": "recur",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "recur",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "f",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "first",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "first",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
[
{
"kind": "symbol",
"val": "rest",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "rest",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
]
],
false
]
]
]
},
"&difference": {
"kind": "proc"
},
"assoc": {
"kind": "proc"
},
"&merge": {
"kind": "proc"
},
"pr-str": {
"kind": "proc"
},
"type-of": {
"kind": "proc"
},
"sqrt": {
"kind": "proc"
},
"timeout-call": {
"kind": "proc"
},
"identical?": {
"kind": "proc"
},
"reset!": {
"kind": "proc"
},
"&-": {
"kind": "proc"
},
"&*": {
"kind": "proc"
},
"display-stack": {
"kind": "proc"
},
"draw-canvas": {
"kind": "proc"
},
"macroexpand": {
"kind": "proc"
},
"butlast": {
"kind": "proc"
},
"turn-symbol": {
"kind": "proc"
},
"format-number": {
"kind": "proc"
},
"floor": {
"kind": "proc"
},
"cos": {
"kind": "proc"
},
"mod": {
"kind": "proc"
},
"println": {
"kind": "fn",
"ns": "calcit.core",
"name": "println",
"args": [
{
"kind": "symbol",
"val": "&",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
"code": [
[
{
"kind": "symbol",
"val": "print",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "print",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "&",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "xs",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
[
{
"kind": "symbol",
"val": "if",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "=",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "=",
"nsInStr": false
}
},
[
{
"kind": "symbol",
"val": "&get-calcit-backend",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "&get-calcit-backend",
"nsInStr": false
}
}
],
{
"kind": "keyword",
"val": "nim"
}
],
[
{
"kind": "symbol",
"val": "do",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
[
{
"kind": "symbol",
"val": "print",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "print",
"nsInStr": false
}
},
"\n"
]
]
]
]
},
"&get-calcit-backend": {
"kind": "proc"
},
"when": "...TODO",
"&exclude": {
"kind": "proc"
},
"rand-int": {
"kind": "proc"
},
"append": {
"kind": "proc"
},
"split-lines": {
"kind": "proc"
},
"dissoc": {
"kind": "proc"
},
"&concat": {
"kind": "proc"
},
"&union": {
"kind": "proc"
},
"gensym": {
"kind": "proc"
},
"quote": "...TODO",
"&let": "...TODO",
"defatom": "...TODO",
"count": {
"kind": "proc"
},
"&str-concat": {
"kind": "proc"
},
"&>": {
"kind": "proc"
},
"assoc-after": {
"kind": "proc"
},
"rand": {
"kind": "proc"
},
"not": {
"kind": "proc"
},
"foldl": {
"kind": "proc"
},
";": "...TODO",
"pow": {
"kind": "proc"
},
"[]": {
"kind": "proc"
},
"&<": {
"kind": "proc"
},
"&reset-gensym-index!": {
"kind": "proc"
},
"replace": {
"kind": "proc"
},
"print": {
"kind": "proc"
},
"macroexpand-all": {
"kind": "proc"
},
"re-find-all": {
"kind": "proc"
},
"split": {
"kind": "proc"
},
"&merge-non-nil": {
"kind": "proc"
},
"get-env": {
"kind": "proc"
},
"&+": {
"kind": "proc"
},
"escape": {
"kind": "proc"
},
"substr": {
"kind": "proc"
},
"#{}": {
"kind": "proc"
},
"cpu-time": {
"kind": "proc"
},
"turn-keyword": {
"kind": "proc"
},
"range": {
"kind": "proc"
},
"turn-string": {
"kind": "proc"
},
"deref": {
"kind": "proc"
},
"last": {
"kind": "proc"
},
"empty?": {
"kind": "proc"
},
"re-find-index": {
"kind": "proc"
},
"defmacro": "...TODO",
"if": "...TODO",
"=": {
"kind": "fn",
"ns": "calcit.core",
"name": "=",
"args": [
{
"kind": "symbol",
"val": "x",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "&",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "ys",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
],
"code": [
[
{
"kind": "symbol",
"val": "foldl-compare",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "foldl-compare",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "&=",
"ns": "calcit.core",
"dynamic": false,
"resolved": {
"ns": "calcit.core",
"def": "&=",
"nsInStr": false
}
},
{
"kind": "symbol",
"val": "x",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
},
{
"kind": "symbol",
"val": "ys",
"ns": "calcit.core",
"dynamic": false,
"resolved": null
}
]
]
},
"get": {
"kind": "proc"
},
"round": {
"kind": "proc"
},
"&include": {
"kind": "proc"
},
"now!": {
"kind": "proc"
},
"do": "...TODO",
"&=": {
"kind": "proc"
},
"stringify-json": {
"kind": "proc"
},
"draw-error-message": {
"kind": "proc"
},
"read-file": {
"kind": "proc"
},
"&intersection": {
"kind": "proc"
},
"to-pairs": {
"kind": "proc"
},
"&{}": {
"kind": "proc"
},
"sort": {
"kind": "proc"
},
"ceil": {
"kind": "proc"
},
"parse-float": {
"kind": "proc"
},
"&or": {
"kind": "proc"
},
"rest": {
"kind": "proc"
},
"trim": {
"kind": "proc"
},
"generate-id!": {
"kind": "proc"
},
"str-find": {
"kind": "proc"
},
"get-char-code": {
"kind": "proc"
},
"&and": {
"kind": "proc"
},
"sin": {
"kind": "proc"
},
"assoc-before": {
"kind": "proc"
},
"format-ternary-tree": {
"kind": "proc"
},
"def": "...TODO",
"set->list": {
"kind": "proc"
},
"&str": {
"kind": "proc"
},
"quote-replace": "...TODO",
"raise": {
"kind": "proc"
},
"contains?": {
"kind": "proc"
},
"dbt->point": {
"kind": "proc"
},
"parse-cirru-edn": {
"kind": "proc"
},
"reverse": {
"kind": "proc"
},
"write-file": {
"kind": "proc"
},
"recur": {
"kind": "proc"
},
"prepend": {
"kind": "proc"
},
"dual-balanced-ternary": {
"kind": "proc"
},
"format-time": {
"kind": "proc"
},
"remove-watch": {
"kind": "proc"
},
"slice": {
"kind": "proc"
},
"quit": {
"kind": "proc"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment