From: owner-sc-users-digest@lists.io.com (sc-users-digest) To: sc-users-digest@lists.io.com Subject: sc-users-digest V1 #340 Reply-To: sc-users Sender: owner-sc-users-digest@lists.io.com Errors-To: owner-sc-users-digest@lists.io.com Precedence: bulk sc-users-digest Wednesday, August 8 2001 Volume 01 : Number 340 ---------------------------------------------------------------------- Date: Sun, 05 Aug 2001 15:43:00 -0500 From: James McCartney <---@---.---> Subject: Re: NAryOps on 8/4/01 6:30 PM, crucial at felix@crucial-systems.com wrote: > James, is there any other reasons you didn't finish fleshing out the NAryOp > stuff ? > just didn't need it at the time and moved on ? complications ? UnaryOpUGen and BinaryOpUGen are kind of messy on the inside because they have to install one of many different operators. The alternative would have been to have it messy on the outside, having many different ugen classes for each operator. Since there are fewer n-ary operators, I chose to make them separate ugens. This makes for cleaner code. > I must admit I haven't yet grokked reverseComposeBinaryOp or how best to > handle > mixed types ( eg. blend( a function, a simple number, a function) ) This is a way to do double argument dispatching in a single argument dispatch language. On several occasions I have verged on implementing multiple dispatch, but did not finish working out the complications it introduces. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Sun, 05 Aug 2001 15:47:39 -0500 From: James McCartney <---@---.---> Subject: Re: Something's up Can you email me specific code that exhibits these problems? on 8/1/01 3:33 PM, crucial at felix@crucial-systems.com wrote: > so i was thinking the (voice allocation / maxVoice limitation ) > either steals or releases the env. > > not setting maxVoices, I'm not having these weird problems. > THIS CRASHES FOR 2.2.10 AND 2.2.11 > > a couple of times it crashed when changing tempo. sometimes just while > its playing, sometimes when hitting buttons. > > i have had a couple of other unexplained crashes, while doing things > i have routinely done for months. > > but it seems pretty stable now. > > > this still stands: > > >> Okay my mistake in this case was that a PlayerMixer was sent >> valueArray rather than .value or .ar and so (Object::valueArray) >> returned itself as the final result of a ugenGraphFunc rather >> than playing itself. >> >> under 2.2.11 this consistently locks up SC and the whole mac. >> under 2.2.10 it calls an error on Frame H ( some int address ), >> and halts. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Sun, 5 Aug 2001 17:33:58 -0400 (EDT) From: Adam Burr <---@---.---> Subject: ibook does anyone have any experience using supercollider on an ibook for real-time signal processing? what hardware do you need for laptop audio I/O? does anyone know anything about the m-audio quattro? thanks in advance. adam. ------------------------------ Date: Sun, 05 Aug 2001 17:46:22 -0400 From: "crucial" <---@---.---> Subject: Re: NAryOps >> felix: >> I must admit I haven't yet grokked reverseComposeBinaryOp or how best to >> handle >> mixed types ( eg. blend( a function, a simple number, a function) ) >jmc: >This is a way to do double argument dispatching in a single argument >dispatch language. very good definition here: http://wiki.cs.uiuc.edu/cs497rej/double+dispatching now i understand the double dispatch. On several occasions I have verged on implementing >multiple dispatch, but did not finish working out the complications it >introduces. because now there are N ** numberOfTypes messages ? got it. so with the code i posted, it does in fact work, simply because its sending a.performList(operator, [b , c] ) at every interation of the stream, valuing of the function, or buffer processing of the ugen (depending on which NOp was composed by class of a ) buts its probably not optimal. >--- james mccartney james@audiosynth.com _____(( http://crucial-systems.com _________________))_______ ------------------------------ Date: Sun, 05 Aug 2001 16:51:12 -0500 From: James McCartney <---@---.---> Subject: Re: literals on 7/30/01 10:10 PM, Paul Lansky at paul@silvertone.Princeton.EDU wrote: > > Hello > > I want to write a large array of literals (#[]) > to disk an read it back at a later time. > Can someone tell me how to do this. I seem to > be confused about this. thanks > > paul lansky > //////////////////////////////////////////////////// // create an array. z = [\a, 123, 4.56, "string", [1, 2], [[3, 4],[5, 6],[[7, 8],[9, 10]],[[11, 12],[13, 14]]]]; // write as a file f = File("literaltest","w"); // use file as an io stream. // <<< means store the compile string of the object. // << means store a print string of the object. f << "#" <<< z << "\n"; f.close; //////////////////////////////////////////////////// // load the file thisProcess.interpreter.executeFile("literaltest").postln //////////////////////////////////////////////////// // or more simply: "literaltest".load.postln - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Aug 2001 02:04:52 -0400 From: christian adam hresko <---@---.---> Subject: method overriding does SC allow for method overrides within the same class? there's a good reason why i'd like to do this, i just don't want to implement class methods which are going to be a pain in the ass for the compiler or the interpreter. (i.e. i'm guessing the use of class methods with different names as opposed to different signatures are easier for look ups) case in point, christian ------------------------------ Date: Mon, 06 Aug 2001 06:42:05 -0500 From: James McCartney <---@---.---> Subject: Re: method overriding on 8/6/01 1:04 AM, christian adam hresko at godpup@ix.netcom.com wrote: > does SC allow for method overrides within the same class? No. Does any language? I don't understand what the point would be unless they were predicate methods with different predicates as in Cecil. > > there's a good reason why i'd like to do this, i just don't want to > implement class methods which are going to be a pain in the ass for the > compiler or the interpreter. (i.e. i'm guessing the use of class methods > with different names as opposed to different signatures are easier for > look ups) All method lookups are the same. Class method lookups are no more expensive than any other kind. Even doesNotUnderstand is fast in SC. > case in point, at this point he fell asleep.. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Aug 2001 11:37:00 -0400 From: christian adam hresko <---@---.---> Subject: Re: method overriding James McCartney wrote: > on 8/6/01 1:04 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > does SC allow for method overrides within the same class? > > No. Does any language? I don't understand what the point would be unless > they were predicate methods with different predicates as in Cecil. ummmm... C++ allows method overrides within the same class. public: void aMethodWithThisName(int); private: void aMethodWithThisName(node *&, int &); this is a 'classic' textbook example. there's a reason for everything. and i'm not using predicates, nouns, adjectives, or gender types. > > > > > > there's a good reason why i'd like to do this, i just don't want to > > implement class methods which are going to be a pain in the ass for the > > compiler or the interpreter. (i.e. i'm guessing the use of class methods > > with different names as opposed to different signatures are easier for > > look ups) > > All method lookups are the same. Class method lookups are no more expensive > than any other kind. Even doesNotUnderstand is fast in SC. > > > case in point, > > at this point he fell asleep.. nighty night. cheers.shouldUnderstandThisMessage, christian ------------------------------ Date: Mon, 06 Aug 2001 11:24:38 -0500 From: James McCartney <---@---.---> Subject: Re: method overriding on 8/6/01 10:37 AM, christian adam hresko at godpup@ix.netcom.com wrote: > ummmm... C++ allows method overrides within the same class. That is overloading, not overriding. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Aug 2001 12:37:16 -0400 From: christian adam hresko <---@---.---> Subject: Re: method overriding James McCartney wrote: > on 8/6/01 10:37 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > ummmm... C++ allows method overrides within the same class. > > That is overloading, not overriding. > whoopsie. sorry about that. overloading. does SC allow for method overloading? (man, i get another F on that one) cheers, christian ------------------------------ Date: Mon, 06 Aug 2001 12:41:09 -0400 From: christian adam hresko <---@---.---> Subject: Re: method overriding (no) overloading christian adam hresko wrote: > James McCartney wrote: > > > on 8/6/01 10:37 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > > > ummmm... C++ allows method overrides within the same class. > > > > That is overloading, not overriding. > > > > whoopsie. sorry about that. overloading. > > does SC allow for method overloading? (man, i get another F on that one) > more specifically, method overloading within the same class. thanks. christian ------------------------------ Date: Mon, 06 Aug 2001 12:14:11 -0500 From: James McCartney <---@---.---> Subject: Re: method overriding (no) overloading on 8/6/01 11:41 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > christian adam hresko wrote: > >> James McCartney wrote: >> >>> on 8/6/01 10:37 AM, christian adam hresko at godpup@ix.netcom.com wrote: >>> >>>> ummmm... C++ allows method overrides within the same class. >>> >>> That is overloading, not overriding. >>> >> >> whoopsie. sorry about that. overloading. >> >> does SC allow for method overloading? (man, i get another F on that one) >> > > more specifically, method overloading within the same class. > C++ allows overloading based on the static types of the arguments. In SuperCollider there are no static types. Dispatching based on the dynamic type of multiple arguments would make it a multiple argument dispatch language like Dylan, Cecil, CLOS. It is not that. But as I said I have thought about it several times. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Aug 2001 13:25:38 -0400 From: christian adam hresko <---@---.---> Subject: Re: method overriding (no) overloading James McCartney wrote: > on 8/6/01 11:41 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > > > > > christian adam hresko wrote: > > > >> James McCartney wrote: > >> > >>> on 8/6/01 10:37 AM, christian adam hresko at godpup@ix.netcom.com wrote: > >>> > >>>> ummmm... C++ allows method overrides within the same class. > >>> > >>> That is overloading, not overriding. > >>> > >> > >> whoopsie. sorry about that. overloading. > >> > >> does SC allow for method overloading? (man, i get another F on that one) > >> > > > > more specifically, method overloading within the same class. > > > > C++ allows overloading based on the static types of the arguments. > In SuperCollider there are no static types. > > Dispatching based on the dynamic type of multiple arguments would make it a > multiple argument dispatch language like Dylan, Cecil, CLOS. It is not that. > But as I said I have thought about it several times. > ahh... this goes back to the question posed by aka felix/crucial/etc. i suppose if it gets as bad is seems, implementation wise, it's not worth it. i can just rename my methods. i forgot to take into account that SC is a 'typeless' language and this would make method overloading nil since method overloading is type dependent. (i believe that sentence makes sense...) Object human, christian ------------------------------ Date: Mon, 06 Aug 2001 10:51:18 -0700 From: cramakrishnan@acm.org Subject: Re: method overriding (no) overloading christian adam hresko writes: > i can just rename my methods. i forgot to take into account that SC is a > 'typeless' language and this would make method overloading nil since method > overloading is type dependent. (i believe that sentence makes sense...) Not exactly. SuperCollider isn't typeless -- it is dynamically (as opposed to statically typed). This is a separate concern from what you are trying to do. CLOS isn't statically typed either, yet it has multi-methods. - - sekhar - -- C. Ramakrishnan cramakrishnan@acm.org ------------------------------ Date: Mon, 06 Aug 2001 13:04:46 -0500 From: James McCartney <---@---.---> Subject: Re: method overriding (no) overloading on 8/6/01 12:51 PM, cramakrishnan@acm.org at cramakrishnan@acm.org wrote: > Not exactly. SuperCollider isn't typeless -- it is dynamically (as > opposed to statically typed). Yup. The only typeless language I know of other than assembler is FORTH. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Aug 2001 14:33:52 -0400 From: christian adam hresko <---@---.---> Subject: Re: method overriding (no) overloading James McCartney wrote: > on 8/6/01 12:51 PM, cramakrishnan@acm.org at cramakrishnan@acm.org wrote: > > > Not exactly. SuperCollider isn't typeless -- it is dynamically (as > > opposed to statically typed). > > Yup. The only typeless language I know of other than assembler is FORTH. > so i suppose that the following (if implemented) would in no way make the process of static types easier to incorporate in SC: #define int arg1, arg2, arg3; the #define would be recognized by the lexical analyzer, and this could activate some mechanism 'under the hood' in SC. i was just thinking about this since you would use a # to define literals (and in many cases 'static' arrays) in SC and therefore you wouldn't have to add another lexeme. i'm just thinking out loud... cheers, christian ------------------------------ Date: Mon, 06 Aug 2001 13:51:54 -0500 From: James McCartney <---@---.---> Subject: Re: method overriding (no) overloading on 8/6/01 1:33 PM, christian adam hresko at godpup@ix.netcom.com wrote: > so i suppose that the following (if implemented) would in no way make the > process of static types easier to incorporate in SC: I'm not going to add static types. You can forget it. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 06 Aug 2001 17:40:03 -0400 From: christian adam hresko <---@---.---> Subject: Re: method overriding (no) overloading James McCartney wrote: > on 8/6/01 1:33 PM, christian adam hresko at godpup@ix.netcom.com wrote: > > > so i suppose that the following (if implemented) would in no way make the > > process of static types easier to incorporate in SC: > > I'm not going to add static types. You can forget it. > okay, it's forgotten. my friends and family warned me about those static types... cheers, christian ------------------------------ Date: Mon, 06 Aug 2001 19:26:59 -0500 From: James McCartney <---@---.---> Subject: patch SC 2.2.11 : ( // hocketuplets var major, root; root = 61 + 4.rand2; major = #[0, 2, 4, 5, 7, 9, 11]; Synth.play({ z = OverlapTexture.ar({ var f, r, offset, sequence, trig; offset = 16.rand2; if (offset < 7, { r = #[1,2,3].choose; },{ r = #[1,2,3,4,6].choose; }); sequence = ((#[0, 3, 4, 6] + offset).scramble.degreeToKey(major) + root).midicps; trig = Impulse.kr(r,3); f = Sequencer.kr(`sequence, trig); Pan2.ar( LPF.ar(Pulse.ar(f, rrand(0.1,0.9), Decay2.kr(trig, 0.004, 2/r, 0.1)), rrand(1000,10000)), 1.0.rand2 ); }, 8, 4, 6, 2); 6.do({ z = AllpassN.ar(z, 0.040, [0.040.rand,0.040.rand], 4) }); z }); ) - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Mon, 6 Aug 2001 21:07:46 -0400 (EDT) From: Paul Lansky <---@---.---> Subject: aliases Hello How do you get aliases recognized in path names? Doesn't seem to work for me. thanks paul lansky ------------------------------ Date: Mon, 06 Aug 2001 20:24:18 -0500 From: James McCartney <---@---.---> Subject: Re: aliases on 8/6/01 8:07 PM, Paul Lansky at paul@silvertone.Princeton.EDU wrote: > Hello > How do you get aliases recognized in path names? Doesn't seem to work for me. > thanks > paul lansky The fopen call in the Metrowerks Standard Library, which File uses to open files, does not work with aliases. This is also a problem in OSX where the unix standard library does not understand Mac aliases, since they look like files to unix, and are not the same as symbolic links. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 02:43:25 +0100 From: sefourefugees <---@---.---> Subject: Re: patch on 7/8/01 1:26 am GMT, James McCartney at asynth@io.com apparently typed: > > SC 2.2.11 : > > ( > // hocketuplets > var major, root; > root = 61 + 4.rand2; > major = #[0, 2, 4, 5, 7, 9, 11]; > Synth.play({ > z = OverlapTexture.ar({ > var f, r, offset, sequence, trig; > > offset = 16.rand2; > if (offset < 7, { > r = #[1,2,3].choose; > },{ > r = #[1,2,3,4,6].choose; > }); > sequence = ((#[0, 3, 4, 6] + offset).scramble.degreeToKey(major) + > root).midicps; > trig = Impulse.kr(r,3); > > f = Sequencer.kr(`sequence, trig); > Pan2.ar( > LPF.ar(Pulse.ar(f, rrand(0.1,0.9), Decay2.kr(trig, 0.004, 2/r, > 0.1)), > rrand(1000,10000)), > 1.0.rand2 > ); > }, 8, 4, 6, 2); > 6.do({ > z = AllpassN.ar(z, 0.040, [0.040.rand,0.040.rand], 4) > }); > z > }); > ) > > > --- james mccartney james@audiosynth.com > SuperCollider - a real time synthesis programming language for the PowerMac. > > > JMC reminds me of JSB. BTW this is a compliment. - -- LUThER ------------------------------ Date: Tue, 07 Aug 2001 00:08:35 -0400 From: christian adam hresko <---@---.---> Subject: SC 101 i just don't get this. why is the following giving me an error: BinSeaTree { var tree, head, tail, first, last; tree = first = last = nil; ... ... ... } and why is the following giving me an error: BinSeaTree { ... ... ... head = BinSeaTreeNode.new(nil); ... ... ... } where BinSeaTreeNode is almost identical to the LinkedList node. cheers, christian ------------------------------ Date: Tue, 07 Aug 2001 01:30:05 -0400 From: christian adam hresko <---@---.---> Subject: Re: SC 101 christian adam hresko wrote: > i just don't get this. why is the following giving me an error: > > BinSeaTree { > var tree, head, tail, first, last; > > tree = first = last = nil; okay, i realize this is just me being goofy. all of these are already set to nil. but why does: tree = first = last; also give me an error? and why can't i use my instance variables inside of class method calls? i keep getting var tree not defined or var head not defined, etc, etc... i'm guessing this has something to do with scope? i thought every method had access to instance variables. cheers, christian > > > ... > ... > ... > } > > and why is the following giving me an error: > > BinSeaTree { > > ... > ... > ... > > head = BinSeaTreeNode.new(nil); > > ... > ... > ... > } > > where BinSeaTreeNode is almost identical to the LinkedList node. > > cheers, > > christian ------------------------------ Date: Tue, 07 Aug 2001 02:24:27 -0400 From: christian adam hresko <---@---.---> Subject: expression help i'm just not having a good time with this. how would the following expression be correctly written in SC: cur.prev.next = cur; prev and next are 'pointers.' cur is a node. the .next is not understood. an neither am i. hehe... cheers, christian ------------------------------ Date: Tue, 07 Aug 2001 06:04:18 -0500 From: James McCartney <---@---.---> Subject: Re: SC 101 on 8/6/01 11:08 PM, christian adam hresko at godpup@ix.netcom.com wrote: > i just don't get this. why is the following giving me an error: > > > BinSeaTree { > var tree, head, tail, first, last; > > tree = first = last = nil; In C++ : class BinSeaTree { int tree, head, tail, first, last; tree = first = last = 0; }; Try to compile that.. Why doesn't it compile? - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 06:09:54 -0500 From: James McCartney <---@---.---> Subject: Re: expression help on 8/7/01 1:24 AM, christian adam hresko at godpup@ix.netcom.com wrote: > cur.prev.next = cur; > > prev and next are 'pointers.' cur is a node. > > the .next is not understood. Actually it must be saying that next_ is not understood. Your object does not have a setter method for next. a.b = c; is equivalent to a.b_(c); The following works because (in 2.2.11) LinkedListNode has a next_ method. x = LinkedListNode(123); y = LinkedListNode(456); x.prev = y; x.prev.next = x; x.dump; y.dump; - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 06:13:39 -0500 From: James McCartney <---@---.---> Subject: Re: SC 101 on 8/7/01 12:30 AM, christian adam hresko at godpup@ix.netcom.com wrote: > and why can't i use my instance variables inside of class method calls? > i keep getting var tree not defined or var head not defined, etc, etc... For the same reason you can't in C++ . Try to compile this : class Link { int prev, next; static void classMethod() { prev = 0; next = 0; } }; - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 11:51:08 -0400 From: christian adam hresko <---@---.---> Subject: Re: SC 101 James McCartney wrote: > on 8/6/01 11:08 PM, christian adam hresko at godpup@ix.netcom.com wrote: > > > i just don't get this. why is the following giving me an error: > > > > > > BinSeaTree { > > var tree, head, tail, first, last; > > > > tree = first = last = nil; > > In C++ : > > class BinSeaTree { > int tree, head, tail, first, last; > tree = first = last = 0; > }; > > Try to compile that.. Why doesn't it compile? you'd probably do something like: BinSeaTree::BinSeaTree() { tree = first = last = 0; } you can't initialize data members in the class interface. (unless you used a default constructor and tree, first and last were constructor arguments...) which answers my question. thank you. cheers, christian ------------------------------ Date: Tue, 07 Aug 2001 12:00:51 -0400 From: christian adam hresko <---@---.---> Subject: Re: SC 101 James McCartney wrote: > on 8/7/01 12:30 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > and why can't i use my instance variables inside of class method calls? > > i keep getting var tree not defined or var head not defined, etc, etc... > > For the same reason you can't in C++ . > Try to compile this : > > class Link { > int prev, next; > > static void classMethod() { > prev = 0; > next = 0; > } > }; > well you can't use non-static data members with a static member function. so in SC there's a similar relationship? thanks again. cheers, christian ------------------------------ Date: Tue, 07 Aug 2001 12:06:11 -0400 From: christian adam hresko <---@---.---> Subject: Re: expression help James McCartney wrote: > on 8/7/01 1:24 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > cur.prev.next = cur; > > > > prev and next are 'pointers.' cur is a node. > > > > the .next is not understood. > > Actually it must be saying that next_ is not understood. > Your object does not have a setter method for next. > > a.b = c; is equivalent to a.b_(c); > > The following works because (in 2.2.11) LinkedListNode has a next_ method. > > x = LinkedListNode(123); > y = LinkedListNode(456); > > x.prev = y; > x.prev.next = x; > > x.dump; > y.dump; > i have prev and next declared as: var ... <> prev, <> next; i thought this allowed you to set or get without having to define the setter or getter methods unless you wanted them to do something other than prev = something or next = something, etc, etc...? cheers, christian ------------------------------ Date: Tue, 07 Aug 2001 11:16:10 -0500 From: James McCartney <---@---.---> Subject: Re: expression help on 8/7/01 11:06 AM, christian adam hresko at godpup@ix.netcom.com wrote: > i have prev and next declared as: > > var ... <> prev, <> next; > Then it should work. As it does work in LinkedListNode. You are doing something wrong. Post the code. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 11:19:44 -0500 From: James McCartney <---@---.---> Subject: Re: SC 101 on 8/7/01 11:00 AM, christian adam hresko at godpup@ix.netcom.com wrote: > well you can't use non-static data members with a static member function. > > so in SC there's a similar relationship? Yes, and there is a good reason you can't access them: There is no instance in a class method. 'this' in a class method refers to the class, not an instance of the class. - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 13:08:28 -0400 From: "crucial" <---@---.---> Subject: SD2 24 big ? Synth.write using: SD2 '24 big endian signed' "unsupported output style/size for SD2 header" the file gets written as 16 big SD2, a crunched time stretched slab of grit. gee, i think i'll put out 6 albums of this noise, all with identical grafix and titles. AIFF '24 big endian signed' no message. the file gets written as 24 big endian signed. a bit more musical this time, but still a squall of high end, reminiscent perhaps of mid to late 90s hardcore. the track is discernable, there's lots of breakup, and the end is a total wash. the same object wrote itself as 32 bit Sun with no problems. am i doing the header right ? _____(( http://crucial-systems.com _________________))_______ ------------------------------ Date: Tue, 07 Aug 2001 15:19:36 -0400 From: christian adam hresko <---@---.---> Subject: Re: expression help James McCartney wrote: > on 8/7/01 11:06 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > i have prev and next declared as: > > > > var ... <> prev, <> next; > > > > Then it should work. As it does work in LinkedListNode. > You are doing something wrong. Post the code. > okay, here's the offending method(s). mind you, this is a work in progress. in the original C++ implementation, the nodes were passed by reference. therefore, the parent node's left or right pointer (depending on which arguments were passed to the recursive function) implicitly pointed to the new node. (a one liner which looked like: cur = new node;) i haven't fixed this yet in SC. i'm just trying to get the groundwork finished. and yes, it needs to be refactored, so please don't cringe too much... //Binary Search Tree AND Doubly Linked List Class BinSeaTreeNode { var <>left, <>right, <>prev, <>next, <>obj, <>count; *new { arg item; ^super.new.obj_(item) } } BinSeaTree : Sequenceable Collection { var tree, head, tail, first, last; /* *new { tree = first = last = nil; head = BinSeaTreeNode.new(nil); tail = BinSeaTreeNode.new(nil); head.prev = tail.next = nil; head.next = tail; tail.prev = head; } */ search { arg key; this.searchBST(tree, key); } insert { arg key; this.insertBST(tree, key); } //other methods not yet implemented so i'll get straight to the point //PRIVATE searchBST { arg cur, key; if (cur.isNil, { ^nil; },{ if (key == cur.obj, { ^cur.obj; },{ if (key < cur.obj, { this.searchBST(cur.left, key); },{ if (key > cur.obj, { this.searchBST(cur.right, key); },{ })})})}); } insertBST { arg cur, key; if (cur.isNil, { cur = BinSeaTreeNode.new(key); cur.left = cur.right = nil; cur.count = 0; if (first.isNil && last.isNil, { first = last = cur; cur.prev = head; cur.next = tail; cur.prev.next = cur; cur.next.prev = cur; },{ if (tail.prev == first, { last = cur; cur.prev = first; cur.next = tail; cur.prev.next = cur; cur.next.prev = cur; },{ //this can be incorporated into the //if statement above... later cur.prev = last; cur.next = tail; cur.prev.next = cur; cur.next.prev = cur; last = cur; })}); if (key < cur.obj, { this.insertBST(cur.left, key); },{ if (key > cur.obj, { this.insertBST(cur.right, key); },{ ^nil; })})}); cur.count = cur.count + 1; } there you go. lots of fixing to do, but the cur.prev.next is not working... cheers, christian ------------------------------ Date: Tue, 07 Aug 2001 14:33:39 -0500 From: James McCartney <---@---.---> Subject: Re: expression help on 8/7/01 2:19 PM, christian adam hresko at godpup@ix.netcom.com wrote: > there you go. lots of fixing to do, but the cur.prev.next is not working... Can you show me the complete error message? What is the object that does not understand next. Is it nil perhaps? In otherwords cur.prev is uninitialized..? - --- james mccartney james@audiosynth.com SuperCollider - a real time synthesis programming language for the PowerMac. ------------------------------ Date: Tue, 07 Aug 2001 16:11:27 -0400 From: christian adam hresko <---@---.---> Subject: Re: expression help James McCartney wrote: > on 8/7/01 2:19 PM, christian adam hresko at godpup@ix.netcom.com wrote: > > > there you go. lots of fixing to do, but the cur.prev.next is not working... > > Can you show me the complete error message? > What is the object that does not understand next. Is it nil perhaps? > In otherwords cur.prev is uninitialized..? > here's the code: var bTree; bTree = BinSeaTree.new; bTree.insert(6); ERROR: Message 'next_' not understood. RECEIVER: nil ARGS: Instance of Array { (1C5FFC10, gc=02, fmt=01, flg=00, set=00) Indexed slots [1] 0 : Instance of BinSeaTreeNode (1C5FFBB0, size=0, set=03) } CALL STACK: Object::doesNotUnderstand arg this = nil arg selector = 'next_' arg args = [*1] BinSeaTree::insertBST arg this = arg cur = arg key = 6 BinSeaTree::insert arg this = arg key = 6 < FunctionDef in Method Interpreter::functionCompileContext > var bTree = Interpreter::interpret arg this = arg string = "var bTree; bTree = BinSeaTre..." Interpreter::interpretCmdLine arg this = Process::InterpretCmdLine arg this = i think it's the nil that you mentioned. i'm not sure why i'm having such a difficult time going from C++ to Smalltalk. i always considered myself kinda 'flexible.' thanks for your help. cheers, christian ------------------------------ Date: Wed, 08 Aug 2001 01:32:58 -0400 From: christian adam hresko <---@---.---> Subject: Re: SC 101 James McCartney wrote: > on 8/7/01 11:00 AM, christian adam hresko at godpup@ix.netcom.com wrote: > > > well you can't use non-static data members with a static member function. > > > > so in SC there's a similar relationship? > > Yes, and there is a good reason you can't access them: > There is no instance in a class method. > 'this' in a class method refers to the class, not an instance of the class. > sorry if this has been answered, and i just didn't catch on. how are you able to use the instance variables head, tail, and size within you class methods then? (in the LinkedList Class) and why is: var tree = 1, head = 1, tail = 1, first = 1, last = 1; valid? i would never want these intialized to 1, but it's just an example. trying to do this inside a class method fails. is the var tree = 1, head = 1, etc, etc... similar to: class Goof { public: Goof(); private: int der; int duh; int huh; }; Goof::Goof() :der(1), duh(2), huh(3) { //test cout << der << duh << huh << endl; } it's gonna click soon, i swear. cheers, christian ------------------------------ End of sc-users-digest V1 #340 ******************************