urbit / arvo

https://github.com/urbit/urbit
110 stars 58 forks source link

Arvo doesn't have a library for converting atoms to English #683

Closed xykj61 closed 5 years ago

xykj61 commented 6 years ago

As discussed with @ohAitch in #682, it'd be nice to have a /lib file that provided this utility function of converting Hoon atom digits to their English text values.

For example, something like:

~zod:dojo> /+  to-english
>=
~zod:dojo> (atom:to-english 42)
"forty-two"
ohAitch commented 6 years ago

~clearly we should have a new @en atom format~

xykj61 commented 6 years ago

Addition: It'd be a fun feature if this worked for arbitrarily large atoms, i.e.:

~zod:dojo> /+  to-english
>=
~zod:dojo> (atom:to-english 18.446.744.073.709.551.616)
"eighteen quintillion, four hundred and forty-six quadrillion, seven hundred and forty-four trillion, seventy-three billion, seven hundred and nine million, five hundred and fifty-one thousand, six hundred, and sixteen"
ohAitch commented 6 years ago

I was thinking full https://en.wikipedia.org/wiki/Names_of_large_numbers yeah, it's not that much more code

On Tue, Mar 20, 2018 at 3:46 PM, Keaton Dunsford notifications@github.com wrote:

Addition: It'd be a fun feature if this worked for arbitrarily large atoms, i.e.:

~zod:dojo> /+ to-english

= ~zod:dojo> (atom:to-english 18.446.744.073.709.551.616) "eighteen quintillion, four hundred and forty-six quadrillion, seven hundred and forty-four trillion, seventy-three billion, seven hundred and nine million, five hundred and fifty-one thousand, six hundred, and sixteen"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/urbit/arvo/issues/683#issuecomment-374783157, or mute the thread https://github.com/notifications/unsubscribe-auth/ABxXhjqgwofdfzBoawz86_qo7GI_rJvWks5tgYbggaJpZM4Syw3n .

cgyarvin commented 6 years ago

If my plane crashes and this goes into hoon.hoon, my angry ghost will haunt all your repos until the end of time.

But there is a place in %clay for stuff like this. There must be -- although the filesystem ontology still needs some work...

On Tue, Mar 20, 2018 at 3:50 PM, Anton Dyudin notifications@github.com wrote:

I was thinking full https://en.wikipedia.org/wiki/Names_of_large_numbers yeah, it's not that much more code

On Tue, Mar 20, 2018 at 3:46 PM, Keaton Dunsford <notifications@github.com

wrote:

Addition: It'd be a fun feature if this worked for arbitrarily large atoms, i.e.:

~zod:dojo> /+ to-english

= ~zod:dojo> (atom:to-english 18.446.744.073.709.551.616) "eighteen quintillion, four hundred and forty-six quadrillion, seven hundred and forty-four trillion, seventy-three billion, seven hundred and nine million, five hundred and fifty-one thousand, six hundred, and sixteen"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/urbit/arvo/issues/683#issuecomment-374783157, or mute the thread https://github.com/notifications/unsubscribe- auth/ABxXhjqgwofdfzBoawz86_qo7GI_rJvWks5tgYbggaJpZM4Syw3n .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/urbit/arvo/issues/683#issuecomment-374784031, or mute the thread https://github.com/notifications/unsubscribe-auth/AALyAXgORsqnHVxCdsQ7_ty2lOq0hSTGks5tgYfQgaJpZM4Syw3n .

Fang- commented 6 years ago

hoon.hoon %clay

I'm not sure how this would go anywhere but zuse (or maybe a /lib if we're super opposed to expanding the stdlib for some reason).

ohAitch commented 6 years ago

I'd just port https://www.npmjs.com/package/number-to-words into lib/number-to-words.hoon, or like wherever userlib:zuse ends up.

joemfb commented 5 years ago

resolved by #1053