[<<][sm][>>][..]
Sat Jan 18 21:12:08 CET 2020

Inlined forms

This is a trick to use something that looks like the application of a
function, but is easy to implement.

Given a form like this:

(let ((a 123))
   (map (lambda (x) (+ x a)) '(1 2 3)))

Where a closure is consumed immediately by a higher order function.

This can be re-arranged by inlining the 'map'.

Basically flipping things around: the stack frame used to implement
map will be hidden to the rest of the function.

So what does this actually do, when we're restricted to stacks?

1. It inserts the stack frame of map (e.g. iteration control
   variables) in a way that is not accessible to the body of the
   lambda.

2. It inserts the stack frame of the lambda.

so we have the following stacking:

a=123
(iter control, invisible)
x=1,2,3,...

So basically I should define a machine that can do this kind of stack
frame interleaving, then optionally "hide" frames.


EDIT: Is an inlined form the same as a downward closure?  The DC would
be explicit.  Rust solves it by moving ownership, and is much more
flexible.




[Reply][About]
[<<][sm][>>][..]