Post Reply 
User RPL Micro-Challenge: Sort list of dates
09-03-2017, 09:46 AM
Post: #1
User RPL Micro-Challenge: Sort list of dates
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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-03-2017, 12:09 PM (This post was last modified: 09-03-2017 12:19 PM by grsbanks.)
Post: #2
RE: User RPL Micro-Challenge: Sort list of dates
(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.

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.

Giving your age away there, Joe? Smile

Code:
<< DATE DUP ROT DDAYS SORT DATE+ >>

HP 50g: 28 bytes / #C1CCh
Find all posts by this user
Quote this message in a reply
09-03-2017, 10:13 PM
Post: #3
RE: User RPL Micro-Challenge: Sort list of dates
(09-03-2017 12:09 PM)grsbanks Wrote:  Giving your age away there, Joe? Smile

Code:
<< DATE DUP ROT DDAYS SORT DATE+ >>

HP 50g: 28 bytes / #C1CCh

Very nice !
Find all posts by this user
Quote this message in a reply
09-04-2017, 12:47 AM
Post: #4
RE: User RPL Micro-Challenge: Sort list of dates
(09-03-2017 10:13 PM)Gilles59 Wrote:  Very nice !

1 +

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-04-2017, 03:32 AM
Post: #5
RE: User RPL Micro-Challenge: Sort list of dates
(09-03-2017 12:09 PM)grsbanks Wrote:  
Code:
<< DATE DUP ROT DDAYS SORT DATE+ >>

Congrats! I think that's the smallest possible solution.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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