|
|
|
|
|
by kazinator
537 days ago
|
|
In TXR Lisp, I implemented an original invention of mine called Paremeter List Macros (Parameter Macros for short). A parameter macro works in any lambda syntax. Methods, macros. The documentation for Parameter List Macros shows an example implementation of rudimentary memoization. https://www.nongnu.org/txr/txr-manpage.html#N-C9CAE162 You can use :memo in a method if you like, in a lambda expression, defmacro, macrolet, labels, ...: anywhere you have a lambda parameter list. There is a predefined parameter macro called :key which implements keyword parameters. (Common-Lisp-like keyword parameters are not native to the language run-time at all: you have to use this param macro if you want them.) Another predefined parameter macro called :match allows you to express a function with pattern matching. :match will take stock of your patterns and implicitly generate a parameter list which can take any of those patterns, and a function body which then further handles the cases. |
|