Programming Challenge Numbers to Text?

Jonathan Duncan jonathan at jkdwebmagic.com
Fri May 5 13:33:30 MDT 2006


On Fri, 5 May 2006, 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
>
>
> (The "~%" format directive is similar to "\n".)
>
> :-)
> Chris
>
>

Wow, we found a use for LISP!  Actually, that is cool.

Jonathan


More information about the PLUG mailing list