Handbook
Glossary
parse-mtga-deck ( string -- mtga-deck )
Vocabulary
scryfall
Inputs
string
an
object
Outputs
mtga-deck
an
object
Definition
USING:
accessors
combinators
kernel
sequences
sets
splitting
splitting.extras
unicode
;
IN:
scryfall
:
parse-mtga-deck
( string -- mtga-deck )
string-lines
[
[
blank?
]
trim
]
map
harvest
{
"About"
"Deck"
"Sideboard"
}
split*
[
<mtga-deck>
]
dip
[
dup
{
"About"
"Deck"
"Sideboard"
}
intersects?
[
first
>>section
]
[
over
section>>
{
{
"About"
[
first
"Name "
?head
drop
~quotation~
trim
>>name
]
}
{
"Deck"
[
parse-mtga-cards
>>deck
]
}
{
"Sideboard"
[
parse-mtga-cards
>>sideboard
]
}
[
unknown-mtga-deck-section
]
}
case
]
if
]
each
;