Skip to content

2018-9: Earlier, Later, or the Same?

The system function ⎕TS returns a 7-element integer vector timestamp representing the current year, month, day, hour, minute, second, and millisecond in that order.

Write a function that given left and right arguments of such timestamps returns a ¯1, 1, or 0 if the left argument represents a time that is respectively, earlier than, later than, or simultaneous with the right argument.

Examples:

      2018 4 1 12 34 56 789 (your_function) 2018 4 1 16 45 12 800
¯1
      2018 4 1 12 34 56 789 (your_function) 2018 4 1 12 34 56 789
0
      2018 4 1 12 34 56 789 (your_function) 2017 4 1 12 34 56 789 
1
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub