LispSyntax.jl
LispSyntax.jl copied to clipboard
Issue parsing floats
When setting a float value I'm getting the following error:
julia> lisp"(def x 2.5)"
ERROR: LoadError: Malformed def: Length of list must be == 3
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] codegen(::Array{Any,1}) at /Users/ahumenberger/.julia/packages/LispSyntax/ykFIL/src/LispSyntax.jl:91
[3] lisp_eval_helper(::String) at /Users/ahumenberger/.julia/packages/LispSyntax/ykFIL/src/LispSyntax.jl:154
[4] @lisp_str(::LineNumberNode, ::Module, ::Any) at /Users/ahumenberger/.julia/packages/LispSyntax/ykFIL/src/LispSyntax.jl:158
in expression starting at REPL[3]:1
which might be because of
julia> LispSyntax.read("(2.5)")
LispSyntax.s_expr(Any[2, Symbol(".5")])
This works:
julia> lisp"(def x 2.5d)"
2.5
Alternatively append f
to get it parsed as a Float32; see https://github.com/swadey/LispSyntax.jl/blob/master/src/parser.jl