On Wed, Jan 29, 2020 at 01:47:12AM +0100, pd wrote:
> Hello,
>
> I'd like to know if there's in picolisp the common lisp concept of places,
Yes, it is called 'var' in the docs, and is either the VAL of a symbol or the
CAR of a list cell.
> I mean, is it possible to do this:
>
> (setq L (1 2 3))
> (set (car L) 'x)
> L -> (1 x 3)
: (setq L (1 2 3))
-> (1 2 3)
: (set (cdr L) 'x)
-> x
: L
-> (1 x 3)
> (set (cdr L) '(a b))
> L -> (1 a b)
: (con L '(a b))
-> (a b)
: L
-> (1 a b)
> I'd say it is not places in picolisp, but reference manual says:
>
> : (set 'L '(a b c) (cdr L) '999)
> -> 999
> : L
> -> (a 999 c)
>
> Which seems similar to places or at least to the use of setf in common
> lisp, but what I find strange is in my understanding the set form above
> should lead to L -> (a 999) or even (a . 999) because (cdr L) is (b c) and
> thus replacing cdr L with 999 leads to (a 999)... where's my error?
(cdr L) returns the second CELL in the list. 'set' sets the CAR of that cell.
> Also, if not having places, have we got scheme's setcar and setcdr at least?
I don't know Scheme, but setcar should be 'set' and setcdr is 'con'.
> Is there any way of manipulating parts of lists and even objects rather
> than using specific functions such as delete, replace and so on ?
Yes, sure, that's all what Lisp is about :)
☺/ A!ex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe