3 ms·
F-expressions are functions taking unevaluated arguments, sort of a mixture of a macro and a function. It executes at runtime, whereas a macro executes at compi
by mtlmtlmtlmtl 5y ago
F-expressions are functions taking unevaluated arguments, sort of a mixture of a macro and a function. It executes at runtime, whereas a macro executes at compile time(technically macro-expansion time). They were abandoned in mainstream LISP early on. However, John Shutt ironed out some of the issues with fexprs in his PhD thesis, which is a good read if you're interested in lisp internals[1]. He also designed a scheme like lisp dialect incorporating fexprs, called Kernel.
[1]: https://web.wpi.edu/Pubs/ETD/Available/etd-090110-124904/ https://web.wpi.edu/Pubs/ETD/Available/etd-090110-124904/
- kazinator 5y agoThe F-expressions in this paper are not the same thing as FEXPRs. This was an internal, implementation terminology. Early Lisp has EXPR and SUBR routines: SUBR were written in machine language, and EXPR were interpreted functions. So EXPR doesn't mean "expression", but "function made of expressions that require code walking evaluation, rather than a straight machine-code subroutine ("SUBR") that can be called. The F prefix denoted functions that implemented special forms. That may be where the F comes from: FEXPR and FSUBR. These F variants receive the unevaluated forms. So COND might be implemented as a FSUBR, which interprets it: walks the cond pairs, evaluates the test expressions, and so on. Whereas CAR and CDR would be SUBRS (no "F").
- alexisread 5y agoKernel and it's successor wat (https://github.com/manuel/wat-js https://github.com/manuel/wat-js) has some great stuff, I personally prefer open composition from maru https://www.piumarta.com/freeco11/freeco11-piumarta-oecm.pdf https://www.piumarta.com/freeco11/freeco11-piumarta-oecm.pdf as it combines fexprs and macros into one construct.