I've written a blog article about the layout of closures in SBCL. Not so sure about the correctness of the content.
Related comments are always welcome!!
2011-04-08
2011-04-07
on Lisp being the string representation of AST
Lisp uses the string representation of AST as its syntax.
The good thing derived from this is: you have the whole AST available for massage, to transform it to whatever form. That's exactly what a control statement does.
But in languages like C, you cannot easily have the AST ready for the exact corresponding code you're writing now, which means it's hard, though not impossible , to transform or operate the AST using the code you are writing now. One might argue he does not need new control statement, but the ability to add new control statement matters for expressiveness and ease of generating DSLs.
The good thing derived from this is: you have the whole AST available for massage, to transform it to whatever form. That's exactly what a control statement does.
But in languages like C, you cannot easily have the AST ready for the exact corresponding code you're writing now, which means it's hard, though not impossible , to transform or operate the AST using the code you are writing now. One might argue he does not need new control statement, but the ability to add new control statement matters for expressiveness and ease of generating DSLs.
My thinking about Lisp's Macros
Macro is just let over lambda with prameterable bindings or body. Both being parameterable makes a macro-writing macro template: once given one, a macro is generated which expects another part. Again, this is just lamda with two parameters, two variables.
Macro and lambda differ in that the evaluation system treats them differently: macro has access to raw lambda list, unevaluated.
Macro is just lambda that has the chance given by the evaluation system to manipulate the raw lambda list and writes out new lists to replace itself. The unique and unified syntax of lisp renders the difficulty of writing them to be near to zero.
Macro and lambda differ in that the evaluation system treats them differently: macro has access to raw lambda list, unevaluated.
Macro is just lambda that has the chance given by the evaluation system to manipulate the raw lambda list and writes out new lists to replace itself. The unique and unified syntax of lisp renders the difficulty of writing them to be near to zero.
订阅:
博文 (Atom)