Handbook
Glossary
human-readable>duration ( string -- duration )
Vocabulary
calendar
.
format
Inputs
string
an
object
Outputs
duration
an
object
Definition
USING:
calendar
combinators
grouping
kernel
math.parser
sequences
splitting
;
IN:
calendar.format
:
human-readable>duration
( string -- duration )
" "
split
"and"
swap
remove
[
","
?tail
drop
"s"
?tail
drop
]
map
2
<groups>
[
first2
[
string>number
]
dip
{
{
"year"
[
years
]
}
{
"day"
[
days
]
}
{
"hour"
[
hours
]
}
{
"minute"
[
minutes
]
}
{
"second"
[
seconds
]
}
}
case
]
[
duration+
]
map-reduce
;