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)))
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:
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
In that case, you probably want to make use of in-value to bind
single-value sequences in your for*/list:
(for*/list ([(start end) (in-parallel 1 1000)]
[i (in-range start (sub1 end))]
[s (in-value (vector-ref vector i))]
[columns (in-value (string-split s ,))]
4 matches
Mail list logo