Alexander Burger <> writes:

Hi Alex,

>> I see that the index function evaluates the entire lst before
>> searching for a match. Wouldn’t it be more efficient to evaluate the
>> elements of lst one by one, testing the result for a match, and only
>> proceed with evaluation of the next element if a match was not found? Is
>> there a specific reason why you didn’t implement it that way?
> What you describe here is call "lazy evaluation". While some languages
> support this, PicoLisp (like most other Lisps) doesn't.
> Think about what this would mean: The function 'list' must know somehow
> that it should stop, because some function up in the call history
> doesn't need the whole list.
> And even if it knew that, can it know that some side effects (like your
> 'prinl' above) may be omitted?
> The fundamental rule of Lisp function calls (a function recursively
> evaluates its arguments before it starts to run) is broken here.

Funny how views differ -  in the Clojure world "lazy evaluation" seems
to be a big feature ...

OTOH, Paul Graham writes 150pages about the beauty and power of macros
in 'On Lisp', what made me think that macros are the ultimate thing in
programming, only to read later that 'macros are cludge' in the PicoLisp
docs ;)



Reply via email to