[ prog / sol / mona ]

prog


The Forced Indentation Of Code

72 2022-04-21 10:06

upgrade of >>70 that tracks one level up the derivation tree and hands that information to a painter

scheme@(guile-user)> (display ((lambda (rec xjoin index symbol size chars cell start level) ((lambda (xjoin lines columns) ((lambda (index expand) ((lambda (chars) ((lambda (symbol) (xjoin lines (lambda (k) (string-append (xjoin columns (lambda (j) (symbol k j)) "") "\n")) "")) (lambda (k j) (apply symbol cell chars (index k j))))) (expand chars (* 2 cell)))) (lambda (k j) (rec index k j lines columns start 0 (not start))) (lambda (chars n) (xjoin (* n (string-length chars)) (lambda (x) ((lambda (idx) (substring chars idx (+ 1 idx))) (quotient x n))) "")))) (lambda (n fun sep) (rec xjoin n fun sep "")) (size level start #t) (size level start #f))) (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 (self k j lin col hv uppos uphv) (if hv (if (= lin 1) `(,j #t ,uppos ,uphv) ((lambda (c4) ((lambda (jd jm) (if (or (= jd 0) (= jd 3)) (self self k jm lin c4 #f (if (= jd 0) 0 1) #t) ((lambda (l2) (self self (modulo k l2) (- j c4) l2 (ash c4 1) #t (quotient k l2) #t)) (ash lin -1)))) (quotient j c4) (modulo j c4))) (ash col -2))) (if (= col 1) `(,k #f ,uppos ,uphv) ((lambda (l4) ((lambda (kd km) (if (or (= kd 0) (= kd 3)) (self self km j l4 col #t (if (= kd 0) 0 1) #f) ((lambda (c2) (self self (- k l4) (modulo j c2) (ash l4 1) c2 #f (quotient j c2) #f)) (ash col -1)))) (quotient k l4) (modulo k l4))) (ash lin -2))))) (lambda (cell chars pos hv uppos uphv) ((lambda (idx) (substring chars idx (+ idx cell))) (* cell (+ pos (* 2 uppos) (if (eq? hv uphv) 4 0))))) (lambda (level horver lincol) (ash (if (eq? horver lincol) 1 2) level)) "█░▓▒" 2 #t 4))

separate output for 413

level 6: http://paste.textboard.org/0a1dc9e6/raw

267


VIP:

do not edit these