for x <- [some_list] do
case _compute(x) do
nil -> nil # directly exclude this value from output
val -> val # add this value to output as usual
end
end
Short of running the whole comprehensions, the filtering out nil values,
In the example you wrote the list comprehension would return the nil and other values i.e. the case does not filter out nil
Given the nil values are a result of _compute unless you know the exact values of x which would result in a _computer(x) == nil you can not prefilter the input.
It is very common to generate a list of results and post-filter the results