Thanks for the detailed response Alex. Sorry for taking so long to respond. Comments inline ...
On 23 January 2012 14:53, Alexander Burger <[email protected]> wrote: > > > But one of the key things which make me feel comfortable in any lisp is the > > knowledge that I can effectively re-arrange the syntax of certain operation > > sequences to forms that I prefer. > > However, you can do that also in PicoLisp. The above doesn't mean that > you can't programmatically manipulate your code. Basically, there are > two possibilities: > > 1. Use a read macro > > In a certain sense, the reader is the "compiler" of PicoLisp. Once an > expression is read, it exists as an internal s-expression pointer- > structure. If you use a read macro with '`' or '~', you can build any > code structures you like. > > Example: > > (de foo (A B) > `(build-some-code) > ~(when (some-condition) > (build-more-code) ) > ... ) > > You might call that a "micro"-macro ;-) > > 2. Use 'def' instead of 'de' for a completely evaluated definition > > (def 'foo > (list (get-parameters) > '(some static expression) > (some calculated expression) ) ) > > Quite often it is convenient to simply use 'curry' here. > > You can of course also combine these methods. Interesting. When reading through the docs, it did occur to me at the time that read-macros were the only place available in picolisp to compute stuff, before runtime. But, I never saw how I could create my own read-macro's. I went off looking for functions equivalent to (set-read-syntax! ), etc ... I totally missed what ` does (I guess I'm too used to it meaning quasiquote in other lisps). BTW, is it possible to create your own reader macro's? > > Once you get used to this feeling of *freedom*, its really hard to give it > > up. And honestly, I think this is one key lisp'ism which picolisp lacks
