User RPL Micro-Challenge: Sort list of dates - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: User RPL Micro-Challenge: Sort list of dates (/thread-8974.html) |
User RPL Micro-Challenge: Sort list of dates - Joe Horn - 09-03-2017 09:46 AM Here's a User RPL programming challenge that's so mini it's micro. Good for a momentary diversion. Since it's so simple, be sure to attempt it before looking at the solutions posted below. Input: A list of valid dates in the current DMY or MDY mode. Output: The same list, sorted into ascending historical order. Note: Program must use current DMY/MDY format for input and leave that setting the same when it exits. Example in MDY mode: { 8.191955 9.032017 7.041776 } --> { 7.041776 8.191955 9.032017 } Winner: Smallest program in bytes. RE: User RPL Micro-Challenge: Sort list of dates - grsbanks - 09-03-2017 12:09 PM (09-03-2017 09:46 AM)Joe Horn Wrote: Here's a User RPL programming challenge that's so mini it's micro. Good for a momentary diversion. Since it's so simple, be sure to attempt it before looking at the solutions posted below. Giving your age away there, Joe? Code: << DATE DUP ROT DDAYS SORT DATE+ >> HP 50g: 28 bytes / #C1CCh RE: User RPL Micro-Challenge: Sort list of dates - Gilles59 - 09-03-2017 10:13 PM (09-03-2017 12:09 PM)grsbanks Wrote: Giving your age away there, Joe? Very nice ! RE: User RPL Micro-Challenge: Sort list of dates - rprosperi - 09-04-2017 12:47 AM (09-03-2017 10:13 PM)Gilles59 Wrote: Very nice ! 1 + RE: User RPL Micro-Challenge: Sort list of dates - Joe Horn - 09-04-2017 03:32 AM (09-03-2017 12:09 PM)grsbanks Wrote: Congrats! I think that's the smallest possible solution. |