Hmmm…I meant for all those “end.call(&meth do”'s to be “end.call
&(meth do”. Interesting it still works.
----- Original Message ----
From: James K. [email protected]
To: [email protected]
Sent: Sunday, March 2, 2008 8:31:55 PM
Subject: [SOLUTION] [QUIZ] Hello, world? (#158)
module Kernel
def meth(&block)
o=Object.new
o.instance_variable_set(:@block,block)
def o.__call(&b)
@block2=b
instance_eval &@block
end
def o.yiel
@block2.call
end
o.method(:__call)
end
end
meth do
yiel
puts “!”
end.call &(meth do
proc do
yiel
print “d”
end
end.call(&meth do
proc do
yiel
print “l”
end
end.call(&meth do
proc do
yiel
print “r”
end
end.call(&meth do
proc do
yiel
print “o”
end
end.call(&meth do
proc do
yiel
print “w”
end
end.call(&meth do
proc do
yiel
print " "
end
end.call(&meth do
proc do
yiel
print “,”
end
end.call(&meth do
proc do
yiel
print “o”
end
end.call(&meth do
proc do
yiel
print “l”
end
end.call(&meth do
proc do
yiel
print “l”
end
end.call(&meth do
proc do
yiel
print “e”
end
end.call(&meth do
print “H”
end))))))))))))
I couldn’t find a way to truly make blocks accept blocks. Anyone have
anything better than my close substitute?
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ