[CM] algorithm woes
Rick Taube
taube@uiuc.edu
Mon, 23 Dec 2002 05:24:43 -0600
>Apologies if this is a repost. Also, apologies
>for the formatting - the properly formatted version
>is at :
> http://stripe.colorado.edu/~theodorm/algo.html
>
you might consider using the :name feature to reference specific subpatterns
in the pattern. im sorry i dont have time to get it all thought out for you
right now, but something like what i have below may work, at any rate it seems to be using much less code than what you currently have.
this is in 2.4.0, but there is an equivanent nameing feature in 1.3:
(new cycle name 'a of 1 for 1)
(new cycle name 'b of (list #!a 2) for 1)
(new cycle name 'c of (list #!b 3) for 1)
(new cycle name 'd of '4a for 1)
(new cycle name 'e of (list #!c #!d) for 1)
(setf x
(new cycle of (list (new cycle of #!a for 9)
(new cycle of #!b for 18)
(new cycle of #!c for 18)
(new cycle of #!e for 18)
)))
(next x t)
(1 1 1 1 1 1 1 1 1
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
1 3 2 3 1 3 2 3 1 3 2 3 1 3 2 3 1 3
2 4A 3 4A 1 4A 3 4A 2 4A 3 4A 1 4A 3 4A 2 4A)
the other approach would be to write a function that does the
interleaving for you. you can put that function in a 'function'
item stream if you need the series to be generated inside a
pattern.