diff --git a/extra/math/text/english/english-docs.factor b/extra/math/text/english/english-docs.factor index a7fdc421aa..5bd24c3e98 100644 --- a/extra/math/text/english/english-docs.factor +++ b/extra/math/text/english/english-docs.factor @@ -4,4 +4,4 @@ IN: math.text.english HELP: number>text { $values { "n" integer } { "str" string } } { $description "Converts an integer to a text string representation in English, including appropriate punctuation and conjunctions." } -{ $examples { $example "USING: math.text.english prettyprint ;" "12345 number>text ." "\"Twelve Thousand, Three Hundred and Forty-Five\"" } } ; +{ $examples { $example "USING: math.text.english prettyprint ;" "12345 number>text ." "\"twelve thousand, three hundred and forty-five\"" } } ; diff --git a/extra/math/text/english/english-tests.factor b/extra/math/text/english/english-tests.factor index 8f8932c97d..81a94687a7 100644 --- a/extra/math/text/english/english-tests.factor +++ b/extra/math/text/english/english-tests.factor @@ -1,15 +1,15 @@ USING: math.functions math.text.english tools.test ; IN: math.text.english.tests -[ "Zero" ] [ 0 number>text ] unit-test -[ "Twenty-One" ] [ 21 number>text ] unit-test -[ "One Hundred" ] [ 100 number>text ] unit-test -[ "One Hundred and One" ] [ 101 number>text ] unit-test -[ "One Thousand and One" ] [ 1001 number>text ] unit-test -[ "One Thousand, One Hundred and One" ] [ 1101 number>text ] unit-test -[ "One Million, One Thousand and One" ] [ 1001001 number>text ] unit-test -[ "One Million, One Thousand, One Hundred and One" ] [ 1001101 number>text ] unit-test -[ "One Million, One Hundred and Eleven Thousand, One Hundred and Eleven" ] [ 1111111 number>text ] unit-test -[ "One Duotrigintillion" ] [ 10 99 ^ number>text ] unit-test +[ "zero" ] [ 0 number>text ] unit-test +[ "twenty-one" ] [ 21 number>text ] unit-test +[ "one hundred" ] [ 100 number>text ] unit-test +[ "one hundred and one" ] [ 101 number>text ] unit-test +[ "one thousand and one" ] [ 1001 number>text ] unit-test +[ "one thousand, one hundred and one" ] [ 1101 number>text ] unit-test +[ "one million, one thousand and one" ] [ 1001001 number>text ] unit-test +[ "one million, one thousand, one hundred and one" ] [ 1001101 number>text ] unit-test +[ "one million, one hundred and eleven thousand, one hundred and eleven" ] [ 1111111 number>text ] unit-test +[ "one duotrigintillion" ] [ 10 99 ^ number>text ] unit-test -[ "Negative One Hundred and Twenty-Three" ] [ -123 number>text ] unit-test +[ "negative one hundred and twenty-three" ] [ -123 number>text ] unit-test diff --git a/extra/math/text/english/english.factor b/extra/math/text/english/english.factor index 5a10e7af37..492453450b 100755 --- a/extra/math/text/english/english.factor +++ b/extra/math/text/english/english.factor @@ -7,35 +7,44 @@ IN: math.text.english ] } 1&& and-needed? set ; : negative-text ( n -- str ) - 0 < "Negative " "" ? ; + 0 < "negative " "" ? ; : hundreds-place ( n -- str ) 100 /mod over 0 = [ 2drop "" ] [ - [ small-numbers " Hundred" append ] dip + [ small-numbers " hundred" append ] dip 0 = [ " and " append ] unless ] if ;