title: Elixir: Stream.drop_while generalisation?
body: <p>I'd like to generalise this code but can't see how to do so in a neat way:</p>
  
  <pre><code>defmodule Demo do
  
   defp side_effect(bool, label) do
     if bool do
       IO.puts label
     end
   end
  
   def go do
    {a,b,c} = {4,8,13}
  
    [2,3,4,5,7,8,9,10,11,12] # always in ascending order
    |&gt; Stream.drop_while( fn i -&gt; bool = (i&lt;a); side_effect(bool, "a_#{i}"); bool end ) 
    |&gt; Stream.drop_while( fn i -&gt; bool = (i&lt;b); side_effect(bool, "b_#{i}"); bool end ) 
    |&gt; Stream.drop_while( fn i -&gt; bool = (i&lt;c); side_effect(bool, "c_#{i}"); bool end ) 
    |&gt; Enum.to_list
   end
  end
  </code></pre>
  
  <p>When this runs (Demo.go) I get:</p>
  
  <pre><code>a_2
  a_3
  b_4
  b_5
  b_7
  c_8
  c_9
  c_10
  c_11
  c_12
  []
  </code></pre>
  
  <p>just as I wished - getting a side effect executed for each element in the input list, with an empty list as final output. 
  But is it possible to  generalise this so I can programmatically include (based on a list) as many lines as I like such a:</p>
  
  <pre><code>|&gt; Stream.drop_while( fn i -&gt; bool = (i&lt;x); side_effect(bool, "x_#{i}"); bool end ) 
  </code></pre>
  
  <p>I was hoping not to explore macros if I can help it.</p>