lazy-cons ( car cdr -- lazy )
Lazy lists ยป Constructing lazy lists

Next:1lazy-list ( a -- lazy-cons )


Vocabulary
lists.lazy

Inputs
cara quotation with stack effect ( -- elt )
cdra quotation with stack effect ( -- cons )


Outputs
lazythe resulting cons object


Word description
Constructs a cons object for a lazy list from two quotations. The car quotation should return the head of the list, and the cons quotation the tail when called. When cons or cdr are called on the lazy-cons object then the appropriate quotation is called.

See also
cons, car, cdr, nil, nil?

Definition