Hi Kashyap,

> I was going over the evExpr functions in miniPicoLisp/PicoLisp 32 and had a
> couple of questions -
> 
> If I understand correctly - if (isNil(y)) block deals with expressions such
> as
> (F 1 2) where F => (de F (X Y) (+ X Y)) and the else if (y != At) block
> deals with the scenario where F => (de F X (for I X (prinl I))) .

Correct, but the latter deals also with

   (de F (A B C . X) ...

because A, B and C are eaten up by the while (isCell(y)) above.


> My questions are as follows -
> 
> 1. Why do we have this block of code? It seems to evaluate the args which
> is only used in the if(isNil(y)) block.


No, it does not evaluate. Evaluation took place already in the loop above. The
results of the evaluations were saved in the stack structures, and this loop
binds all values *simutaneously* to the symbols.


> Why is it not like the "binding"
> that happens in doLet - to back up the values of the symbols?
>    while (isCell(y)) {
>       f.bnd[f.cnt].sym = car(y);
>       f.bnd[f.cnt].val = EVAL(car(x));
>       ++f.cnt, x = cdr(x), y = cdr(y);
>    }

'let' does not bind simultaneously, but one after the other. It is like 'let*'
in Common Lisp.


> 2. In what scenario is the final else block used?

The final one is where (y == At), i.e. a variable number of evalated arguments.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to