title: Run sideEffect only once
body: <p>I got a tiny graph like:</p>
  
  <pre><code>g.addV('person').property(id, 'p1').property('name', 'mark')
  g.addV('person').property(id, 'p2').property('name', 'mark')
  g.addV('person').property(id, 'p3').property('name', 'jack')
  g.addV('person').property(id, 'p4').property('name', 'steve')
  
  g.addE('knows').from(V('p1')).to(V('p2')).property('since', 2001)
  g.addE('knows').from(V('p1')).to(V('p3')).property('since', 2010)
  g.addE('knows').from(V('p2')).to(V('p3')).property('since', 2012)
  g.addE('knows').from(V('p3')).to(V('p4')).property('since', 2019)
  </code></pre>
  
  <p>I wanna to submit a query to satisfy the following two demands:</p>
  
  <ul>
  <li><strong>Got all edges the 'since' of which is bigger than 2005</strong></li>
  <li><strong>Filter these edges, find out <code>inV</code> of which is <code>p1</code>'s friend</strong></li>
  </ul>
  
  <p>As of now, I can only write the following query:</p>
  
  <pre><code>g.E().hasLabel('knows').has('since', gt(2005)).
      sideEffect(
      V('p1').out().aggregate('friends')).
      where(inV().where(within('friends')))
  </code></pre>
  
  <p>The result of query is as expected:</p>
  
  <pre><code>gremlin&gt;     g.E().hasLabel('knows').has('since', gt(2005)).
  ......1&gt;       sideEffect(
  ......2&gt;       V('p1').out().aggregate('friends')).
  ......3&gt;       where(inV().where(within('friends')))
  ==&gt;e[26][p1-knows-&gt;p3]
  ==&gt;e[27][p2-knows-&gt;p3]
  </code></pre>
  
  <p>The problem is that the <code>sideEffect</code> step runs three times, I only want to run it once.</p>