lists: Fix lists

db4
Doug Coleman 2013-03-24 21:48:40 -07:00
parent 90cde3fde9
commit 542e7cd95e
3 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,7 @@ HELP: <memoized-cons>
HELP: lazy-map
{ $values { "list" "a cons object" } { "quot" { $quotation "( obj -- X )" } } { "result" "resulting cons object" } }
{ $description "Perform a similar functionality to that of the " { $link map } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-map> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ;
{ $description "Perform a similar functionality to that of the " { $link map } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-map-state> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ;
HELP: ltake
{ $values { "n" "a non negative integer" } { "list" "a cons object" } { "result" "resulting cons object" } }

View File

@ -18,7 +18,7 @@ TUPLE: lazy-cons-state car cdr ;
: lazy-cons ( car cdr -- promise )
[ T{ promise f f t f } clone ] 2dip
[ promise ] bi@ \ lazy-cons-state boa
[ <promise> ] bi@ \ lazy-cons-state boa
>>value ;
M: lazy-cons-state car ( lazy-cons -- car )

View File

@ -63,7 +63,7 @@ ARTICLE: "lists-manipulation" "Manipulating lists"
} ;
HELP: cons
{ $values { "car" "the head of the list cell" } { "cdr" "the tail of the list cell" } { "cons" list } }
{ $values { "car" "the head of the list cell" } { "cdr" "the tail of the list cell" } { "cons-state" list } }
{ $description "Constructs a cons cell." } ;
HELP: swons