Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Nth/Common-Lisp/nth-1.lisp
Normal file
8
Task/Nth/Common-Lisp/nth-1.lisp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(defun add-suffix (number)
|
||||
(let* ((suffixes #10("th" "st" "nd" "rd" "th"))
|
||||
(last2 (mod number 100))
|
||||
(last-digit (mod number 10))
|
||||
(suffix (if (< 10 last2 20)
|
||||
"th"
|
||||
(svref suffixes last-digit))))
|
||||
(format nil "~a~a" number suffix)))
|
||||
2
Task/Nth/Common-Lisp/nth-2.lisp
Normal file
2
Task/Nth/Common-Lisp/nth-2.lisp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(defun add-suffix (n)
|
||||
(format nil "~d'~:[~[th~;st~;nd~;rd~:;th~]~;th~]" n (< (mod (- n 10) 100) 10) (mod n 10)))
|
||||
6
Task/Nth/Common-Lisp/nth-3.lisp
Normal file
6
Task/Nth/Common-Lisp/nth-3.lisp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(loop for (low high) in '((0 25) (250 265) (1000 1025))
|
||||
do (progn
|
||||
(format t "~a to ~a: " low high)
|
||||
(loop for n from low to high
|
||||
do (format t "~a " (add-suffix n))
|
||||
finally (terpri))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue