Where can I get more information on Homoiconicity?

I've experimented with functional programming and I still don't understand the concept. Do you guys know of any good books or tutorials or examples that discuss this concept? Or if you could show small snippets about usage, that would be great.

+1


source to share


4 answers


I believe that Why John Hughes Functional Programming Questions is one of the best.



+2


source


Explore lisp or schema. Language is a data structure. lisp code and lisp data structures have the same syntax rules.

If you learn tcl, you can work with a language that is procedural and the syntax rules of the data structure are the same as the syntax rules of the programming language.



This is not - strictly speaking - a functional programming problem. This is more of a problem with multiple languages ​​where the syntax rules for the data and the syntax rules for the language are the same.

+4


source


+1


source


REBOL is a homoiconic language. A block!

REBOL datatype is a set of square brackets that contain any valid REBOL tokens, similar to an S-expression in Lisp. For instance:

series: [1 2 3 4]
foreach item series [
    print item
]

      

Now let's put it a little differently:

series: [1 2 3 4]
for-body: [print item] ; This is the body of our foreach
foreach item series for-body

      

Although it was declared as data, we treated the block for-body

as code when we passed it to the function foreach

. If we ask REBOL what the type of the first element in the block for-body

is type? first for-body

- it will tell us word!

, not function!

(or native!

or action!

) or any other REBOL function types). The reason is that as data for-body

, it's just an invaluable chunk of REBOL words. When we pass it foreach

, then it gets evaluated as code.

Some have called REBOL "like Lisp but no parentheses", and I personally prefer it to Lisp, but you can't. However, it is a great language to start when you want to learn about homoiconicity, a subject that I find fascinating.

+1


source







All Articles