Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Floyds-triangle/TXR/floyds-triangle.txr
Normal file
19
Task/Floyds-triangle/TXR/floyds-triangle.txr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(defun flotri (n)
|
||||
(let* ((last (trunc (* n (+ n 1)) 2))
|
||||
(colw (mapcar [chain tostring length]
|
||||
(range (- last n -1) last)))
|
||||
(x 0))
|
||||
(each ((r (range* 0 n)))
|
||||
(each ((c (range 0 r)))
|
||||
(format t " ~*a" [colw c] (inc x)))
|
||||
(put-line))))
|
||||
|
||||
(defun usage (msg)
|
||||
(put-line `error: @msg`)
|
||||
(put-line `usage:\n@(ldiff *full-args* *args*) <smallish-positive-integer>`)
|
||||
(exit 1))
|
||||
|
||||
(tree-case *args*
|
||||
((num blah . etc) (usage "too many arguments"))
|
||||
((num) (flotri (int-str num)))
|
||||
(() (usage "need an argument")))
|
||||
Loading…
Add table
Add a link
Reference in a new issue