langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,30 @@
@(collect)
@ (coll)@{item /[^$]+/}@(end)
@(end)
@; nc = number of columns
@; pi = padded items (data with row lengths equalized with empty strings)
@; cw = vector of max column widths
@; ce = center padding
@(bind nc @(apply (fun max) (mapcar (fun length) item)))
@(bind pi @(mapcar (lambda (row)
(append row (repeat '("") (- nc (length row)))))
item))
@(bind cw @(vector-list
(mapcar (lambda (column)
(apply (fun max) (mapcar (fun length) column)))
;; matrix transpose trick cols become rows:
(apply (fun mapcar) (cons (fun list) pi)))))
@(bind ns "")
@(output)
@ (repeat)
@ (rep :counter i)@{pi @[cw i]} @(end)
@ (end)
@ (repeat)
@ (rep :counter i)@{pi @(- [cw i])} @(end)
@ (end)
@ (repeat)
@ (rep :counter i)@\
@{ns @(trunc (- [cw i] (length pi)) 2)}@\
@{pi @(- [cw i] (trunc (- [cw i] (length pi)) 2))} @(end)
@ (end)
@(end)