This package provides a julia-to-lisp syntax translator with convenience macros that let you do this:
lisp"(defn fib [a] (if (< a 2) a (+ (fib (- a 1)) (fib (- a 2)))))" @test lisp"(fib 30)" == 832040 @test fib(30) == 832040
LispSyntax.jl is implemented as an expression translator between lisp/clojure-like syntax and julia's AST. Julia's compiler, JIT and multiple-dispatch infrastructure is used for code generation and execution. Because of this, LispSyntax.jl is not really clojure or lisp in most meaningful ways. The semantics are entirely julia-based (which are very similar to scheme/lisp in many ways). The net result is that LispSyntax.jl is really an alternative S-expression-like syntax for julia, not an implemention of clojure or lisp.
(def symbol init)
(defn symbol [param*] expr*)
(defmacro symbol [param*] expr*)
(lambda [param*] expr*)`
(fn [param*] expr*)`
(let [binding*] expr*)
(while test expr*)
(for [binding*] expr*)
fnparameter lists, etc.). This is not currently implemented.
LispSyntax.jllook like standard Lisp macros but because expressions are special objects in julia, S-expressions returned from macros require a special translation step to generate julia expression trees. The result is that
LispSyntax.jlmacros are directly translated into Julia macros and must be called via special syntax (e.g.
@r_strwhich in Julia can be called via
r"", it is currently necessary to call these via standard macro syntax:
usingis currently implemented and confusingly, it matches Clojure's import form.
12 days ago