Another installment of the video - https://www.youtube.com/watch?v=O52fRAsr7Vg I think my over 15 years of pursuit of finding the perfect programming language is complete :) - The sad thing is that I had discovered PicoLisp long ago but had discarded it because it was "just an interpreter" :) I am finally free to explore my actual ideas now! Regards, Kashyap
On Fri, Feb 9, 2024 at 2:28 PM C K Kashyap <ckkash...@gmail.com> wrote: > Super! - thank Alex. > > On Fri, Feb 9, 2024 at 11:17 AM Alexander Burger <picolisp@software-lab.de> > wrote: > >> Hi Kashyap, >> >> > Does this look like a reasonable way to create the "create-adder" >> function? >> > >> > (de create-adder Args >> > (let >> > (N (car Args) >> > Adder (intern (pack "add-" N)) >> > P >> > (list >> > 'de >> > Adder >> > '(X) >> > (list '+ N 'X) ) ) >> > (eval P) ) ) >> > >> > : (create-adder 10) >> > -> add-10 >> > : (add-10 20) >> > -> 30 >> >> Yes, but you can do it a little simpler by directly calling 'def': >> >> (de create-adder (N) >> (def (intern (pack "add-" N)) >> (list '(X) (list '+ N 'X)) ) ) >> >> Note also that I use (N), i.e. an evaluated argument, as this makes the >> function >> more general. >> >> >> Even simpler if you use 'curry': >> >> (de create-adder (@N) >> (def (intern (pack "add-" @N)) >> (curry (@N) (X) >> (+ @N X) ) ) ) >> >> It is especially simpler if the function body, which is here just (+ N >> X), is >> more complicated, because then the 'list'ing and 'cons'ing of the body >> would >> become very unreadable. >> >> >> > If I understand correctly, the "macro" capability of miniPicoLisp is >> not at >> > par with PicoLisp right? >> >> The 'macro' function of mini and normal PicoLisp is the same I think. >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> >