[racket] Challenge: Game of life in 140 chars
> Here's a 136-character version (after unnecessary spaces are removed):
>
> (define (life s)
> (let* ((a bitwise-and)
> (s (bitwise-ior (* s #x111000101000111/10000000) s)))
> (a (* (a (- -1 s) (* s 4)) 3/32)
> (/ (- (expt 8 48) 1) 15))))
>
> -- Jeremiah Willcock
That doesn't work! The glider test breaks after a few generations.
But your concept is better than mine. Here's 132 chars, note the
number shortening trick:
(define(j s)
(let c([n(expt 8 48)])
(+(if(memv(modulo(floor(/(* s #e#x11100018.1000111)n))16)'(3 10 11))n 0)
(if(= n 1)0(c(/ n 16))))))