[racket] sequence-filter of in-port

From: Richard Cleis (rcleis at me.com)
Date: Sun Jul 22 12:10:58 EDT 2012

I was attempting to use sequence-filter and in-port to filter large files into small lists, but the following error occurs on the occasion that everything is filtered: 

apply: expects type <proper list> as 2nd argument, given: #f; other arguments were: #<procedure:might-filter-all>

;; equivalent arbitrary examples (I think)

(define (might-filter-all x) (= x 99))  ; both cases below return '(3), if 99 is changed to 3

(sequence->list (sequence-filter might-filter-all (in-range 3 4)))                         ; returns '()
(sequence->list (sequence-filter might-filter-all (in-port read (open-input-string "3")))) ; an error

I could not find in-port in sequence.rkt, so I did not read it.

Should the in-port sequence be different?

rac


Posted on the users mailing list.