Hello, I've recently stumbled across Picolisp (while playing around with Termux) and have been reading up and finding it very intriguing. In the process of learning, I experimented with making a function to generate incrementor functions, e.g. (make-inc 2) would return a function that adds two to its input. My current solution looks like this:

: (de make-inc (X) (list '(Y) (list '+ X 'Y)))
-> make-inc
: (setq inc1 (make-inc 1))
-> ((Y) (+ 1 Y))
: (setq inc2 (make-inc 2))
-> ((Y) (+ 2 Y))
: (inc1 3)
-> 4
: (inc2 3)
-> 5

..but I am wondering if there might be more idiomatic approaches that allow the "function under construction" to be specified in a more readable fashion than building it up using "list"? Is there perhaps a mechanism for temporarily escaping from a quoted section to evaluate a specific symbol? Or some other approach that is similar where the "templated" parts of the function being built can be written as they would normally appear?

Thanks in advance for any hints, and I look forward to hanging around and learning from this list.

-wilhelm


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

Reply via email to