Comment

Comment by jdcarr

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.
parent jdcarr 8 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton