Re: "macros" in miniPicoLisp

2024-03-02 Thread C K Kashyap
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  wrote:

> Super! - thank Alex.
>
> On Fri, Feb 9, 2024 at 11:17 AM Alexander Burger 
> 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
>>
>


Re: "macros" in miniPicoLisp

2024-03-02 Thread Alexander Burger
On Sat, Mar 02, 2024 at 10:05:00AM -0800, C K Kashyap wrote:
> Another installment of the video -
> https://www.youtube.com/watch?v=O52fRAsr7Vg

Very nice indeed! This is probably the first time PiccLisp does something
non~triwial on Windows.

Tharks for sharing!

☺/ A!ex

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


Re: "macros" in miniPicoLisp

2024-03-02 Thread C K Kashyap
Thanks Alex!

On Sat, Mar 2, 2024 at 1:02 PM Alexander Burger 
wrote:

> On Sat, Mar 02, 2024 at 10:05:00AM -0800, C K Kashyap wrote:
> > Another installment of the video -
> > https://www.youtube.com/watch?v=O52fRAsr7Vg
>
> Very nice indeed! This is probably the first time PiccLisp does something
> non~triwial on Windows.
>
> Tharks for sharing!
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>