Convert seconds to compound duration: Difference between revisions
Convert seconds to compound duration (view source)
Revision as of 00:05, 6 September 2020
, 3 years ago→{{header|Haskell}}: Additionally parameterised separators.
m (→{{header|Haskell}}: Adjusted a pair of bound names.) |
(→{{header|Haskell}}: Additionally parameterised separators.) |
||
Line 1,789:
translation local daysPerWeek hoursPerDay n =
intercalate " -> " $
[show, durationString ", " " " daysPerWeek hoursPerDay (words local)] <*> [n]
durationString :: String -> String -> Int -> Int -> [String] -> Int -> String
durationString componentGap numberLabelGap daysPerWeek hoursPerDay xs n =
intercalate
(foldr
(foldr timeTags [] (zip (weekParts daysPerWeek hoursPerDay n) xs))▼
(timeTags numberLabelGap)
[]
timeTags :: String -> (Int, String) -> [String] -> [String]
timeTags numberLabelGap (n, s) xs
| 0 < n =
| otherwise = xs
|