Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Functional languages WTF?

Name: Anonymous 2009-12-13 8:21

Take a look at this: http://www.fsharp.it/2009/08/26/functional-programming-interview-question/

Now, this is screaming  for an imperative implementation. Doing it in the functional way is not only more difficult, but yields a shittier solution, since the function is not tail recursive, so on large inputs it will result in stack overflow.

I know that in F# you can go on the imperative way too. But there are purely functional languages where you can't. So what is the benefit of using the functional paradigm in this case?

Also if we use local variables and not modifying state outside of our function, how the fuck does that hinder us in parallelism?

So does using recursion everywhere have a real benefit, or is it just unnecessary pretentiousness?

Name: Anonymous 2009-12-13 8:29

BB
CO
EDS

Name: Anonymous 2009-12-13 8:33

>>1
5/10. Will rage again, bro

Name: Anonymous 2009-12-13 8:34

unnecessary pretentiousness
exactly

Name: Anonymous 2009-12-13 8:35

Name: Anonymous 2009-12-13 8:37

unnecessary pretentiousness
You have your answer right there. Use the right tool for the job, etc.

Name: Anonymous 2009-12-13 8:37

since the function is not tail recursive,
Looks tail recursive to me

Name: Anonymous 2009-12-13 8:44

>>1
You're forgetting that purely functional languages have workarounds for performing imperative tasks.

>>2
BB
CO
EDS

Name: Anonymous 2009-12-13 8:58

>>8

You're forgetting that purely functional languages have workarounds for performing imperative tasks.

Like monads? I wouldn't call that an easy replacement.

Name: Anonymous 2009-12-13 9:01

>>9
I'm not sure about F#, but Haskell's IO is pretty simple. You probably wouldn't know it was monadic, if you hadn't been told already. This assumes do notation as opposed to using >>=,etc

>>1
I'd have build up a list of strings tagged with their types instead of building two lists simultaneously, but otherwise my solution would be much the same.

Name: Anonymous 2009-12-13 9:01

>>9
he finds monads hard

Name: Anonymous 2009-12-13 9:24

>>11
I'm an expert c programmer. I don't even know what a monad is

Name: Anonymous 2009-12-13 9:29

>>12
That is hardly surprising

Name: Anonymous 2009-12-13 9:30

>>13
If I'd ever needed them in 7 years of professional development I would have learnt them

Name: Anonymous 2009-12-13 9:32

expert c programmer
You cannot call yourself "expert" and be limited to a single language, Mr Blub Programmmer. Please leave /prog/ and crawl back to the frozen void where you obviously came from.

Name: Anonymous 2009-12-13 9:43

>>15
well i know ruby and bash too. and have used vb.net at work LooL.

Name: sage 2009-12-13 10:13

>>16
ruby
vb.net
LooL
9/10 very good

Name: Anonymous 2012-03-07 18:10

Your gloves have 289 charges left.

Name: Anonymous 2012-03-07 18:22

if you want tco, then use python, ``faggot''

real men use loops

Name: Anonymous 2012-03-07 18:56

I know a bit of F# and ihbt the implementation was obvious to me the moment I was finished reading the problem description. Their implementation isn't as clear as what I had in mind, like >>10 I was thinking type tags.

I'd probably go even farther and emit a closure on seeing ANIMALS or NUMBERS to append to the proper list. It keeps state-dependent code near the logic and avoids redundancies.

Name: Anonymous 2012-03-07 19:20

>>22
Functional doubles WTF?

Name: Anonymous 2012-03-07 19:24

Name: Anonymous 2012-03-07 19:46

>>5

AnonymousFeb 10, 2009 07:18 PM

method overloading
scoping operator
etc.
Back to C++, please

oh /prog/, how I love you.

Name: Anonymous 2012-03-07 22:18


let it be =
    let it be =
        let it be =
            let rec it be =
                | "wistful" -> "words of wisdom"
                | "let" -> it be

Name: Anonymous 2012-03-07 23:39

>>19

Pikachu is confused! Pikachu hurt itself in confusion!

>>1

hint, the implicit parallelism can take place within the scope of a single function.

Name: Anonymous 2012-03-07 23:54

>>8
u mean
BB
CO
EDS

Name: Anonymous 2012-03-08 0:07

CO BB EDS

Name: Anonymous 2012-03-08 5:27

>>25
Except that implicit parallelism in Haskell still doesn't work.

Hint: after 10 years of research, 20 broken toy implementations and around 200 papers, Simon Python Jones will finally implement a solution that will add exponential overhead due to scheduling.
Enjoy!

Name: Anonymous 2012-03-14 17:01

How can I have state without state? Not trolling, just curious?

Don't change these.
Name: Email:
Entire Thread Thread List