in reply to When would you use functional programming?

While I share your fascination with functional programming, I can't help getting the feeling like I'm watching an episode of MacGyver. You know, like how he takes a swiss army knife and uses it in all these bizarre ways that it was never designed for in order to save the day.

I guess I should add that I get a similar feeling looking at OO Perl code. Maybe I'm just an ol' fuddy duddy, but for functional stuff, I'll stick to the other Camel.

I'm not just knocking what you are posting. I do think that it's important to push and stretch a langauge to it's limits. It just gives me kind of an oogee feeling watching you do it. It seems so clean and clear in a functional language, and so ugly and warped in Perl.

  • Comment on Re: When would you use functional programming?

Replies are listed 'Best First'.
Re: Re: When would you use functional programming?
by jordanh (Chaplain) on Oct 17, 2002 at 00:00 UTC

    I'm very attracted to Functional Programming also. If I ever get around to it, I plan to introduce my 11 year old daughter to programming via Scheme. But...

    Larry Wall refers to Icon (not a Functional Programming Language - an odd hybrid really between Logic, Functional and Procedural) as a "Cat" language, while Perl is a "Dog" language. I think I agree with that about Icon, and maybe it applies to most Functional languages, as well.

    Like a Cat, they are pretty to look at, nice to have around, but aloof and not practical at all. Dogs are loyal and serve many practical functions.

    Among Functional Languages, I'm very attracted to Scheme. Ovid noted how Functional programming was all about creating definitions and letting them define the solution for you. I like Lisp and Scheme because the language systems have the most direct support for Meta-Programming. There is no distinction between programs and data in these languages, so you can create definitions that create definitions in the most straightforward way possible. This is applicable to generating new language systems and programming paradigms on top of the base system. I've never seen languages where whole object systems and Logic programming systems can be defined in so few lines as you can in Scheme.

    The possibilities are limitless. Scheme has even captured the essence of control structures and goto in a completely functional manner with continuations. It's amazing, heady stuff really.

    I do think it's important to be exposed to this stuff and take away what's good, but I still feel that for much of what I do, Perl will make me more productive. Perhaps I would devote all my hobbyist programming time to Scheme if productivity weren't so important to me. Perhaps not...

    Oh, and check out Icon, too! Look at the 8-queens problem in Icon sometime... wonderful...