## Feature #7939

Updated by Nobuyoshi Nakada over 3 years ago

=begin

I really like the new "(({assuming}))" "assuming" method used for currying in Perl 6.

For example if I loose my mind and implement ((%fizzbuzz%)) fizzbuzz via currying I can do it like this:

fb = ->(modulo_number, message, x) { message if x % modulo_number == 0 }

fizzbuzz = fb.curry[15,"FizzBuzz"]

fizz = fb.curry[3, "Fizz"]

buzz = fb.curry[5, "Buzz"]

(1..100).each { |i| puts fizzbuzz[i] || fizz[i] || buzz[i] || i }

Here the first hurdle is that curry is somewhat mathematical, and the secons is that you need to use (({[]})) [] for function invoking...

If we had something similar to this:

class Proc

def assuming(*args)

curry.call *args

end

end

end

It could be written more naturally IMO:

fb = ->(modulo_number, message, x) { message if x % modulo_number == 0 }

fizzbuzz = fb.assuming(15,"FizzBuzz")

buzz = fb.assuming(5, "Buzz")

fizz = fb.assuming(3,"Fizz")

(1..100).each { |i| puts fizzbuzz[i] || fizz[i] || buzz[i] || i }

=end

I really like the new "(({assuming}))" "assuming" method used for currying in Perl 6.

For example if I loose my mind and implement ((%fizzbuzz%)) fizzbuzz via currying I can do it like this:

fb = ->(modulo_number, message, x) { message if x % modulo_number == 0 }

fizzbuzz = fb.curry[15,"FizzBuzz"]

fizz = fb.curry[3, "Fizz"]

buzz = fb.curry[5, "Buzz"]

(1..100).each { |i| puts fizzbuzz[i] || fizz[i] || buzz[i] || i }

Here the first hurdle is that curry is somewhat mathematical, and the secons is that you need to use (({[]})) [] for function invoking...

If we had something similar to this:

class Proc

def assuming(*args)

curry.call *args

end

end

end

It could be written more naturally IMO:

fb = ->(modulo_number, message, x) { message if x % modulo_number == 0 }

fizzbuzz = fb.assuming(15,"FizzBuzz")

buzz = fb.assuming(5, "Buzz")

fizz = fb.assuming(3,"Fizz")

(1..100).each { |i| puts fizzbuzz[i] || fizz[i] || buzz[i] || i }

=end