RosettaCodeData/Task/Nth/Common-Lisp/nth-2.lisp

3 lines
115 B
Common Lisp
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
(defun add-suffix (n)
(format nil "~d'~:[~[th~;st~;nd~;rd~:;th~]~;th~]" n (< (mod (- n 10) 100) 10) (mod n 10)))