Henning Thielemann wrote: > On Tue, 8 Nov 2011, Heinrich Apfelmus wrote: > >> How do you make sure that a new sequence starts on the beat / interleave >> nicely with what is still playing? > > The trick is to update the program but not the currently processed term. > Thus the same term can get a new meaning. The advantage is that I can > break a loop and redirect it to somewhere else, e.g. by changing > >> loop1 = append melody loop1 ; > > to > >> loop1 = append melody loop2 ; > > but the melody keeps running and is not interrupted. The disadvantage is > that I cannot break a call to "cycle" and that after program change, the > current term may refer to functions that are no longer defined.
Nice! And that's also why you've implemented a custom functional language? I do wonder about the precise semantics of changing expressions in-flight, though. For instance, imagine that the program is performing a time-consuming computation that does not (yet) produce any sound, what will happen if I update the term that is being evaluated? Or will updates only take effect at certain "checkpoints", namely whenever a new MIDI note is created and passed to the synthesizer? How do you detect which terms have changed and which haven't? Do you have any formal model of how exactly this works? With a formal model, it might be possible to concoct an implementation that can embed the DSL into Haskell. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com _______________________________________________ haskell-art mailing list haskell-art@lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art