tag:blogger.com,1999:blog-178174920347765771.post5126972453166458305..comments2023-10-30T09:20:21.742-07:00Comments on One Div Zero: Erlang is Not FunctionalJames Iryhttp://www.blogger.com/profile/02835376424060382389noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-178174920347765771.post-22657508586189439542011-10-26T18:03:20.274-07:002011-10-26T18:03:20.274-07:00I will suggest that Erlang can do exactly what OCa...I will suggest that Erlang can do exactly what OCaml does though the syntax is not as clean. Here in the Erlang shell<br /><br />X = fun(A, B) -> A + B end.<br />Y = fun(A) -> apply(X, [1, A]) end.<br />Y(2).Ed Schneeflocknoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-33833431716769253632011-07-08T20:56:35.870-07:002011-07-08T20:56:35.870-07:00The history of programming languages without menti...The history of programming languages without mentioning Forth or Mumps, is like the history of breakfast cereals without mentioning Fruit Loops or Chocolate Frosted Sugar Bombs.John Wallingnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-41879849897573291932011-04-13T23:22:09.731-07:002011-04-13T23:22:09.731-07:00This is one of the most important reasons why carr...This is one of the most important reasons why <strong><a href="http://www.wholesalebrandsunglass.com/carrera-sunglasses.html" rel="nofollow">carrera <br /><br />sunglasses</a></strong> are worn and you should never compromise on this aspect of wholesale <a href="http://www.wholesalebrandsunglass.com/cocoons-sunglasses.html" rel="nofollow">Cocoons Sunglasses</a> .Update your looks and transform Asdasdnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-49124727600078642942011-01-28T07:23:49.199-08:002011-01-28T07:23:49.199-08:00Even at the time I wrote this Scala supported curr...Even at the time I wrote this Scala supported curried function definition. It's in my footnote.James Iryhttp://james-iry.blogspot.comnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-62776180902219397352009-09-07T05:40:32.058-07:002009-09-07T05:40:32.058-07:00Brainfuck (http://en.wikipedia.org/wiki/Brainfuck)...Brainfuck (http://en.wikipedia.org/wiki/Brainfuck) is missing!!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-44084508215323609602009-06-20T21:34:08.236-07:002009-06-20T21:34:08.236-07:00There's too much confusion arising
when using ...There's too much confusion arising<br />when using the phrase <br />"language Blah is a functional language". For languages like<br />Scala and for that matter Perl,<br />one should say that they have<br />"functional characteristics" or that<br />they "support functional modes of<br />programming". From what I have seen I would not think that Scala is<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-48380467457049738332009-05-18T23:02:00.000-07:002009-05-18T23:02:00.000-07:00@ Hasan Veldstra : That really has nothing to do w...@ Hasan Veldstra : That really has nothing to do with what we are talking about. No one is arguing that Erlang isn't any good.Jason Dusekhttps://www.blogger.com/profile/15702067426651391511noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-68859506817064348262009-05-16T19:23:00.000-07:002009-05-16T19:23:00.000-07:00@Loup Vaillant
I can't speak for true automatic ...@Loup Vaillant <br /><br />I can't speak for true automatic currying, but some Haskell compilers (e.g. GHC) will do automatic 'uncurrying'. That is, at the level of the compiled code and the runtime, there is a distinction between functions which get one argument at a time vs all (or many) at once, and the compiler will do analysis to try to pick the best representation based on usage.<br /><br /Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-52016045968726425202009-05-16T10:46:00.000-07:002009-05-16T10:46:00.000-07:00"Automatic currying" is a bad name to begin with. ..."Automatic currying" is a bad name to begin with. When they say "X has automatic currying", most people actually mean "X encourages the curried form".<br /><br />In Scala, Erlang, Lisp etc, there is a syntactic burden to write and use function in curried form. In Ocaml, Haskell, Miranda etc, there is a syntactic burden to write functions in <EM>uncurried</EM> form.<br /><br />That's it. Now I Loup Vaillanthttp://theroleplayingprogrammer.blogspot.comnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-82257386546556195332009-05-16T07:48:00.000-07:002009-05-16T07:48:00.000-07:00Just because "a->b->c" and "(...Just because "a->b->c" and "(a,b)->c" are an isomorphism doesn't make them equivalent in Haskell's type system:<br /><br />Prelude> let fadd a b = a + b<br />Prelude> :t fadd<br />fadd :: (Num a) => a -> a -> a<br />Prelude> let tadd (a,b) = a + b<br />Prelude> :t tadd<br />tadd :: (Num t) => (t, t) -> t<br /><br />It seems a little Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-22551294899751530702009-05-16T05:45:00.000-07:002009-05-16T05:45:00.000-07:00Fischer confusion obviously comes from the fact th...Fischer confusion obviously comes from the fact that those languages aren't purely functional, they aren't even functional. They merely offer some degree(some more, some less) of support for FP paradigm. <br /><br />Several languages like Scala, Erlang, Groovy, Ruby and even Java have some support for Functional Programming. That does not make those languages functional like Haskell or Miranda. <Monoidusnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-3034879498043684252009-05-15T19:49:00.000-07:002009-05-15T19:49:00.000-07:00Whether Erlang is functional or not never mattered...Whether Erlang is functional or not never mattered. It's pragmatic first and foremost.<br /><br />http://12monkeys.co.uk/2009/05/16/erlang-is-pragmatic.htmlUnknownhttps://www.blogger.com/profile/08542205040681097180noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-34876348718291648032009-05-15T14:15:00.000-07:002009-05-15T14:15:00.000-07:00Good rebuttals, James. By these criteria, you ...Good rebuttals, James. By these criteria, you could argue that C is a functional language as well.<br /><br />So what is a functional versus imperative language? I don't think that <I>languages</I> can really be so classified, rather, only specific <I>programs</I> are functional or imperative.<br /><br />In my view, functional means an avoidance of side effects, as evidenced by the termLeon P Smithhttp://blog.melding-monads.comnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-5594869097765934912009-05-15T12:10:00.000-07:002009-05-15T12:10:00.000-07:00Erlang supports currying via anonymous functions/c...Erlang supports currying via anonymous functions/closures. For the shell:<br /><br />1> F = fun(A) -> fun(B) -> A + B end end.<br />2> F1 = F(1).<br />3> F1(2).<br />3<br /><br />The problem with Erlang though is mainly syntactic:<br />4> F(1)(2).<br />* 1: syntax error before: '('<br />4> (F(1))(2).<br />3<br /><br />There would be some problems by having automatic MononcQchttps://www.blogger.com/profile/09399002406489554558noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-28055026306597965782009-05-15T11:43:00.000-07:002009-05-15T11:43:00.000-07:00Pure Lisp is functional, but Common Lisp is not; n...Pure Lisp is functional, but Common Lisp is not; neither is Scheme. <br /><br />I understand your post, and I agree with most of it. I don't understand how the definition of "functional language" has changed so much over time to include features. Functional programming isn't about features, but the lack there-of, and what that adds (more is less).<br /><br />A functional language amounts to a Jeffrey Massunghttps://www.blogger.com/profile/04030428048626948495noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-34037520632695599232009-05-15T11:42:00.000-07:002009-05-15T11:42:00.000-07:00I can's speak for Clojure or Arc, but Common Lisp ...I can's speak for Clojure or Arc, but Common Lisp and Scheme are not functional languages in that both celebrate programming by side-effect.<br /><br />Sure, both CL and Scheme have <I>first-class functions</I>, but isn't referential transparency an important characteristic of functional languages?Reginald Braithwaitehttps://www.blogger.com/profile/13132345822387028437noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-88467266535588685092009-05-15T11:07:00.000-07:002009-05-15T11:07:00.000-07:00heh. I'm not trying to repeat sigfpe. He and I ...heh. I'm not trying to repeat sigfpe. He and I were typing at the same time.James Iryhttps://www.blogger.com/profile/02835376424060382389noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-74663790543738544502009-05-15T10:51:00.000-07:002009-05-15T10:51:00.000-07:00@Robert,
How can "a->b->c" and &q...@Robert,<br /><br />How can "a->b->c" and "(a,b)->c" be "wildly different" when currying and uncurrying create the well known isomorphism between the two. Here in Haskell because I don't know OCaml:<br /><br />curry :: ((a, b) -> c) -> a -> b -> c<br />curry f x y = f (x,y)<br /><br />uncurry :: (a -> b -> c) -> (a, b) -> c<br />James Iryhttps://www.blogger.com/profile/02835376424060382389noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-9643371903481619872009-05-15T10:47:00.000-07:002009-05-15T10:47:00.000-07:00The types a -> b -> c and (a,b) -> c are ...The types a -> b -> c and (a,b) -> c are isomorphic. Because of this you can write functions either way. It's purely a convention in Haskell that most people write functions in the former way. Despite what many people claim, there's no automatic currying in Haskell. The situation is the same in Scala and Haskell. You can write curried functions or uncurried functions in both.sigfpehttps://www.blogger.com/profile/08096190433222340957noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-32800231909529989632009-05-15T10:05:00.000-07:002009-05-15T10:05:00.000-07:00I've addressed these issues in the comment to ...I've addressed these issues in the comment to my post. In particular, the partial function application and the distinction between a singleton object and a module are more problematic than you're selling here.<br /><br />Maybe if I learned Erlang, I'd have a similar thing to say about it. Or maybe not. I don't know: I've never actually used it.<br /><br />Haskell and OCaml,Robert Fischerhttps://www.blogger.com/profile/15576124960718643532noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-21932396066959741062009-05-15T09:36:00.000-07:002009-05-15T09:36:00.000-07:00Haskell and OCaml are little different to Scala wr...Haskell and OCaml are little different to Scala wrt currying. There is no automatic currying in Haskell, merely a convention that we write functions of type a -> b -> c instead of (a,b) -> c. We can get the same error in Haskell by writing<br /><br />> f (a,b) = a+b<br />> f (1)<br /><br />The way you make this work in Scala is the same way you make it work in Haskell - you showed sigfpehttps://www.blogger.com/profile/08096190433222340957noreply@blogger.com