60 PicoLisp Functions You Should Know - 6: Lists and Strings
Welcome back! This is the last post of the 60 most common PicoLisp functions series. Today we will cover lists and strings.
We will handle the topic lists quite extensively as it is one of the most important data types in PicoLisp. After that, we wil...
picolisp-explored.com7 min read
Hi Mia, I do like the list part of this article, I never used yoke before (even did'nt know about it), now I will :-)
The 'c[a|d]+r' :-) functions in picolisp exist as a tribute for old lisper's, are'nt they? For beginners to (pico)Lisp I would prefer to define
(setq first car) # you can call it first-of-list if you want (setq rest-of-list cdr) # rest would overwrite existing picolisp core functionFor me it was easier to understand and to remember
: (first (rest-of-list '(1 2 3 4 5 6)) # same as (cadr '(1 2 3 4 5 6)) -> 2 : (rest-of-list (first '((1 2) 3 4 5 6)) # same as (cdar '((1 2) 3 4 5 6)) -> (2)But for sure,
(first (rest-of-list (rest-of-list (rest-of-list '(1 2 3 4 5 6))))would never ever be used (and therefore never be listed under the 60 most used functions) instead of a simple(cadddr (1 2 3 4 5 6)):-)
(By the way, both should return: 4)