2 ms·
I think his example is a bit tough to understand and it might be easier to use another one. Consider the Julia language. Julia is homoiconic -- Julia code is
by stevelosh 14y ago
I think his example is a bit tough to understand and it might be easier to use another one.
Consider the Julia language. Julia is homoiconic -- Julia code is made of Julia data structures: http://julialang.org/manual/metaprogramming/ http://julialang.org/manual/metaprogramming/
Imagine for a second that Julia didn't have the :() quote form, and if you wanted to build up some syntax you had to use constructors, something like this:
a + b - c
Expr(type="call", function=Symbol("+"),
args=[Expr(type="symbol", name="a"),
Expr(type="call",
function=Expr(type="symbol", name="-"),
args=[Expr(type="symbol", name="b"),
Expr(type="symbol", name="c")])])
(obviously not valid Julia, but that doesn't matter for now)
This would still make Julia homoiconic, but the different between "using" the expression (the first line) and "mentioning" it (the horrible Expr thing) is much greater.
Clojure does have more syntax than Common Lisp, but its syntax is still "near at hand" because it's still made up of the things you use every day. Functions use [] for arguments, but that's just a vector which you use anyway. There's not really much syntax in Clojure where "mentioning" it is harder than "using" it.
- mindslight 14y agoBut the only real difference between "using and mentioning" seems to be the presence of (quasi)quote. I haven't looked at Julia, but I'm presuming you can do :(a + b - c), which mentions the syntax. But as you point out, the manipulation is still annoying because the syntax tree is strongly typed. In fact, the typing strength of the syntax tree seems roughly equivalent to the amount of "syntax dedicated to semantics" a language has, which is the point that the author starts off trying to refute.