Saturday, December 02, 2006

python generators and more live coding music!

I just found out about the yield python keyword, which lets you produce generator functions. This came up, in a practical context, because I wanted a clean way to get n items at a time out of a list, and the Python Cookbook approach uses generator functions. They let you build an object that essentially contains a closure of the current environment, which can be iterated on. Sort of like lazy lists! Of course, the same behavior could be done with C-style static variables, but this is really pretty.

- yield keyword from the Python docs
- a discussion of generator functions over at IBM Developerworks.

Also! Brett alerts us to Impromptu, another live coding environment for making music and stuff! From their site:
Impromptu is an OSX programming environment for composers, sound artists, VJ's and graphic artists with an interest in live or interactive programming. Impromptu is a Scheme language environment, a member of the Lisp family of languages.

3 comments:

Like the Moon said...
This comment has been removed by the author.
Anonymous said...

Thanks for the link. Since Vinny always complains about a lack of functional languages for livecoding, perhaps he like this. (Though Supercollider is pretty functional.)

Graham

Gasten said...

Supercollider is very OO, not functional/logic. To bad Impromptu only runs on Mac, otherwise it would be the coolest thing on the planet.