Hi Enrique,

>     (de leap (L)
>        (make (for (P L P (nth P 9)) (link P))) )
> 
>     (de helper (L)
>        (leap(leap(leap(leap(leap(leap L)))))) )
> 
> We initialize the original list, and build the helper list:
> 
>     (setq A (need 2000000 0) # two million elements list
>           B (helper A) )

Good idea! So you build a kind of octuple tree.


> We now define a new primitive function, in order to traverse
> the helper list. (I have added it to the /src/subr.c file of
> the picolisp source code).
> 
> any doFastNth(any ex) {
>     any x = cdr(ex);

Alternatively, you might consider putting it inline into the Lisp source

   (load "@lib/gcc.l")

   (gcc "fast" NIL 'fastNth)

   any fastNth(any ex) {
      any x = cdr(ex);
      ...
   }
   /**/

or - if you cannot have a C compilter at runtime - build a shared object
file (DLL) and call it e.g. as (fast:Nth ..).

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

Reply via email to