<story><title>$vau: the ultimate abstraction (2010) [pdf]</title><url>https://web.wpi.edu/Pubs/ETD/Available/etd-090110-124904/unrestricted/jshutt.pdf</url></story><parent_chain></parent_chain><comment><author>gjm11</author><text>There&amp;#x27;s a bit of subtext in the title that may be worth drawing attention to. (I dunno, maybe it&amp;#x27;s all obvious to everyone interested enough in this stuff to be reading the dissertation. But perhaps not, so here goes.)&lt;p&gt;In the 1970s, after their paper introducing Scheme, Sussman and Steele published a series of papers showing how to implement a bunch of things &amp;quot;on top of&amp;quot; a functional-programming substrate, many of them having titles or subtitles of the form &amp;quot;Lambda: the ultimate X&amp;quot;. (The first one was &amp;quot;Lambda: the ultimate imperative&amp;quot;, the second &amp;quot;Lambda: the ultimate declarative&amp;quot;, others &amp;quot;Lambda: the ultimate GOTO&amp;quot; and &amp;quot;Lambda: the ultimate opcode&amp;quot;.)&lt;p&gt;The idea of these papers wasn&amp;#x27;t merely &amp;quot;look, you can implement X in Lisp&amp;quot;, but something more like &amp;quot;You might be inclined to think of X as simple and primitive and cheap, and Lisp as sophisticated and complicated and expensive -- but that&amp;#x27;s mostly prejudice, an accident of the particular hardware we happen to have built first, and using something like Lisp as your lower level and implementing these things on top is &lt;i&gt;better&lt;/i&gt; than doing it the other way around&amp;quot;.&lt;p&gt;So writing something -- especially something about a Lisp implementation -- with a subtitle of the form &amp;quot;X: the ultimate Y&amp;quot; where X is &lt;i&gt;not&lt;/i&gt; lambda -- is pointedly one-upping that.&lt;p&gt;Especially as the thing that $vau is allegedly providing the new best way to do is ... function abstraction, which is exactly what lambda is for.</text></comment>
<story><title>$vau: the ultimate abstraction (2010) [pdf]</title><url>https://web.wpi.edu/Pubs/ETD/Available/etd-090110-124904/unrestricted/jshutt.pdf</url></story><parent_chain></parent_chain><comment><author>jhallenworld</author><text>I&amp;#x27;ve implemented something like this in a non-LISP syntax language.  See:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;jhallen&amp;#x2F;joes-sandbox&amp;#x2F;tree&amp;#x2F;master&amp;#x2F;lang&amp;#x2F;ivy&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;jhallen&amp;#x2F;joes-sandbox&amp;#x2F;tree&amp;#x2F;master&amp;#x2F;lang&amp;#x2F;ivy&lt;/a&gt;&lt;p&gt;The idea is that in a function call, the arguments are normally evaluated before the call as usual.  But if a formal argument in the function&amp;#x27;s declaration is prefixed with ampersand then during a function call, that argument is not evaluated, but is instead packaged up as a zero-argument lambda function.  The argument can be called later using the normal function call syntax, but also there is semantic sugar: the * operator calls a zero-argument function.&lt;p&gt;Further, when a variable is evaluated, you get both its value and a reference to it.  This allows variables to be evaluated before being assigned to in assignments.  This sounds weird, but it works with the above.  You can make a &amp;quot;set&amp;quot; function which does the same thing as assignment:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    # Define set function
    fn set(&amp;amp;left, right) {
        *left = right
    }

    # Set x to 10
    set x 10
&lt;/code&gt;&lt;/pre&gt;
Here is how you could define switch using primitives (if the last argument is prefixed with ampersand, then any extra arguments are treated the same, but can only be accessed via argv):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    fn switch(&amp;amp;val) {
            var rtn, x, v = *val
            x = 1
            while x &amp;lt; len(argv) - 1 {
                    if *argv(x) == v {
                            return *argv(x + 1)
                    }
                    x += 2
            }
            if x &amp;lt; len(argv) {
                    return *argv(x)
            }
            return void
    }
&lt;/code&gt;&lt;/pre&gt;
Example use (8 arguments passed to switch- each set of braces is an argument):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch 2 1 {
        print &amp;quot;one&amp;quot;
    } 2 {
        print &amp;quot;two&amp;quot;
    } 3 {
        print &amp;quot;three&amp;quot;
    } {
        print &amp;quot;default&amp;quot;
    }
&lt;/code&gt;&lt;/pre&gt;
&amp;quot;two&amp;quot; is printed in this case.&lt;p&gt;Right now the delayed arguments are evaluated in the closure of the function call (so they are lexically scoped).  The wrap&amp;#x2F;unwrap concept from this paper gives me ideas on how to make this more versatile...</text></comment>