[Cs-dev] Lambdas
Date | 2013-05-20 15:56 |
From | Michael Gogins |
Subject | [Cs-dev] Lambdas |
Attachments | None None |
I may have asked this before, but does the Csound 6 orchestra language have lambdas and/or closures? Regards, |
Date | 2013-05-20 16:25 |
From | Steven Yi |
Subject | Re: [Cs-dev] Lambdas |
Not currently. Lambdas and closure both require there to be variables with type :Opcode or something like that. I've chatted with John Lato and Victor about adding an Opcode type for variables so that we could do stuff like: aout map sin, asig (There's a tabmap currently that's close, but uses an opcode name by string like "sin"). I guess if we had lambdas we could do: aout map {|k| -> sin(k)}, asig or some other syntax. The compiler could then read the lambda, generated an anonymous UDO, then replace the usage with the generated call (i.e. #udo1). Closure would be a bit more difficult. I'm interested to have opcodes as types so we can do map/foldl/foldr/filter/apply/etc. kind of functional programming stuff. On Mon, May 20, 2013 at 3:56 PM, Michael Gogins |