[ prog / sol / mona ]

prog


The Forced Indentation Of Code

229 2022-11-16 13:17

Port of >>190 to the connector flower garden >>208.

scheme@(guile-user)> (display ((lambda (rec xjoin extract cell index connector connectors chars band columnfactor n) ((lambda (xjoin connector 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) (if (connector (cell x y) dx dy) 1 0)))) (lambda (n fun sep) (rec xjoin n fun sep "")) (connector connectors band) (+ (* 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 (base patch) (lambda (j k) ((lambda (j) ((lambda (jev) (or (patch k j jev) (base k j jev))) (even? j))) (if (< j 0) j (+ j 1))))) (lambda (k j jev) (if (= k 0) (if (<= -1 j 1) 1 (if jev 0 2)) ((lambda (corner jabs) (if (< jabs corner) 1 (if (= jabs corner) (+ 3 (if (< k 0) 0 2) (if (< j 0) 0 1)) (if jev 0 2)))) (+ (* 2 (abs k)) 1) (abs j)))) (lambda (k j jev) #f)) (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 (spec band) ((lambda (b2 on) (lambda (index dx dy) (if (zero? index) #f ((lambda (bits) (or (and (= dy b2) (or (= dx b2) (on 0 bits) (and (< dx b2) (on 1 bits)) (and (> dx b2) (on 2 bits)))) (and (= dx b2) (or (on 3 bits) (and (< dy b2) (on 4 bits)) (and (> dy b2) (on 5 bits)))))) (vector-ref spec index))))) (quotient band 2) logbit?)) #(#f 1 8 36 34 20 18 33 17 10 12) "🌵🌹🌺🌼🌸🌻🌷💮🦋" 6 2 9))

separate output >>228 for renewed 413 >>127

larger version: https://wirechan.org/b/res/2162.html#4408 http://paste.textboard.org/7eec6890/raw

267


VIP:

do not edit these