Convert seconds to compound duration: Difference between revisions

Content added Content deleted
m (→‎version 2: added whitespace, used templates for the output sections.)
(Added 11l)
Line 68: Line 68:
<hr style="margin:1em 0;"/>
<hr style="margin:1em 0;"/>
<br><br>
<br><br>

=={{header|11l}}==
{{trans|Julia}}
<lang 11l>F duration(=sec)
[Int] t
L(dm) [60, 60, 24, 7]
Int m
(sec, m) = (sec I/ dm, sec % dm)
t.insert(0, m)
t.insert(0, sec)
R zip(t, [‘wk’, ‘d’, ‘hr’, ‘min’, ‘sec’]).filter(num_unit -> num_unit[0] > 0).map(num_unit -> num_unit[0]‘ ’num_unit[1]).join(‘, ’)

print(duration(7259))
print(duration(86400))
print(duration(6000000))</lang>


=={{header|Ada}}==
=={{header|Ada}}==