3 ms·
Why prefer a non-functional construct over a functional construct in a functional language? The lisp loop macro simplifies the s-expression tree/heap traversal
by sargstuff 4y ago
Why prefer a non-functional construct over a functional construct in a functional language?
The lisp loop macro simplifies the s-expression tree/heap traversal for benifit of coder/reader. The lisp loop macro is implilmented based on s-expression tree traversal.
Trees are used with closures. Heaps are used with objects. (lisp & non-lisp)
In lisp can debate what's an 'object', but multiple thunks are managed through a
heap structure.
Tree (or heap form of tree) order traversals are forms of binary backward branching.
Tree traversal can be structured so 'iteration variables' are not needed. Default lisp termination is 'NIL'
If only returning a single struc (with no memory management), then heap not required.
If returning multiple strucs in a list/tree (aka multiple s-expressions), then the s-expression 'thunks' will be managed via heap.