Method_curry

# one method
def convert(to, obj) = ( obj.send(*to) )


# example call
p convert :to_i, '12' #     => 12



# container with partially pre-filled calls (curry) 
cur = Data.define(:to_int, :to_float, :to_string, :bin_to_dec, :dec_to_bin)
  .new(
    method(:convert).curry[:to_i],
    method(:convert).curry[:to_f],
    method(:convert).curry[:to_s],
    method(:convert).curry[[:to_i, 2]],
    method(:convert).curry[[:to_s, 2]]
  )



# all calls to the same one method
p cur.to_int['12.4'] #      => 12
p cur.to_float['12.4'] #    => 12.4
p cur.to_string[3.14] #     => "3.14"

p cur.bin_to_dec['1110'] #  => 14
p cur.dec_to_bin[14] #      => "1110"