Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
@(do (defun inc-num-str (str-in)
|
||||
(let ((len (length str-in))
|
||||
(str (copy-str str-in)))
|
||||
(for ((i (- len 1)))
|
||||
((>= i 0) `1@str`)
|
||||
((dec i))
|
||||
(if (<= (inc [str i]) #\9)
|
||||
(return str)
|
||||
(set [str i] #\0))))))
|
||||
@(bind a @(inc-num-str "9999"))
|
||||
@(bind b @(inc-num-str "1234"))
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@(deffilter incdig ("0" "1") ("1" "2") ("2" "3") ("3" "4") ("4" "5")
|
||||
("5" "6") ("6" "7") ("7" "8") ("8" "9"))
|
||||
@(define increment (num out))
|
||||
@ (local prefix dig junk)
|
||||
@ (next :string num)
|
||||
@ (cases)
|
||||
9
|
||||
@ (bind out "10")
|
||||
@ (or)
|
||||
@*{prefix}@{dig /[0-8]/}
|
||||
@ (bind out `@prefix@{dig :filter incdig}`)
|
||||
@ (or)
|
||||
@*{prefix}9
|
||||
@ (bind out `@{prefix :filter (:fun increment)}0`)
|
||||
@ (or)
|
||||
@junk
|
||||
@ (throw error `bad input: @junk`)
|
||||
@ (end)
|
||||
@(end)
|
||||
@in
|
||||
@(increment in out)
|
||||
Loading…
Add table
Add a link
Reference in a new issue