# Re: Running multiple closures per iteration

**URL:** <https://www.ruby-forum.com/t/re-running-multiple-closures-per-iteration/111250>\
**Category:** Ruby\
**Created:** [August 4, 2007, 11:53am UTC](https://www.ruby-forum.com/t/re-running-multiple-closures-per-iteration/111250 "2007-08-04T11:53:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dohzya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@dohzya](https://www.ruby-forum.com/u/dohzya)\
**Post date:** [August 4, 2007, 11:53am UTC](https://www.ruby-forum.com/t/re-running-multiple-closures-per-iteration/111250/1 "2007-08-04T11:53:04Z")

</div>

Le samedi 04 août 2007 à 02:38 +0900, Joshua C. a écrit :

> o = a.select {|x| x \>= 0}  
> p = a.inject(0) {|s, x| s += x}

def truc( a, sel, &inj )  
o = a.select sel.call  
p = a.inject(0) &inj  
end

truc( a, proc{|x| x \>= 0} ){|s, x| s += x}
