[CM] rewrite output in CM

Rick Taube taube@uiuc.edu
Wed, 27 Oct 2004 08:05:54 -0500


sorry for the slow response but Im very busy this week. I think I need 
to allow the period to be specified as T, but of course that means that 
periods may quickly become huge after some number of generations.  I 
also have another rewrite bug in pattern matching to fix. ill try to 
get to them this week when I check some new code into cvs.


On Oct 26, 2004, at 9:24 PM, Drew Krause wrote:

> I just answered my own question, in a somewhat convoluted way... here 
> it is, for anyone interested:
>
> ;; MTRULES -- morse-thue rules
> (define mtrules '((0 -> (0 1))
>                 (1 -> (1 0))))
>
> ;; RW-NEXT -- returns next complete generation of rewrite
> ;; rwthing = rules; alist = input string
> ;; example: (rw-next mtrules '(1 0)) = (1 0 0 1)
> (defun rw-next (rwthing alist)
> (let* ((this-rw (new rewrite of (append rwthing '((rw-end -> rw-end)))
>                      :initially (append alist (list 'rw-end))))
>        (sink (next this-rw (+ (length alist) 1))))
>   (loop for x = (next this-rw) until (eql x 'rw-end) collect x)))
>
> ;; RWGEN -- returns arbitrary generation of rewrite
> ;; (rwgen mtrules '(1 0) 2) =  (1 0 0 1 0 1 1 0)
> (defun rwgen (rwrules initgen gennbr)
> (case gennbr
>   (0 initgen)
>   (1 (rw-next rwrules initgen))
>   (t (rw-next rwrules (rwgen rwrules initgen (- gennbr 1))))))
>
> Drew
>
> Drew Krause wrote:
>
>> I need help with output options for the "rewrite" pattern. As an 
>> example, suppose I create a morse-thue sequence:
>>
>> (define mt (new rewrite of '((0 -> (0 1))
>>                             (1 -> (1 0)))
>>                :initially '(1 0)))
>>
>> How can I get a new complete L-to-R generation on each call, a la:
>>
>> (1 0) ; {we can skip this step if we have to}
>> (1 0 0 1)
>> (1 0 0 1 0 1 1 0)
>> &c.
>>
>> All help much appreciated!
>>
>> Drew
>>
>> _______________________________________________
>> Cmdist mailing list
>> Cmdist@ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>>
>
> _______________________________________________
> Cmdist mailing list
> Cmdist@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist