Hi Dean,

> I'm sure I can only return multiple values from a function as a list.
> I can assign those values to multiple symbols in the calling function like
> this...
> (setq L (1 100 1000))
> (setq A (get L 1) B (get L 2) C (get L 3))


> but wonder if there's a shorter way.

For the elements near the beginning of a nested List structure there are direct
access functions cXXXXr, i.e. car, cdr, cadr, cdar, cddr ... up until 4 'a's or

So the 4th element of a list is (cadddr L), and the above becomes

   (setq A (car L)  B (cadr L)  C (caddr L))

Another possibility is to use de "destructuring bind" feature of 'let' (only
available in pil64). It is the shortest:

   (let ((A B C) L) ...

So if you get this list from a function 'foo', you would do

   (let ((A B C) (foo)) ...

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

Reply via email to