Skip to content

Instantly share code, notes, and snippets.

View ytaki0801's full-sized avatar

TAKIZAWA Yozo ytaki0801

View GitHub Profile
@ko1nksm
ko1nksm / CGoL.sh
Last active February 3, 2023 12:15 — forked from ytaki0801/CGoL.sh
Conway's Game of Life in POSIX Shell
#!/bin/sh
xs=80 ys=35
ORIGIN=$(clear) LF='
'
xorshift32=$(date +%s)
xorshift32() {
set -- "$1" "$xorshift32"
set -- "$1" $(( $2 ^ (($2 << 13) & 0xFFFFFFFF) ))
(define (filter pred xs)
(define (skip xs)
(cond [(null? xs) xs]
[(pred (car xs)) xs]
[else (skip (cdr xs))]))
(unfold null?
(^[xs] (car xs))
(^[xs] (skip (cdr xs)))
(skip xs)))