4 ms·
If you're interested in functional programming and meta-programming as paradigms, then you should really focus on functional first. The reason is that function
by jbotz 8y ago
If you're interested in functional programming and meta-programming as paradigms, then you should really focus on functional first. The reason is that functional is all about transformation of data structures as a whole (as opposed to altering them bit by bit as in procedural programming) and meta-programming is about treating programs as data and transforming them. You really can only do advanced meta-programming using functional techniques. It's no accident that Lisp is the granddaddy of both paradigms.
As for which language to use to explore these paradigms, the answer would have to be a modern Lisp, i.e. Clojure or Racket. Of those two Clojure is more about being a "pure functional" language and Racket more about meta-programming... in fact Racket has been called a "meta-language".
- TeMPOraL 8y ago> You really can only do advanced meta-programming using functional techniques. My `loop for (symbol value) on bindings by #'cddr` and "push onto list in a loop, nreverse and return at the end" macros beg to disagree. Metaprogramming is just like any other programming, except that the output is fed to the compiler. The way Lisp is compiled, you can even use code generated by code in code that generates other code. That said, functional programming does indeed fit well with most of the stuff you do when writing code that writes code.
- deleted 8y ago[deleted]
- YorkshireSeason 8y agoThe generation of globally fresh variables (the Lisp community uses the famous gensym function for this purpose) is notoriously non-functional. Template Haskell uses a variant of the IO monad to hide the global state involved in the definition of gensym.