Handbook
Glossary
parse-visibility ( str -- str' )
Vocabulary
metar
.
private
Inputs
str
an
object
Outputs
str'
an
object
Definition
USING:
assocs
combinators
formatting
kernel
math.parser
sequences
splitting
;
IN:
metar.private
:
parse-visibility
( str -- str' )
dup
"////"
=
[
drop
"visibility unavailable"
]
[
"SM"
?tail
[
dup
first
{
{
77
[
rest
"less than "
]
}
{
80
[
rest
"more than "
]
}
[
drop
""
]
}
case
swap
"%s%s statute miles"
sprintf
]
[
"NDV"
?tail
drop
4
cut
[
string>number
{
{
~quotation~ ~quotation~
}
{
~quotation~ ~quotation~
}
{
~quotation~ ~quotation~
}
{
~quotation~ ~quotation~
}
[
drop
"10km or more"
]
}
cond
]
dip
[
[
H{
{
83
"south"
}
{
69
"east"
}
{
78
"north"
}
{
87
"west"
}
}
at
]
{
}
map-as
unclip-last
[
"-"
join
]
dip
append
" "
glue
]
unless-empty
]
if
]
if
;