lists: nothing was using the traverse combinator and it had a stack effect error. nuked

db4
Slava Pestov 2009-11-09 00:54:15 -06:00
parent 8e90b92da2
commit c5387cdcdb
2 changed files with 0 additions and 13 deletions

View File

@ -44,7 +44,6 @@ ARTICLE: { "lists" "combinators" } "Combinators for lists"
foldl
foldr
lmap>array
traverse
} ;
ARTICLE: { "lists" "manipulation" } "Manipulating lists"
@ -151,12 +150,6 @@ HELP: list>array
{ $values { "list" list } { "array" array } }
{ $description "Convert a list into an array." } ;
HELP: traverse
{ $values { "list" list } { "pred" { $quotation "( list/elt -- ? )" } }
{ "quot" { $quotation "( list/elt -- result)" } } { "result" "a new cons object" } }
{ $description "Recursively traverses the list object, replacing any elements (which can themselves be sublists) that pred"
" returns true for with the result of applying quot to." } ;
HELP: list
{ $class-description "The class of lists. All lists are expected to conform to " { $link { "lists" "protocol" } } "." } ;

View File

@ -93,11 +93,5 @@ PRIVATE>
: list>array ( list -- array )
[ ] lmap>array ;
:: traverse ( list pred quot: ( list/elt -- result ) -- result )
list [| elt |
elt dup pred call [ quot call ] when
dup list? [ pred quot traverse ] when
] lmap ; inline recursive
INSTANCE: cons list
INSTANCE: +nil+ list