From: "James, Roshan (Cognizant)" Date: 2004-04-22T03:54:36+09:00 Subject: Re: A Ruby WishList ------=_NextPartTM-000-8af6bd61-7392-4d31-bb1a-621c098b79ca Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mauricio Fern=E1ndez [batsman.geo@yahoo.com]: //I tried to post a comment on your site but I keep getting=20 //Server Error in '/' Application. Oh, did you face a problem? I just tried, things seem fine now - don't = know what it was.=20 //You can find a lot of postings about ++ and -- in ruby-talk,=20 //so I'm not going to repeat that here. As for +=3D, once you=20 //define + you get +=3D for free, and a +=3D b will *always* mean a=20 //=3D a + b. Same with other OP=3D things. Sorry about mentioning +=3D, that was stupid of me.=20 //I rather like the fact that blocks can be spotted easily at=20 //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'.=20 //In Ruby 2.0, you'll be able to do //10.times{|n| (sum ||=3D 0) +=3D n } //puts "Sum is #{sum}" //due to the new rules for block variables. // //as for=20 //> 10.times{|n| sum<0> +=3D n; prod<1> *=3D 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 = ||=3D 0) +=3D n }' could mean. Looks a lot like 'sum<0> +=3D n' to me. = Could you drop me a urls to the specs? //> Currying of Methods and Partial Evaluations // //>> add =3D lambda{|x,y| x + y } //=3D> # //>> def curry(proc, *args); lambda{|*a| proc.call(*(args+a))} end //=3D> nil //>> add10 =3D curry(add, 10); add2 =3D curry(add, 2) //=3D> # //>> add10[1] //=3D> 11 //>> add2[1] //=3D> 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=20 //do the method call. See=20 //http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc. Neat. Very impressive. Thank you.=20 I would actually like to add this to my comments for later reference.=20 ------=_NextPartTM-000-8af6bd61-7392-4d31-bb1a-621c098b79ca Content-Type: text/plain; name="InterScan_Disclaimer.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="InterScan_Disclaimer.txt" This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com ------=_NextPartTM-000-8af6bd61-7392-4d31-bb1a-621c098b79ca--