Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active June 1, 2021 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sogaiu/552a338d868ea77193cb208abc6990b3 to your computer and use it in GitHub Desktop.
Save sogaiu/552a338d868ea77193cb208abc6990b3 to your computer and use it in GitHub Desktop.
comparing janet things
repl> (def a {:a 1})
{:a 1}
repl> (disasm (compile '(a :a)))
{ :arity 0
:bytecode @[(ldc 0 0) (push 0) (ldc 1 1) (call 0 1) (ret 0)]
:constants @[:a {:a 1}]
:defs @[]
:environments @[]
:max-arity 2147483647
:min-arity 0
:name "_thunk"
:slotcount 2
:vararg false}
repl> (disasm (compile '(get a :a)))
{ :arity 0
:bytecode @[(ldc 1 0) (ldc 2 1) (get 0 1 2) (ret 0)]
:constants @[{:a 1} :a]
:defs @[]
:environments @[]
:max-arity 2147483647
:min-arity 0
:name "_thunk"
:slotcount 3
:vararg false}
repl> (disasm (compile '(in a :a)))
{ :arity 0
:bytecode @[(ldc 1 0) (ldc 2 1) (in 0 1 2) (ret 0)]
:constants @[{:a 1} :a]
:defs @[]
:environments @[]
:max-arity 2147483647
:min-arity 0
:name "_thunk"
:slotcount 3
:vararg false}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment