Mikael Brockman <phubuh / phubuh.org> wrote in message news:<87d634enff.fsf / phubuh.org>... > To resist succumbing to Layne's law, I'll accept your definition. Wow. That was a reference I had to look up. > So I'd say Ruby is a mostly-object-but-also-functional language. But if > one wants to write Scheme code in Ruby, one is unstoppable. One can > even make it look mostly like regular Ruby code, as long as one *thinks* > functionally. I still don't see how you come to this conclusion. Ruby makes heavy use of side effects, and I'd still suggest that it would be difficult to program functionally in Ruby, using either NIST's or comp.lang.functional's definition of a functional programming language. Out of curiosity, have you programmed functionally in Ruby, or are we discussing abstracts here? I've written a lot of what could be classified as functional programs in Ruby, but they've exclusively been one-liners from the command line, where I'd normally have used sed or awk. Any Ruby program I've ever written that grew to more than a couple of lines (and even many of the one-liners) introduced side-effects -- accumulators, etc -- which are violate the functional programming paradigm. I'm just curious if you've done much of this. > > They're operations on a primitive: a list. A list isn't an object in > > the OO sense. You can call it an object, but it has no behavior, and > > it knows nothing about car and cdr. > > It does have behavior. When I car it, it gives me its first element; The list doesn't give you its first element. car discovers the first element of the list. Saying that a list gives you the first element when you car it is like saying that a painting gives me meaning when I look at it. The painting is ignorant about whether or not it is being observed. And if you take this discussion in a metaphysical direction, then I'm not playing any more. :-) --- SER