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: Pascal J. Bourguignon
Subject: Re: What does "lacks a prefix" mean?
Date: Fri, 10 Jul 2015 02:49:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

>> > And non-parallelizable theoretically :)
>> 
>> Regular let isn't parallelizable. It specifies that the value
>> expressions are evaluated in order.
>> 
>> The only difference between the two is the environment within which
>> later expressions are evaluated.
>
> FWIW, Common Lisp specifies that "let performs the bindings
> in parallel and let* does them sequentially."
>
> That is theoretical, just a restatement that `let' bindings
> are independent.  But it means that yes, they *could* be
> evaluated in parallel (because they are independent).

IF they are independent, and notably IF they are side effect free.

(let ((i 0))
  (cons (let ((i 42)
              (a (print (incf i)))
              (b (print (incf i)))
              (c (print (incf i))))
           (list i a b c))
        i))
prints:
    1
    2
    3
--> ((42 1 2 3) . 3)

Here, there's now way the initialization expressions in the inner let
be evaluated in parallel.  The left-to-right evaluation order is
imperative, because of the side effects.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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