Post Reply 
challenge
01-19-2015, 09:08 PM (This post was last modified: 01-19-2015 09:47 PM by Gilles.)
Post: #4
RE: challenge
RPL but not one-liner. Recursive approch.

Code:

DIR
 J20   { "one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen", "nineteen"}
 J100  { "twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"}
 Tête  « →STR HEAD STR→ »
 Queue « →STR TAIL STR→ »

 →TXT
  « → n
   « 
    CASE
     'n==0'             THEN "" END
     'n<20'             THEN 'J20' n GET END
     'n≥20 AND n<100'   THEN 'J100'  n Tête 1 - GET n Queue →TXT END
     'n≥100 AND n≤999'  THEN n Tête →TXT "hundred"  n Queue →TXT END
     'n≥1000'           THEN n Tête →TXT "thousand" n Queue →TXT END
    END
   »
   +
  »
  
 Count
  « 
   0
   1 9999 FOR n n 1. DISP
    IF n "" n →TXT SIZE MOD NOT THEN 1 + DUP 2. DISP END
   NEXT
  »
END

Count returns 359 (without AND)

By the way, my english is bad but 9999 should it not be writen as : n-i-n-e-t-h-o-u-s-a-n-d-n-i-n-e-h-u-n-d-r-e-d-A-N-D-n-i-n-e-t-y-n-i-n-e
? (36 letters with an AND inside)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
challenge - Don Shepherd - 01-19-2015, 03:06 PM
RE: challenge - Thomas Klemm - 01-19-2015, 07:22 PM
RE: challenge - Don Shepherd - 01-19-2015, 09:00 PM
RE: challenge - Gilles - 01-19-2015 09:08 PM
RE: challenge - brickviking - 06-22-2018, 10:34 AM
RE: challenge - grsbanks - 06-22-2018, 10:40 AM
RE: challenge - Don Shepherd - 06-22-2018, 01:17 PM
RE: challenge - Thomas Okken - 06-22-2018, 02:22 PM
RE: challenge - burkhard - 06-22-2018, 03:10 PM
RE: challenge - Don Shepherd - 06-22-2018, 04:31 PM
RE: challenge - Don Shepherd - 06-22-2018, 06:14 PM
RE: challenge - Thomas Klemm - 01-19-2015, 09:12 PM
RE: challenge - Thomas Klemm - 01-19-2015, 09:19 PM
RE: challenge - Gilles - 01-19-2015, 09:37 PM
RE: challenge - Don Shepherd - 01-19-2015, 10:24 PM
RE: challenge - Katie Wasserman - 01-19-2015, 10:32 PM
RE: challenge - Don Shepherd - 01-19-2015, 10:52 PM
RE: challenge - Gilles - 01-19-2015, 10:55 PM
RE: challenge - Hlib - 01-20-2015, 06:10 PM
RE: challenge - Gilles - 01-21-2015, 10:07 PM
RE: challenge - Hlib - 01-22-2015, 10:10 AM
RE: challenge - Hlib - 01-21-2015, 04:03 PM
RE: challenge - Don Shepherd - 01-21-2015, 04:14 PM
RE: challenge - Don Shepherd - 01-21-2015, 09:32 PM
RE: challenge - Gilles - 01-21-2015, 09:10 PM
RE: challenge - Hlib - 06-21-2018, 02:43 PM
RE: challenge - Paul Dale - 06-22-2018, 12:38 AM
RE: challenge - Don Shepherd - 06-22-2018, 01:25 AM
RE: challenge - grsbanks - 06-22-2018, 06:59 AM
RE: challenge - ijabbott - 06-22-2018, 07:24 AM
RE: challenge - grsbanks - 06-22-2018, 07:32 AM
RE: challenge - ijabbott - 06-22-2018, 04:26 PM
RE: challenge - Hlib - 06-22-2018, 10:08 PM
RE: challenge - Don Shepherd - 06-23-2018, 12:15 AM
RE: challenge - ijabbott - 06-23-2018, 09:20 AM
RE: challenge - Don Shepherd - 06-23-2018, 10:13 AM
RE: challenge - grsbanks - 06-23-2018, 10:22 AM
RE: challenge - Don Shepherd - 06-23-2018, 10:42 AM
RE: challenge - grsbanks - 06-23-2018, 10:48 AM
RE: challenge - Massimo Gnerucci - 06-23-2018, 12:45 PM
RE: challenge - Thomas Okken - 06-23-2018, 04:49 PM
RE: challenge - Massimo Gnerucci - 06-23-2018, 06:41 PM
RE: challenge - grsbanks - 06-23-2018, 07:38 PM
RE: challenge - Massimo Gnerucci - 06-23-2018, 08:42 PM



User(s) browsing this thread: 5 Guest(s)