That is scheme-like. That is psuedo-homoiconic.
(If anyone in the know wants to add or refute this, I would love to know whether my non-cs intuition is correct here.)
(also it is still a very mutable language, even with coffeescript/underscore)
That is scheme-like. That is psuedo-homoiconic.
(If anyone in the know wants to add or refute this, I would love to know whether my non-cs intuition is correct here.)
(also it is still a very mutable language, even with coffeescript/underscore)
The advantage of homoiconicity is that the language itself is manipulable as a basic type in the language. In Scheme, this means that it's easy to generate, analyze, and modify Scheme code using simple procedures in Scheme. e.g. I could (although I wouldn't) generate a scheme expression to compute an arbitrary fibonacci number with[1]
> (define (fib-code n)
(if (= n 1) 1 `(* ,n ,(fib-code (- n 1)))))
> (fib-code 4)
(* 4 (* 3 (* 2 1)))
> (eval (fib-code 4) (the-environment))
24
> (eval (replace '* '+ (fib-code 4)) (the-environment))
10
Notice that I'm not just pushing strings together to write code. I'm actually manipulating data structures in the language to produce and modify code. That is homoiconicity.However unlike JSON, Rebol is more than just a data interchange format because it's like Lisp in being a full homoiconic programming language.
For eg: Here are andolanra's excellent Scheme/Lisp examples in Rebol:
>> some-code: func [n] [either n = 1 [1] [compose [(n) * (some-code n - 1)]]]
>> some-code 4
== [4 * 3 * 2 * 1]
>> do some-code 4
== 24
>> do replace/all some-code 4 '* '+
== 10
And it's this that makes the difference between JSON+Javascript compared to something like Rebol/Scheme/Lisp.