Convert seconds to compound duration: Difference between revisions

Content added Content deleted
m (→‎version 2: changed subroutine into a function, added whitespace to the output.)
m (→‎{{header|J}}: whitespace)
Line 951: Line 951:
Implementation:
Implementation:


<lang J>fmtsecs=:3 :0
<lang J>fmtsecs=: verb define
seq=. 0 7 24 60 60 #: y
seq=. 0 7 24 60 60 #: y
}: ;: inv,(0~:seq)#(8!:0 seq),. <;.2'wk,d,hr,min,sec,'
}: ;:inv ,(0 ~: seq) # (8!:0 seq) ,. <;.2'wk,d,hr,min,sec,'
)</lang>
)</lang>