On 2004-04-02 16:44:20 +0900, Mark Hubbart wrote:
>   def combine_blocks(one, two)
>     Proc.new{|*args| one[ two[*args] ] }
>   end
>
> this returns a new block that combines the two blocks passed.

I once played around with this:

class Proc

    def compose(other)
        lambda { |*args| call(*other.call(*args)) }
    end

    alias :* :compose

    def curry(*my_args)
        lambda { |*args| call(*(my_args + args)) }
    end

    alias :+ :curry

    def rcurry(*my_args)
        lambda { |*args| call(*(args + my_args)) }
    end

    alias :- :rcurry

end

f = lambda { |x, y| x + y }
g = lambda { |x| 2 * x }
h = g * f
h[1, 2]   # => 6
i = h + 1
i[2]      # => 6
j = h + 2
j[]       # => 6

It doesn't look much different than ML or Haskell modulo dynamic typing.

> >Yes, Ruby and Python are not all that different. I guess most Ruby
> >fanatics
> There's only one fanatic plainly visible here...

I wonder why they always come here?

> I think I caught a whiff of elitism there... Perhaps Pythoners would be 
> happy with a forked version of Ruby? I doubt it. And I doubt that 
> Rubyists want a forked version of Python.

Perhaps he has read Bruce Eckel's half-hour-reading-in-the-bookstore
language critic of Ruby: "a bad ripoff of Python". Somehow it has
vanished from his website, though. At least we got this wonderful
response of Matz out of it:

"Many people think Riding motorcycle isn't worth learning.  They feel
motorcycle are bad ripoff of cars (because of fewer tires).  But others
don't agree."

-- 
#!/bin/sh
# Hello! I'm a signature virus! Execute me and watch me spread!
s=.signature; cat $0 >/tmp/$s && mv /tmp/$s $s && chmod a+x $s