title: ForAll and filter with Iterator in OCL
body: <p>I need to do 2 functions in OCL that work on collection: forAll and filter. The trick is I can only use <strong>iterator</strong>.</p>
  
  <p>This is what I come with:</p>
  
  <pre><code>context Collection(T)::forAll(expr) : Boolean
      body : self -&gt; iterate(t: T, acc: Boolean = true | expr(t) and acc)
  
  context Collection(T)::filter(expr) : Collection(T)
      body : self -&gt; iterate(t: T, acc: Collection(T) = {} | if expr(t) then acc-&gt;include(t) else acc endif
  </code></pre>
  
  <p>Please tell me if it's right or wrong.</p>