Also, since you're not actually interested in the value of i, you
should probably use in-vector rather than in-range. The whole example
would be:

(for/list ([value (in-vector vector)]
           #:when (< 0 (length value)))
  value)


On Mon, Jul 13, 2015 at 3:18 PM, Jon Zeppieri <zeppi...@gmail.com> wrote:
> I think you're looking for #:when / #:unless.
>
> On Mon, Jul 13, 2015 at 3:12 PM, Pekka Niiranen
> <pekka.niira...@pp5.inet.fi> wrote:
>> Hello users,
>>
>> What is the proper design pattern to skip invalid values
>> when using for/list?
>>
>> The programs below fails because #:continue is not recognized:
>>
>> for/list ([i (in-range 0 1000)])
>>   (let ((value (vector-ref vector i)))
>>     (if (< 0 (length value))
>>         value
>>         #:continue)))
>>
>> Sure, I could bypass this limitation by building the list explicitely
>> with plain "for + cons" or:
>>
>> (define result-list
>>   (for/list ([i (in-range 0 1000)])
>>     (let ((value (vector-ref vector i)))
>>       (if (< 0 (length value))
>>           value
>>           empty))))
>>
>> => then filter empties from result-list with another loop...
>>
>> -pekka-
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to