Re: on racket and other Lisps

Liste des GroupesRevenir à cl lisp 
Sujet : Re: on racket and other Lisps
De : jshem (at) *nospam* yaxenu.org (Julieta Shem)
Groupes : comp.lang.lisp
Date : 01. Jun 2024, 15:23:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87ttic6bkm.fsf@yaxenu.org>
References : 1 2 3 4 5 6 7
Lawrence D'Oliveiro <ldo@nz.invalid> writes:

On Fri, 31 May 2024 23:48:37 -0300, Julieta Shem wrote:
>
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
 
Perhaps look at Python as the closest we have managed to come to “Lisp
2”. It still allows for homoiconicity to some degree.
 
Can you give an example of Python's homoiconicity?
>
Sure. Have a look at this library <https://gitlab.com/ldo/seaskirt/>. It’s
a set of wrappers around the various management APIs available for the
Asterisk telephony engine.
>
I wanted to create both synchronous and asynchronous versions of each of
the wrapper classes. For example,
>
    def func(...) :
        ...
        res = net_call(...)
        ...
    #end func
>
versus
>
    async def func(...) :
        ...
        res = await net_call_async(...)
        ...
    #end func
>
but I didn’t want to write out the “...” parts (which made up about 90% of
the code) twice. So what I actually wrote looked like this:
>
    async def func(...) :
        ...
        if ASYNC :
            res = await net_call(...)
        else :
            res = net_call(...)
        #end if
        ...
    #end func
>
That “ASYNC” is not defined anywhere: it’s just a placeholder. But after
the code is compiled to AST form, I run a preprocessor which looks for
those conditionals, and expands the alternatives inline, generating two
versions of the code which correspond, in source form, to the two versions
I avoided writing explicitly.
>
One fun thing is, I also figured out I could do class instantiations
asynchronously.
>
So even though the macro preprocessing system adds about 160 lines to the
module, I estimated the whole thing is still over 500 lines smaller than
it would be if I had written out all the code by hand. That’s 500 less
lines for bugs to occur in, and for me to maintain.

What's your definition of homoiconicity?

Date Sujet#  Auteur
28 May 24 * Re: on racket and other Lisps18B. Pym
28 May 24 +- Re: on racket and other Lisps1Lawrence D'Oliveiro
28 May 24 +* Re: on racket and other Lisps6De ongekruisigde (ds.)
29 May 24 i`* Re: on racket and other Lisps5Lawrence D'Oliveiro
29 May 24 i `* Re: on racket and other Lisps4De ongekruisigde (ds.)
29 May 24 i  +* Re: on racket and other Lisps2Cor
30 May 24 i  i`- Re: on racket and other Lisps1Lawrence D'Oliveiro
30 May 24 i  `- Re: on racket and other Lisps1steve
30 May 24 `* Re: on racket and other Lisps10Mark Wooding
1 Jun 24  `* Re: on racket and other Lisps9Lawrence D'Oliveiro
1 Jun 24   `* Re: on racket and other Lisps8Julieta Shem
1 Jun 24    `* Re: on racket and other Lisps7Lawrence D'Oliveiro
1 Jun 24     `* Re: on racket and other Lisps6Julieta Shem
2 Jun 24      `* Re: on racket and other Lisps5Lawrence D'Oliveiro
2 Jun 24       +- Re: on racket and other Lisps1Kaz Kylheku
5 Jun 24       `* Re: on racket and other Lisps3Mark Wooding
5 Jun 24        `* Re: on racket and other Lisps2Stefan Monnier
5 Jun 24         `- Re: on racket and other Lisps1Madhu

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal