Daniel Brockman wrote: >>BTW, change *b to b, in my code. >> >> >Why? > [[1,2,3],[4,5,6],[7,8,9]] * :+ should => [1,2,3,4,5,6,7,8,9] >Random aside: In mathematics, a non-commutable + operator >is pretty damn near unthinkable, wheras in computer science >it's completely normal. I think that's kind of interesting. > > Well, in Ruby it's completely normal. I can't think of any other language that does that by default... One thing that's okay in programming but not in math is that 5/2 == 2. :) >Ah. In light of this thread, I'm actually a little curious >about what other insights one might get from learning APL. > > Not much, I don't think. It's a language whose primary use is processing lists and matrices of numbers, and whose sole focus is absolute terseness at the expense of readability in any sense of the word. But hey, maybe I'm being pessimistic. I shouldn't prevent you from a potential learning experience: http://en.wikipedia.org/wiki/APL_programming_language http://www.thocp.net/software/languages/apl.htm http://www.thefreecountry.com/compilers/apl.shtml http://www.engin.umd.umich.edu/CIS/course.des/cis400/apl/apl.html http://www.users.cloud9.net/~bradmcc/APL.html http://www.acm.org/sigs/sigapl/ My favorite quote from the wikipedia page: "APL is a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums." --Edsger Dijkstra >Nice to see someone else stuffing away those pesky ¡Æend¡Çs >like that. I have my Emacs coloring them really dimly. > > I did that just for you. :) Also because it was an email, and I was going for fewness of lines. >Okay, but with my modified String#gsub, that's better >written like this: <snip> > > True. >Yeah. Having been bitten a few times by the double-aliasing >bug that comes into play when a file that uses the ¡Èalias >and redefine¡É idiom is loaded twice, ... > > I'm eager to see when Behaviors is ready for prime-time. Ruby needs more support for this sort of thing. Also, what do you think of an 'original' keyword for when you redefine a method (assuming that Behaviors solves your loaded-twice problem)? class String def gsub(*a) if a.size == 1 then original else original(a[0]).gsub(a[1..-1]) end end end One could use the original keyword like one uses the super keyword. Devin