On 3. Sep, 2014, at 09:58, Jon Kleiser <[email protected]> wrote:

> Hi Alex,
> 
>> From this example (using 32-bit PicoLisp)
> 
> : (index 9 (list 1 2 (prinl 9) (prinl 'more) 9))
> 9
> more
> -> 3
> 
> 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?
> 
> Another question re. index:
> In the method final static int indx(Any x, Any y) in ersatz/sys.src, on lines 
> 988-989, there is this:
>         if (z == (y = y.Cdr))
>            return 0;
> 
> Can you explain which case this if-test is handling?

Now I think I know the answer to the last question: It tests for circularity.

/Jon--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to