[ prog / sol / mona ]

prog


The Forced Indentation Of Code

201 2022-10-10 10:07

https://en.wikipedia.org/wiki/Sauwastika The compact swastika can be seen as a chiral irregular icosagon (20-sided polygon) with fourfold (90Β°) rotational symmetry. Such a swastika proportioned on a 5 Γ— 5 square grid and with the broken portions of its legs shortened by one unit can tile the plane by translation alone.

Flower garden port of the left-winding tiles. >>35 >>36

scheme@(guile-user)> (display ((lambda (rec xjoin extract index reduce home moves chars band columnfactor n) ((lambda (xjoin reduce lines columns cycle) ((lambda (patch) ((lambda (symbol) (xjoin lines (lambda (k) (string-append (xjoin columns (lambda (j) (symbol k j)) "") "\n")) "")) (lambda (k j) (extract chars (index patch band cycle columnfactor n k j) 1)))) (lambda (cycle x y dx dy band) (modulo (reduce y x) cycle)))) (lambda (n fun sep) (rec xjoin n fun sep "")) (lambda (k j) (rec reduce home moves k j 0)) (+ (* 2 n) 1) (+ (* 2 columnfactor n) 1) (string-length chars))) (lambda (f . args) (apply f (cons f args))) (lambda (self n fun sep acc) (if (<= n 0) "" (if (= n 1) (string-append (fun 0) acc) (self self (- n 1) fun sep (string-append sep (fun (- n 1)) acc))))) (lambda (str pos len) (substring str pos (+ pos len))) (lambda (patch band cycle columnfactor n k j) ((lambda (k j) ((lambda (dx dy) (if (or (= dx 0) (= dy 0)) 0 (+ (patch (- cycle 1) (quotient (- (+ k j) dx) band) (quotient (- (- k j) dy) band) dx dy band) 1))) (modulo (+ k j) band) (modulo (- k j) band))) (- k n) (- j (* columnfactor n)))) ((lambda (done last move) (lambda (self home moves k j acc) (if (done k j) (+ acc (last home k j)) (apply (lambda (dk dj) (self self home moves (+ k dk) (+ j dj) (+ acc 1))) (vector-ref moves (move k j)))))) (lambda (k j) (and (<= -2 k) (<= k 2) (<= -2 j) (<= j 2))) (lambda (home k j) (if (logbit? (- 2 j) (vector-ref home (+ k 2))) 1 0)) (lambda (k j) (if (zero? k) (if (positive? j) 1 2) (if (zero? j) (if (positive? k) 0 3) (+ (if (positive? k) 0 1) (if (positive? j) 0 2)))))) #(19 26 0 11 25) #((-3 -2) (2 -3) (-2 3) (3 2)) "🌡🌹🌺🌻🌼" 6 2 9))

separate output >>200 for renewed 413 >>127

larger version: https://wirechan.org/b/res/2162.html#4141 http://paste.textboard.org/56d168d3/raw

apply
* { line-height: 1em; }
to the larger version for more symmetry

267


VIP:

do not edit these