Hi Alex
>(let ((A B C) (foo))
I am using pil64 so...That's great...Thank you very much indeed
Best Regards
Dean

On 18 December 2016 at 21:05, Alexander Burger <a...@software-lab.de> wrote:

> 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))
>
> Right.
>
>
> > 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
> 'd's.
>
> 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