Names to numbers: Difference between revisions
m
→{{header|Quackery}}: small tweak
m (→{{header|Quackery}}: small tweak) |
|||
Line 1,929:
=={{header|Quackery}}==
The idea is that, with a few tweaks and appropriate definitions for number names etc, a string such as <pre>one billion, two hundred and thirty four million, five hundred and sixty seven thousand, eight hundred and ninety</pre> can ''be'' a valid Quackery program.
The tweaks turn it into the nest <pre>[ {{
Finally, the compiled nest is executed with <code>do</code>.
<lang Quackery> [ 1 + ] is one ( --> n )
[ 2 + ] is two ( --> n )
[ 3 + ] is three ( --> n )
Line 1,972 ⟶ 1,971:
[ 0 ] is , ( --> n )
[ this , ]
[ over ' {{ = iff
nip done
+ again ] is }} ( [ * --> n )
[ $ "{{
witheach
[ dup char , = if
Line 1,988 ⟶ 1,987:
swap witheach
[ dup ' and = iff
drop
else
[ nested join ] ]
do ] is name->number ( $ --> n )
|