Re:Six Months with Julia: Parse-Time Transpilation in 80 Lin...
by fmakunbound on Thursday April 09, 2020 @03:53PM
(#22826485)
Lisp user here. Is bf" like a reader macro?
[ Parent
| on HN ]
Re:Six Months with Julia: Parse-Time Transpilation in 80 Lin...
by eigenspace on Thursday April 09, 2020 @04:01PM
(#22826568)
Yes, it's a string macro which is essentially a reader macro. We also have regular macros that operate on Julia's AST.
There's some really useful and approachable info here: https://docs.julialang.org/en/v1/manual/metaprogramming/inde...
You can think of Julia as a Lisp-1 with opt out hygenic macros hiding behind Algol syntax. However, the AST is very lispy:
julia> dump(:(x^2 - 1))
Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol -
2: Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol ^
2: Symbol x
3: Int64 2
3: Int64 1
The `:` is how you quote code in Julia, and `dump` is just a convenient function for printing nested data-structures.Furthermore, you can see this package https://github.com/swadey/LispSyntax.jl for a string macro that lets julia use Lisp style syntax instead.
Re:Six Months with Julia: Parse-Time Transpilation in 80 Lin...
by fmakunbound on Saturday April 11, 2020 @09:36PM
(#22845478)
Thanks for the explanation. I'm checking it out.