fork download
  1.  
  2. class Proc
  3. def self_curry
  4. self.curry.call(self)
  5. end
  6. end
  7.  
  8.  
  9. p lambda { |f, seq| seq.empty? ? [] : seq[1..seq.size].partition { |a| a < seq.first }.map { |a| f.call(f, a) }.insert(1, seq.first).flatten }.self_curry.call((1..10).sort_by{rand})
  10.  
  11.  
  12.  
Success #stdin #stdout 0s 4716KB
stdin
Standard input is empty
stdout
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]