The adverb `table` has appeared in the forum of late. While looking at the
"common core" description in mathematics I noticed a mention of first
graders benefitting from seeing numerals spelled out. I found the following
jwiki Essay does exactly that.

http://www.jsoftware.com/jwiki/Essays/Number%20in%20Words

After entering the short bit of code from the Essay, the key result is the
verb `us` (or 'uk`  and others nationalities are also available).

All it took was changing table as suggested below.

1 : (':'; '(((#~LF-.@e.])5!:5<''u'');,.     y),.({.;}.)":x,y u/x')~
1 : (':'; '(((#~LF-.@e.])5!:5<''u'');,.us"0 y),.({.;}.)":x,y u/x')~

​And "presto" I got the following result with words for numbers in the left
column.​


   9!:7'--------+|-'

   + table~ 8+i. 4
--------------------
|+     | 8  9 10 11|
--------------------
|eight |16 17 18 19|
|nine  |17 18 19 20|
|ten   |18 19 20 21|
|eleven|19 20 21 22|
-------------------+

​Oh, and below is the Essay's code (your wrap may vary).​


u=. ;:'one two three four five six seven eight nine'
v=. ;:'ten eleven twelve thirteen fourteen fifteen sixteen seventeen
eighteen nineteen'
t=. ;:'twenty thirty forty fifty sixty seventy eighty ninety'
EN100=: '' ; u , v , , t ,&.>/ '';'-',&.>u

z=. '' ; 'thousand' ; (;:'m b tr quadr quint sext sept oct non'),&.>
<'illion'
u=. ;:'un duo tre quattuor quin sex septen octo novem'
t=. (;:'dec vigint trigint quadragint quinquagint sexagint septuagint
octogint nonagint'),&.><'illion'
ENU=: z , (, t ,~&.>/ '';u) , <'centillion'

en3=: 4 : 0
 'p q'=. 0 100#:y
 (p{::EN100),((*p)#' hundred'),((p*&*q)#x),q{::EN100
)

en=: 4 : 0
 d=. 1000&#.^:_1 y
 assert. (0<:y) *. ((=<.)y) *. d <:&# ENU
 c=. x&en3&.> (*d)#d
 ((0=y)#'zero') , (-2+*{:d) }. ; , c,.(<' '),.(ENU{~I.&.|.*d),.<', '
)

uk=: ' and '&en   NB. British
us=: ' '    &en   NB. American
-- 

(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to