[CM] rotation-pattern
Rick Taube
taube@uiuc.edu
Tue, 30 Sep 2003 13:32:09 -0500
>is it possible to get the following with a rotation-pattern?
offhand i dont think so -- it looks like what yhou want is some sort of
"double" rotation, ie your pattern is as if the default rotation
happened twice per periond instead of once.
You could do it easily enough as a funcall pattern:
(define (double-shift l)
(new funcall :of
#'(lambda ()
(let ((val l))
(set! l (append (cddr l)
(list (first l)
(second l))))
val))))
(define x (double-shift '(a b c d e)))
(next x 25)
(A B C D E
C D E A B
E A B C D
B C D E A
D E A B C)