diff --git a/collects/unstable/sequence.rkt b/collects/unstable/sequence.rkt index 7f9ce96b41..be7721a421 100644 --- a/collects/unstable/sequence.rkt +++ b/collects/unstable/sequence.rkt @@ -6,6 +6,10 @@ (provide in-syntax in-pairs in-sequence-forever sequence-lift) +;; ELI: I don't see a point in this over using `syntax->list' directly. +;; (Eg, the latter is something that can be used when the programmer +;; knows that it's a list, in contrast to this code which will just +;; throw an error.) (define-sequence-syntax in-syntax (λ () #'(λ (e) (in-list (syntax->list e)))) (λ (stx) @@ -13,6 +17,8 @@ [[ids (_ arg)] #'[ids (in-list (syntax->list arg))]]))) +;; ELI: This is very specific, and indeed there are no uses of it +;; anywhere in the tree other than in TR where it came from. (define (in-pairs seq) (make-do-sequence (λ () @@ -24,6 +30,8 @@ (λ _ #t) (λ _ #t)))))) +;; ELI: Besides the awful name, this is the same as +;; (in-sequences seq (in-cycle (in-value val))) (define (in-sequence-forever seq val) (make-do-sequence (λ () @@ -35,6 +43,7 @@ (λ _ #t) (λ _ #t)))))) +;; ELI: How is this different from `sequence-map'? (define (sequence-lift f seq) (make-do-sequence (λ () @@ -52,16 +61,19 @@ [in-slice (exact-positive-integer? any/c . -> . any)]) (define (in-slice k seq) + ;; ELI: what's the point of using `any/c' above and then checking it here? (unless (sequence? seq) (raise-type-error 'in-slice "sequence" seq)) (make-do-sequence (λ () (define-values (more? get) (sequence-generate seq)) (values (λ (_) + ;; ELI: Add an `in-range' (for/list ([i k] #:when (more?)) (get))) values #f #f + ;; ELI: Use `pair?' (λ (val) (0 . < . (length val))) #f))))