[ prog / sol / mona ]

prog


The Forced Indentation Of Code

261 2023-06-22 12:42
scheme@(guile-user)> (display ((lambda (rec xjoin extract windowtopleft expandspec derive expandsize cell index connector connectors cellspec cellrows cellcols expansions expandx expandy levels start chars band columnfactor n) ((lambda (xjoin expandspec connector lines columns cycle size) ((lambda (cellspec expansions sizex sizey) ((lambda (derive cell) ((lambda (derive) ((lambda (derivecell) ((lambda (window) ((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 (window x y) dx dy) 1 0)))) (windowtopleft sizex sizey derivecell))) (lambda (y x) ((lambda (qx mx qy my) (cell (derive qx qy) mx my)) (quotient x cellcols) (modulo x cellcols) (quotient y cellrows) (modulo y cellrows))))) ((lambda (sizex sizey) (lambda (x y) (rec derive start x y sizex sizey))) (quotient sizex cellcols) (quotient sizey cellrows)))) (derive expansions expandx expandy) (cell cellspec cellcols))) (expandspec cellspec) (expandspec expansions) (car size) (cadr size))) (lambda (n fun sep) (rec xjoin n fun sep "")) (lambda (spec) (rec expandspec spec '())) (connector connectors band) (+ (* 2 n) 1) (+ (* 2 columnfactor n) 1) (string-length chars) (expandsize cellcols cellrows expandx expandy levels))) (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 (width height fun) ((lambda (w2 h2) ((lambda (x1 x2 y1 y2) (lambda (x y) (if (and (<= x1 x x2) (<= y1 y y2)) (fun (- y y1) (- x x1)) 0))) (- w2) (- width w2 1) (- h2) (- height h2 1))) (quotient width 2) (quotient height 2))) ((lambda (onecorner) ((lambda (onecell) (lambda (self spec acc) (if (null? spec) (apply vector acc) (self self (cdr spec) (onecell onecell (car spec) acc 3))))) (lambda (self cell acc round) (if (< round 0) acc (self self cell (cons (onecorner onecorner cell '() round #t) acc) (- round 1)))))) (lambda (self corners acc bits fresh) (if (null? corners) (apply vector acc) (if (caar corners) (self self (cdr corners) (cons ((if (logbit? (if fresh 0 1) bits) caddar cadar) corners) acc) bits #f) (self self (cdr corners) (cons (cadar corners) acc) bits fresh)))))
262 2023-06-22 12:45
(lambda (spec expandx expandy) (lambda (self var x y sizex sizey) (if (= sizex 1) var ((lambda (subx suby) ((lambda (qx mx qy my) (self self (vector-ref (vector-ref spec var) (+ (* qy expandx) qx)) mx my subx suby)) (quotient x subx) (modulo x subx) (quotient y suby) (modulo y suby))) (quotient sizex expandx) (quotient sizey expandy))))) ((lambda (size) (lambda (cellx celly expandx expandy levels) (list (size cellx expandx levels) (size celly expandy levels)))) (lambda (start expand levels) (* start (expt expand levels)))) (lambda (spec columns) (lambda (index dx dy) (vector-ref (vector-ref spec index) (+ (* dy columns) dx)))) (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)))) (and (= dx dy) (or (on 6 bits) (and (< dx b2) (on 7 bits)) (and (> dx b2) (on 8 bits)))) (and (= (+ dx dy) band) (or (on 9 bits) (and (< dx b2) (on 10 bits)) (and (> dx b2) (on 11 bits)))))) (vector-ref spec index))))) (quotient band 2) logbit?)) #(#f 1 8 36 34 20 18 33 17 10 12 64 512 132 1028 2050 258 160 2080 1040 272 2304 1152 1280 2176) '(((#t 1 4) (#f 5) (#t 1 6) (#f 3)) ((#t 5 2) (#t 6 2) (#f 4) (#f 3)) ((#f 6) (#t 1 3) (#f 4) (#t 1 5)) ((#f 6) (#f 5) (#t 3 2) (#t 4 2))) 2 2 '(((#t 8 9) (#f 14) (#t 0 1) (#f 13)) ((#t 14 15) (#t 6 7) (#f 9) (#f 10)) ((#f 6) (#t 8 10) (#f 5) (#t 0 2)) ((#f 1) (#f 2) (#t 13 15) (#t 5 7))) 2 2 1 8 "🌵🌹🌺🌼🌸🌻🌷💮🦋" 6 1 10))
267


VIP:

do not edit these