Convert seconds to compound duration: Difference between revisions
Convert seconds to compound duration (view source)
Revision as of 21:40, 22 February 2021
, 3 years agosimplify, make clear that helper functions aren't closures
m (→{{header|Haskell}}: Tidied parameterised variant.) |
(simplify, make clear that helper functions aren't closures) |
||
Line 3,500:
=={{header|Standard ML}}==
<lang sml>
fun fmtNonZero (0, _, list) = list
let▼
fun divModHead (_, []) = []
| divModHead (d, head :: tail) = head div d :: head mod d :: tail
fun compoundDuration seconds =
▲ let
▲ in
in
end
▲ o ListPair.zip) (weeks :: subUnits, ["wk", "d", "hr", "min", "sec"])
val () = app (fn s => print (compoundDuration s ^ "\n")) [7259, 86400, 6000000]</lang>
|