4 ms·
Exactly. There's a spectrum of evaluation strategies from eager to lazy. Programs may mix various flavors. Lazy evaluation combined with memoization is a sexy
by greghendershott 11y ago
Exactly.
There's a spectrum of evaluation strategies from eager to lazy. Programs may mix various flavors.
Lazy evaluation combined with memoization is a sexy and elegant approach to some problems, as are dynamic web sites. On the other hand, whenever possible to do so, it's hard to beat the speed and simplicity of handing over a precomputed answer like "42".
A (very loose) analogy:
Static generation of HTML is roughly like using Lisp macros to evaluate some things before runtime (at "expand time" or "compile time").
The resulting transformed code could be a simple literal like "<html> ... </html>". Or the code might need further evaluation at runtime -- which is roughly like the precomputed HTML containing JavaScript to do things at runtime.
- davexunit 11y agoFunny that you mention Lisp. I am writing my own static site generator (because there are so few of them and everyone needs their own) in Scheme. http://haunt.dthompson.us http://haunt.dthompson.us
- greghendershott 11y agoCool. Mine's in Racket: https://github.com/greghendershott/frog#frog https://github.com/greghendershott/frog#frog > (because there are so few of them and everyone needs their own) A million monkeys.... :)
- davexunit 11y agoOh, didn't know you were the frog author. Awesome!