On Thu, Nov 29, 2012 at 1:37 PM, Bartosz Dziewoski <matma.rex / gmail.com> wrote:
> 2012/11/29 Regis d'Aubarede <lists / ruby-forum.com>:
>>>> 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.