Post Reply 
RPL Mini-Challenge: All Odd Digits?
07-04-2017, 03:10 PM
Post: #21
RE: RPL Mini-Challenge: All Odd Digits?
With Gerald H's sample input my UserRPL program takes 0.1426 seconds, resulting in a score of 8.2708. Not exactly good compared to the scores of others, but straightforward code with some lessons taken from the recent list processing discussion Smile - the list of strings is just eating too much memory, ruining my score.

Let's try SysRPL instead - that's still RPL, right?
Code:
::
  DO>STR TRUE
  BINT10 ZERO_DO
    OVERINDEX@ #>$
    PTR 13FD8
    #0= AND
  BINT2 +LOOP
  SWAPDROP COERCEFLAG
;
You'll probably ask what that PTR does ... it's just BINT1 POS$ in a single command; Nosy showed me that one while looking for ... well, exactly that.
Size is 37.5 bytes.
Times were 0.1495 for the worst case scenario, 0.0292 for the best case, and 0.0942 for Gerald H's average case. The corresponding scores are 5.60625, 1.095, and 3.5325.
Since this is fairly simple code, some of the SysRPL veterans probably have some tricks up their sleeves that will smash this score, but for now ... first score below 4!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL Mini-Challenge: All Odd Digits? - 3298 - 07-04-2017 03:10 PM



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