Re: A system to access very large lists by index

2015-02-22 Thread Enrique Sánchez
 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);
   ...
}
/**/

thank you, I will try that.

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


Re: A system to access very large lists by index

2015-02-22 Thread Alexander Burger
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 200 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