Programming

(Common Lisp) 숫자를 영어로 표시하기

steloflute 2021. 3. 25. 11:21

~r을 쓰면 된다.

 

* (dotimes (i 30) (format t "~4d ~r~%" i i))
   0 zero
   1 one
   2 two
   3 three
   4 four
   5 five
   6 six
   7 seven
   8 eight
   9 nine
  10 ten
  11 eleven
  12 twelve
  13 thirteen
  14 fourteen
  15 fifteen
  16 sixteen
  17 seventeen
  18 eighteen
  19 nineteen
  20 twenty
  21 twenty-one
  22 twenty-two
  23 twenty-three
  24 twenty-four
  25 twenty-five
  26 twenty-six
  27 twenty-seven
  28 twenty-eight
  29 twenty-nine
NIL

 

A Few FORMAT Recipes (gigamonkeys.com)

 

 

A Few FORMAT Recipes

Common Lisp's FORMAT function is--along with the extended LOOP macro--one of the two Common Lisp features that inspires a strong emotional response in a lot of Common Lisp users. Some love it; others hate it.1 FORMAT's fans love it for its great power and

www.gigamonkeys.com