help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What does "lacks a prefix" mean?


From: Barry Margolin
Subject: Re: What does "lacks a prefix" mean?
Date: Fri, 10 Jul 2015 14:27:40 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.6685.1436547891.904.help-gnu-emacs@gnu.org>,
 Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> >> let* says "I need variables which depend on each
> >> other" and if they're really not, that look strange.
> 
> If let behaved like let* it wouldn't look strange to you.  Many other
> functional languages dropped the "simultaneous let" and only kept the
> equivalent of let* (or even letrec).

It should be noted that the original LET macro in MacLisp was basically 
a rearranged LAMBDA:

(let ((var1 val1) (var2 val2) ...) body...)
==>
((lambda (var1 var2 ...) body...) val1 val2 ...)

When written this way, you can see where the order of evaluation of the 
values, and the parallel binding of the variables came from: arguments 
to a function have to be evaluated before the function is called (except 
in "lazy" languages).

Most other languages also have function call syntax, and if they have 
anonymous functions they can express the same parallel binding. E.g. in 
Javascript you can write an "IIFE":

(function(var1, var2, ...) {body...})(val1, val2, ...)

This is actually a common idiom (and whenever I see it, I cringe that 
they somehow discovered the original Lisp syntax, yet didn't adopt the 
LET-style rewrite that makes it easier to comprehend).

What they generally don't have is multiple ways to introduce local 
variables in the same scope of a function.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]