Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: regex and "Functional Programming"

by hardburn (Abbot)
on Oct 23, 2004 at 13:24 UTC ( #401825=note: print w/replies, xml ) Need Help??

in reply to Re: regex and "Functional Programming"
in thread regex and "Functional Programming"

I should probably be clear that it is very unpractical to force the "no side-effects" rule in the more broad sense - IO is one area where you're more or less forced to have side-effects - though most side effects occur "outside" the program itself - and most functional programming languages support some kind of modifying function calls (you could probably abuse closures if they don't offer any other way).

This, I think, is a great example of theory vs. practice. In a pure-functional language (like Haskell), there is no way to do I/O without learning about Monads. Which means you need to learn about a fairly advanced functional programming concept just to read data from a file. In a language without this theoretical purity, basic I/O is covered within the first few chapters, and then you move along.

Forcing learning of advanced concepts for simple and common tasks is bad Huffman coding.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

  • Comment on Re^2: regex and "Functional Programming"

Replies are listed 'Best First'.
Re^3: regex and "Functional Programming"
by Jenda (Abbot) on Oct 23, 2004 at 21:11 UTC

    Clean is pure and doesn't use monads. They use so called "uniqueness typing". You basicaly pass along the "world" or some part of it and the type system makes sure you do not try to "clone" the world. That is you may only do one thing to the world you have, by which you create a new world and then you make another change to the new world and so on. I haven't written anything with the monads so I can't really say, but this looks to me a bit easier to understand and use.

    I don't think whether the books start with explaining how to print hello world or how to compute this or that is that important. Yes it's easier to impress the girls with something that displays a nice moving graphic than with a complex and elegant computation, but we are not in programming to impress girls are we. We'd be playing football (the europeans would play the game in which you kick the ball around all the time, americans the one in which you barely ever touch the ball with your foot. Whatever.) if that was what we were after.

    A more important reason why functional languages are not used more videly is that they usualy miss useable libraries. Let's see how the implementation that do interface with the .Net world will be doing. (Not that I would mean that the .Net framework library is too useable. But still better than nothing.)

    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

Re^3: regex and "Functional Programming"
by FoxtrotUniform (Prior) on Oct 23, 2004 at 21:22 UTC

    In defense of Haskell, you don't need to know a lot about monads to do I/O, sorta like how you don't need to know a lot about streams to do I/O in C++. Of course, Haskell's type system makes it hard to ignore the IO monad, and eventually you're going to run into trouble if you try to obstinately ignore monads, but you're hardly forced to grok monads in fullness just to write "Hello, world!" to the screen.

    Yours in pedantry,
    F o x t r o t U n i f o r m

    "Lines of code don't matter as long as I'm not writing them." -- merlyn

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://401825]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-04-22 15:34 GMT
Find Nodes?
    Voting Booth?