guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python


From: Stefan Israelsson Tampe
Subject: Python
Date: Sun, 19 Sep 2021 21:49:31 +0200

in python on guile you can do,

def g(yield_fkn,x):
    yield_fkn(x+1)
    yield_fkn(x+2)

and 
def f(l):
   for x in l:
        g(yield,x)

and this extension works like this in python on guile

list(f([1,2])
--> [1,2,2,3]

Nifty right. This is thanks to the superb infrastructure in scheme (selimited continuations). Not only this, in python-on-guile the generators and iterators are serialisable and hence you can deep copy them. (on the condition that you turn off unboxing in the compiler).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]