Forgot to CC the list, and now I lost my original message :(
... trying again

Hello Bayren,

To access the nth-element of a list one would use list-ref. For example:

(list-ref (list 1 2 3 4) -> 3)

The problem with linked-lists is that in order to access an element the
list has to be traversed. To access/modify elements in constant time it
might be better to use vectors instead. If you need vectors that grow in
size dynamically have a look at the dyn-vector egg:
http://wiki.call-cc.org/eggref/4/dyn-vector

greetings,
Richard



Bahman Movaqar writes:

> How would a seasoned Schemer access the nth element of a list? (drop)?
> Does it have any performance penalty?
>
> TIA,

-- 

_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to