2021-8: Time to Make a Difference
Write a function that:
- has a right argument that is a numeric scalar or vector of length up to 3, representing a number of [[[days] hours] minutes] – a single number represents minutes, a 2-element vector represents hours and minutes, and a 3-element vector represents days, hours, and minutes.
- has a similar left argument, although not necessarily the same length as the right argument.
- returns a single number representing the magnitude of the difference in minutes between the arguments.
💡 Hint: The functions decode X⊥Y and take ↑ could be useful for this problem.
Examples:
2 30 (your_function) 5 15
165
5 15 (your_function) 2 30
165
1 0 0 (your_function) 0 ⍝ number of minutes in a day
1440
1 0 0 (your_function) ⍬ ⍝ don't forget to handle empty arguments!
1440
1 0 (your_function) ¯1 0
120
1.5 0 (your_function) 90
0
your_function ←
Solutions

