Re: Filter predicates and side-effects

2015-09-02 Thread Michael Blume
Don't call filter for side effects, don't rely on when side effects will or will not happen, but yeah, your filter predicate can have side effects. On Wed, Sep 2, 2015 at 9:13 AM James Elliott wrote: > Indeed, that would make sense for filter, but since filterv immediately > puts them all into a

Re: Filter predicates and side-effects

2015-09-02 Thread James Elliott
Indeed, that would make sense for filter, but since filterv immediately puts them all into a vector, I was particularly puzzled by the warning on its doc string. In my case I am not relying on the side effects for anything, I merely cannot guarantee there are none (and even if chunking were an

Re: Filter predicates and side-effects

2015-09-02 Thread Raymond Huang
I believe the reason it's not recommended is because it returns a lazy chunked sequence. This means that it's not guaranteed to eagerly perform your side-effects, unless you wrap it in `doall`. On Wed, Sep 2, 2015 at 8:48 AM, James Elliott wrote: > I notice that the documentation for filter and

Filter predicates and side-effects

2015-09-02 Thread James Elliott
I notice that the documentation for filter and filterv are emphatic that the predicate you are using be free of side effects. Why is that so? For example, I would like to use filterv to collect a list of lighting effects which respond false to a protocol method which asks whether they have fini