use Machine.add.  The docs aren't descriptive, but when you Machine.add a ChucK program, any classes it defines will be available in the runtime for any future chuck programs you add to the VM.  The ChucK compiler is single-pass and has no concept of make files or a build system, though, so if you want one file to include another file, you have to have a third file that defines the order to add the files to the VM.  

http://chuck.cs.princeton.edu/doc/language/spork.html

e.g., here's an example of a ChucK program that I invoke that imports a bunch of other utility files: https://github.com/jordanorelli/wii-chuck-synth/blob/master/resin.ck

if you look in resin_run.ck, I utilize some of the stuff that is imported in resin.ck.  resin_run.ck will fail to compile if those other files aren't already loaded into the VM, so it's resin that I run from the command line.




On Mar 5, 2012, at 5:41 PM, George Locke wrote:

Hi,

I want to make a library of functions that I can call from any chuck script.  If I put those functions in one file, how do I access them from another?  It would be great if I could make them into a new namespace, akin to Std.X or Math.X (I am using miniAudicle 0.2.0, not command line.)  

(I checked the language specification for the words "include" and "import" and found nothing relevant.)

Thanks,
George

(I am new to chuck, but not to computer programming, nor computer audio.)

PS is there a popular/built-in solution for making exponentially distributed, normally distributed, etc random variables?

PPS If not, I'd be happy to share my work - is there a common way for people to share code like this?

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users