electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
functional programming/message passing in chuck
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
flies



Joined: May 20, 2008
Posts: 33
Location: NJ

PostPosted: Fri Mar 23, 2018 2:15 pm    Post subject: functional programming/message passing in chuck Reply with quote  Mark this post and the followings unread

I seem to recall seeing a library somebody built that introduced functional programming styles into ChucK. I recall a bunch of classes like TwoArgumentFunction.

Basically, I'm getting back into chuck, and I'd like to be able to do something like this:
Code:

fun void modulate (UGen carrier, string param, UGen modulator, dur invModRate) {
    while (true) {
   modulator.last() => carrier.`param`;
   modRate => now;
    }
}


This way, I wouldn't have to define a new function for every parameter I want to modulate.

Does anyone remember the library I'm talking about or do you know another way to do the kind of message passing I'm after?

(If I ran the zoo, the language would build something like this in. Modulation of parameters by UGens is a common task.)
Back to top
View user's profile Send private message
flies



Joined: May 20, 2008
Posts: 33
Location: NJ

PostPosted: Fri Mar 23, 2018 2:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

found the library I was looking for by googling "chuck functor"

https://github.com/heuermh/lick
Back to top
View user's profile Send private message
flies



Joined: May 20, 2008
Posts: 33
Location: NJ

PostPosted: Fri Mar 23, 2018 3:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

LiCK includes a Module.ck. Obviously, I'm super new to LiCK, but, as best as I can tell, this class only helps if you subclass it for every parameter you want to modulate. This helps insofar as you can now chuck directly into the parameter you want to modulate (if you don't mind the added abstraction) - and you still have write a new subclass for every parameter...
Back to top
View user's profile Send private message
heuermh



Joined: Dec 15, 2006
Posts: 19
Location: minneapolis

PostPosted: Fri Aug 03, 2018 8:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hello flies, sorry for the delay in responding!

I wrote this issue up as a feature request
https://github.com/ccrma/chuck/issues/110

Module.ck and related (Module2.ck, Module3.ck, etc.) let you ChucK up to n parameters via subclassing. Yeah it sucks but it is the best I could come up with short of language changes as described in the issue above.

Please let me know how you get on with ChucK and LiCK!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use