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.

4 comments:

Graham said...
This comment has been removed by a blog administrator.
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

Anonymous 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.

maha said...

Really good information to show through this blog. I really appreciate you for all the valuable information that you are providing us through your blog.

Digital Marketing Training in Chennai

Digital Marketing Course in Chennai