[racket] sequence-filter of in-port

From: Richard Cleis (rcleis at me.com)
Date: Sun Jul 22 14:54:30 EDT 2012

I just downloaded 5.2.1. It works, too. I am slow to upgrade because I don't fix what ain't broke. That was broke, so I fixed it by upgrading. Now I have a better understanding of how sequences work, too.

rac

On Jul 22, 2012, at 10:57 AM, Adolfo Pérez Álvarez wrote:

> Hi Richard,
> 
> What version of Racket are you using? I've tested your code with
> 5.3.0.16 and it worked as expected, returning '() in both cases.
> 
> 2012/7/22 Richard Cleis <rcleis at me.com>:
>> 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
>> 
>> ____________________
>>  Racket Users list:
>>  http://lists.racket-lang.org/users



Posted on the users mailing list.