Alexander Burger <> writes:

Hi Alex,

>> using flat property lists with keywords like
>> ,----
>> | (:a b :c d)
>> `----
>> as data (not as a symbol's property list) is pretty common in e.g. Emacs
>> Lisp and elsewhere. In Clojure the keywords even work like functions
> I feel that I don't completely understand the question.
> 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
(additional to 'get' and 'put' for symbol's plists).

> A stand-alone list of key-value pairs is an "association" list, as used
> with 'assoc' or 'asoq'.
>> These 'stand-alone' property lists are pretty useful for function
>> keyword arguments too, e.g.
>> ,----
>> | (defun foo (&keys a b c (d . 5) e (f . "g")) ...)
>> `----
> There were some rosetta tasks in that like. I don't remember exactly if
> they address the same problem, but you may look at the "Named
> parameters" and "Optional parameters" tasks. Is this similar?

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

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

Both could be solved when (let L ...) in the following code would work:

#+BEGIN_SRC picolisp  
: (let (:a 'b :c 'd :e 'f) :c)
-> d
: (de foo L (let L :c))
-> foo
: (foo :a 'b :c 'd :e 'f)
-> NIL

I tried (let `L ...), (let (L) ...) and quite a lot of other
combinations, but always get NIL or an error. 



Reply via email to