[Haskell-beginners] Haskell as a useful practical 'tool' for intelligent non-programmers

Michael Orlitzky michael at orlitzky.com
Sun Apr 29 07:20:22 CEST 2012

On 04/29/2012 12:15 AM, Mike Meyer wrote:
> On Sat, 28 Apr 2012 22:22:34 -0400
> Michael Orlitzky <michael at orlitzky.com> wrote:
>> On 04/28/2012 08:47 PM, Mike Meyer wrote:
>>> Ruby makes a bad fit if Haskell is a goal (and that's a good
>>> goal). Ruby functions aren't first-class objects, and can't simply be
>>> passed to other functions as arguments.
>> That's like, the least true thing you can say about Ruby =)
> I respectfully disagree. For instance, I could have said that it uses
> indentation to delimit blocks like ABC does. That's much less true.
> But I believe the statement about functions not being first class
> objects is true. Of course, I don't use ruby on a regular basis
> because that turns out to be the case every time I go look at it. If
> the language has changed so this can be done in a manner that's as
> straightforward as Python, I'd be interested in hearing about it.

They're wrapped in Proc objects, but those objects can be treated like
any other in the language. Everything else is just syntactic sugar on
top of Procs.

This is not conceptually any different to me than in Haskell or C; you
have a name for the thing, distinct from the thing itself, and you have
to ask for function application via (f x), f(x), f.call(x), or whatever.

(The Proc/def syntax disconnect is annoying, and apparently error-prone.
You can call a Proc with p[x] but not if you def'd it!)

> And that would do it, except, as Lyndon explained, it's not doing the
> right thing. You provided one of the workarounds (using Proc) when you
> corrected it.

Hey, it passed all the unit tests =P

More information about the Beginners mailing list