Convert seconds to compound duration: Difference between revisions
Content added Content deleted
Line 206: | Line 206: | ||
on angloDuration(intSeconds) |
on angloDuration(intSeconds) |
||
script mf |
script mf |
||
⚫ | |||
⚫ | |||
unitParts(intSeconds, [missing value, 7, 24, 60, 60]) |
|||
end weekParts |
|||
-- [String] -> (Int, String) -> [String] |
|||
on formatted(a, lstPair) |
on formatted(a, lstPair) |
||
set q to item 1 of lstPair |
set q to item 1 of lstPair |
||
Line 217: | Line 223: | ||
intercalate(", ", ¬ |
intercalate(", ", ¬ |
||
foldr( |
foldr(formatted of mf, [], ¬ |
||
zip(weekParts(intSeconds), ¬ |
zip(weekParts(intSeconds) of mf, ¬ |
||
["wk", "d", "hr", "min", "sec"]))) |
["wk", "d", "hr", "min", "sec"]))) |
||
end angloDuration |
end angloDuration |
||
-- INTEGER DECOMPOSITION |
|||
⚫ | |||
⚫ | |||
-- unitParts :: Int -> [maybe Int] -> [Int] |
|||
on unitParts(intTotal, unitList) |
|||
script mf |
script mf |
||
-- partList Record -> Int -> Record |
-- partList Record -> Int -> Record |
||
Line 242: | Line 250: | ||
end script |
end script |
||
parts of foldr( |
parts of foldr(partList of mf, ¬ |
||
{remaining: |
{remaining:intTotal, parts:[]}, unitList) |
||
end |
end unitParts |
||
Line 313: | Line 321: | ||
property lambda : f |
property lambda : f |
||
end script |
end script |
||
end mClosure |
end mClosure |
||
</lang> |
|||