Programming Challenge Numbers to Text?

Levi Pearson levi at cold.org
Fri May 5 13:50:03 MDT 2006


On May 5, 2006, at 11:20 AM, plug.org at 2nerds.com wrote:
> If this was a competition, and not merely exhibition, :-) lisp's
> somewhat byzantine "~r" format directive might earn it a shot at
> the prize:
>
> This lisp expression:
>
>   (format t "~r~%~r~%~r~%~r~%~r~%" 1 15 91283 4918239 2147483647)
>
> produces this output:
>
>   one
>   fifteen
>   ninety-one thousand, two hundred and eighty-three
>   four million, nine hundred and eighteen thousand, two hundred and  
> thirty-nine
>   two billion, one hundred and forty-seven million, four hundred  
> and eighty-three thousand, six hundred and forty-seven

Indeed, yet another example of Lisp being awesome. :)

		--Levi



More information about the PLUG mailing list