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

Re: [sc-users] Choosing and evaluating a random function from an Event object



No problem, glad to help!

On Wed, Dec 21, 2016 at 4:05 PM, John DeBlase <bsnacks000@xxxxxxxxx> wrote:
Sure did... thanks!

On Wed, Dec 21, 2016 at 4:02 PM, brian heim <brianlheim@xxxxxxxxx> wrote:
I think a.choose.value(a) ought to work.

Regards,
Brian

On Wed, Dec 21, 2016 at 3:48 PM, John DeBlase <bsnacks000@xxxxxxxxx> wrote:
Hi,

I'm working on an app where I'd like to be able to choose values stored in an event object that are either constant or some permutation of those constant values evaluated by a function.

However, trying to execute the event's func method using .choose does not seem to work. Calling the func explicitly does work as expected... 

a = (varA: 10, varB:30, func: {|self| self.varA + self.varB; })

a.choose.value // returns 10, 30 or "ERROR: Message 'varA' not understood" when func is chosen

a.func.value // returns 40 as expected

Is there a way to randomly choose and evaluate a function from a collection in this way?

thanks in advance,
johnny



--
_______________________________
Brian Heim

B.M. '14 University of Texas at Austin
M.M. '16 Yale School of Music




--
_______________________________
Brian Heim
507-429-6468

B.M. '14 University of Texas at Austin
M.M. '16 Yale School of Music