Generic Lisp provides an excellent ~ r directive for printing cardinal English numbers. For instance:
(format nil "~r" 27) -> "twenty-seven"
Does Lisp provide a directive (or some library function) that does the opposite, from cardinal English numbers to integer values? I am using Allegro CL on a windows machine.
EDIT: I am looking for this type of function in a cleaner way:
(defconstant +cardinal-number-map+
(loop for number from 0 to 100
collect (cons (format nil "~r" number) number)))
(defun cardinal->int (cardinal)
(cdr (assoc cardinal +cardinal-number-map+ :test
source
share