Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ruby works out pretty nicely in that case!

  def order_list_by_predicate(l, &blk)
    l.partition{|i| blk.call(i)}.flatten
  end

  part(1..6) do |i|
    i % 2 == 1
  end
And you can always sort the incoming list if that's a requirement.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: