Here's a rough draft that has tons of room for improvement: #lang racket
(define glider (string->number "#x\ 010000\ 001000\ 111000\ 000000\ 000000\ 000000\ ")) (define (life s) (define (c s n) (if (= -1 n) 0 (+ (if (bitwise-bit-set? 3080 (arithmetic-shift s (* -4 n))) (expt 16 n) 0) (c (modulo s (expt 16 n)) (sub1 n))))) (c (* s #x111000181000111/10000000) 36)) ;; helper functions: run (step) repeatedly to watch (define current glider) (define (show s) (define str1 (format "~x" s)) (define str (string-append (make-string (- 6 (modulo (string-length str1) 6)) #\0) str1)) (for ([i (in-range 0 (string-length str) 6)]) (displayln (substring str i (+ i 6))))) (define (step) (set! current (life current)) (show current)) ____________________ Racket Users list: http://lists.racket-lang.org/users