-
Notifications
You must be signed in to change notification settings - Fork 4
/
gen.ss
30 lines (26 loc) · 1.96 KB
/
gen.ss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#lang scheme/base
(require scheme/dict
"base.ss"
"generator.ss")
; Provide statements ---------------------------
(provide gen->
(rename-out [generator-end g:end]
[generator-end? g:end?]))
(provide/contract
[rename generator-map g:map (->* (procedure?) () #:rest (listof procedure?) procedure?)]
[rename generator-fold-map g:fold-map (->* (procedure? any/c) () #:rest (listof procedure?) procedure?)]
[rename generator-filter g:filter (-> procedure? procedure? procedure?)]
[rename generator-filter-map g:filter-map (-> procedure? procedure? procedure?)]
[rename generator-remove-duplicates g:remove-duplicates (->* (procedure?) (procedure?) procedure?)]
[rename generator-debug g:debug (-> string? procedure? procedure?)]
[rename generator-for-each g:for-each (->* (procedure?) () #:rest (listof procedure?) any)]
[rename generator-fold g:fold (->* (procedure? any/c) () #:rest (listof procedure?) any)]
[rename generator-append g:append (->* () () #:rest (listof procedure?) procedure?)]
[rename generator->list g:collect (-> procedure? (or/c pair? null?))]
[rename generator->hash g:collect/hash (->* (procedure? procedure?)
(procedure? (and/c hash? dict-mutable?))
(and/c hash? dict-mutable?))]
[rename list->generator g:list (-> list? procedure?)]
[rename range->generator g:range (->* (integer?) ((or/c integer? false/c) integer?) procedure?)]
[rename generator-project g:project (->* ((listof boolean?) procedure?) (procedure?) procedure?)]
[rename in-generator in-gen (-> (gen-> any/c) sequence?)])