A Ruby WishList

Mauricio Fernández [batsman.geo@yahoo.com]:

//I tried to post a comment on your site but I keep getting
//Server Error in ‘/’ Application.
Oh, did you face a problem? I just tried, things seem fine now - don’t know what it was.

//You can find a lot of postings about ++ and – in ruby-talk,
//so I’m not going to repeat that here. As for +=, once you
//define + you get += for free, and a += b will always mean a
//= a + b. Same with other OP= things.
Sorry about mentioning +=, that was stupid of me.

//I rather like the fact that blocks can be spotted easily at
//the moment.
Hmm… I did not think of it that way. Spotting code blocks easily, so a different syntax… Well you may have a vague point there. I’d stil like to see the braces. But yeah that’s a feature I could live without too. But a ‘}’ is a lot easier to type than a ‘end’.

//In Ruby 2.0, you’ll be able to do
//10.times{|n| (sum ||= 0) += n }
//puts “Sum is #{sum}”
//due to the new rules for block variables.
//
//as for
//> 10.times{|n| sum<0> += n; prod<1> *= n; }
//there’s no need to import clumsy syntax into Ruby IMHO.

Mmm. I have read specs for 2.0 yet that explain what ‘10.times{|n| (sum ||= 0) += n }’ could mean. Looks a lot like ‘sum<0> += n’ to me. Could you drop me a urls to the specs?

//> Currying of Methods and Partial Evaluations
//
//>> add = lambda{|x,y| x + y }
//=> #Proc:0x401fb358@:1(irb)
//>> def curry(proc, *args); lambda{|a| proc.call((args+a))} end
//=> nil
//>> add10 = curry(add, 10); add2 = curry(add, 2)
//=> #Proc:0x401f5a0c@:2(irb)
//>> add10[1]
//=> 11
//>> add2[1]
//=> 3
//
//This could be done on methods too (without having to reify them with
//method(:meth)) if parens. were needed (as in Python) to actually
//do the method call. See
//http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc.

Neat. Very impressive. Thank you.
I would actually like to add this to my comments for later reference.

InterScan_Disclaimer.txt (520 Bytes)