Hacker News new | past | comments | ask | show | jobs | submit login
Understanding Homoiconicity through Clojure macros (medium.com/theburningmonk)
77 points by theburningmonk on April 18, 2017 | hide | past | favorite | 3 comments



As someone with only passing familiarity with lisps and the topic of himoiconicity, I really appreciated the article. However, I kindof wish the author had skipped treating the quote/unquote attempt as a solution.

I spent too long attempting to reason through the syntax before moving on with the article. If course, if the article had been a simple conversation between myself and the author, I would not have been able to dwell on it and the author could have guided me right through it, but in the written format, it definitely feels like I was the target of a game of nerd sniping[0].

[0] https://xkcd.com/356/


Very similar (although not exactly) to how macros work in Elixir (which is mentioned)


If I understand it correctly one does not write code in a data structure, which makes it not 'homoiconic'. Second macros are limited:

Robert Virding says

> What I mean here is that elixir has a predefined syntax. It has a number of predefined syntactic constructs, operators and function calls. And while I can with macros change the meaning of the constructs I cannot add new constructs or operators as the handling of macros is done after parsing. So if I want to add something completely new it ends up syntactically being a function call. Now elixir has many ways of disguising function calls at the end of the day they are syntactically still function calls. For example parentheses around arguments are optional, there is special syntax for property lists where the keys are all atoms, special syntax for using these property lists as function arguments, special handling of do ... end when it is a function argument, etc. Elixir's uniform abstract syntax makes it easier to work with these but I am still limited by only having the existing syntax.

> For example assume I work a lot with property lists where the keys are integers, or I would like to have keys with are either atoms or integers, then there is no way for me to create a special syntax for this at all. Even if I have macros.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: