Hi Thorsten,

> > In PicoLisp, a property list cannot be seen separated from a symbol.
> > After all, these are properties OF a symbol. It is just an
> > implementation detail that they are a list internally.
> 
> not in PicoLisp, but e.g. in Emacs Lisp there are standalone plists like
> the above, and functions like plist-{get|put|member} to work with them

OK, but then I feel that they use the wrong term in Emacs Lisp. A
"property" is something an item *has*, i.e. a symbol in Lisp.

A stand-alone list of key-value pairs is traditionally called an
"association list".


> Yes, named parameters is my use-case, e.g. wrapping an R function like
> plot() with *many* named parameters, most of them with decent default
> values and thus omitted in function calls, in PicoLisp glue code.
> 
> > What exactly would be your goal?
> 
> there are actually two goals:
> 
>  1. create functions with named parameters

Yes. So the approaches shown in the rosetta code tasks help?


>  2. use flat lists like (:a b :c d) like alists ((:a . b) (:b . c))

You can use a flat list with 'memq' (instead of 'assoc' or 'asoq'):

   : (cdr (asoq 'b '((a . 1) (b . 2) (c . 3))))
   -> 2

   : (cadr (memq 'b '(a 1 b 2 c 3)))
   -> 2

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

Reply via email to