[ prog / sol / mona ]

prog


The Forced Indentation Of Code

224 2022-11-12 10:58

Port of >>189 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 (split corner) (lambda (j k) (apply (lambda (k up j left) (if (= j 0) (if (= k 1) 0 1) ((lambda (jd jm) (if (<= jd (- k 3)) 1 (if (or (= jd (- k 2)) (= jd k)) (if (= jm 1) 0 (corner 6 up -2 left -1)) (if (= jd (- k 1)) (if (= jm 1) 1 (corner 3 up 2 left 1)) (if (= jm 1) 0 2))))) (quotient (- j 1) 2) (modulo (- j 1) 2)))) `(,@(split k 1) ,@(split j 0))))) (lambda (k adjust) (if (< k 0) `(,(- k) #t) `(,(+ k adjust) #f))) (lambda (from up upstep left leftstep) (+ from (if up upstep 0) (if left leftstep 0)))) (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 >>223 for renewed 413 >>127

larger version: https://wirechan.org/b/res/2162.html#4389 http://paste.textboard.org/d5e8e090/raw

267


VIP:

do not edit these