21.01.2015 Views

Reference: PLT Scheme - Download PLT Scheme

Reference: PLT Scheme - Download PLT Scheme

Reference: PLT Scheme - Download PLT Scheme

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Returns a sequence that contains the elements of seq (which must be single-valued), but<br />

only until the last element for which applying pred to the element produces #t, after which<br />

the sequence ends.<br />

(stop-after seq pred) → sequence<br />

seq : sequence<br />

pred : (any/c . -> . any)<br />

Returns a sequence that contains the elements of seq (which must be single-valued), but<br />

only until the element (inclusive) for which applying pred to the element produces #t, after<br />

which the sequence ends.<br />

(make-do-sequence thunk) → sequence<br />

thunk : (-> (values (any/c . -> . any)<br />

(any/c . -> . any/c)<br />

any/c<br />

(any/c . -> . any/c)<br />

(() () #:rest list . ->* . any/c)<br />

((any/c) () #:rest list . ->* . any/c)))<br />

Returns a sequence whose elements are generated by the procedures and initial value returned<br />

by the thunk. The generator is defined in terms of a position, which is initialized to<br />

the third result of the thunk, and the element, which may consist of multiple values.<br />

The thunk results define the generated elements as follows:<br />

• The first result is a pos->element procedure that takes the current position and returns<br />

the value(s) for the current element.<br />

• The second result is a next-pos procedure that takes the current position and returns<br />

the next position.<br />

• The third result is the initial position.<br />

• The fourth result takes the current position and returns a true result if the sequence<br />

includes the value(s) for the current position, and false if the sequence should end<br />

instead of including the value(s).<br />

• The fifth result is like the fourth result, but it takes the current element value(s) instead<br />

of the current position.<br />

• The sixth result is like the fourth result, but it takes both the current position and the<br />

current element values(s) and determines a sequence end after the current element is<br />

already included in the sequence.<br />

230

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!