From: "Jesús Gabriel y Galán" Date: 2012-11-29T22:09:14+09:00 Subject: Re: Getting the smallest Items of an Array On Thu, Nov 29, 2012 at 1:37 PM, Bartosz Dziewoński wrote: > 2012/11/29 Regis d'Aubarede : >>>> def n_min(l,n) (1..n).map {a=l.min ; l=l-[a]; a } end >> => nil >>>> n_min([1,2,-1,3,4],2) >> => [-1, 1] > > Uhh... how about ary.sort.first(n)? You lose the relative ordering of the chosen elements. Don't know if it's important or not. Jesus.