Hacker News new | past | comments | ask | show | jobs | submit login
A Week with Elixir (joearms.github.io)
204 points by gluegadget on May 31, 2013 | hide | past | favorite | 86 comments



I was quite surprised by how amicable and positive this blog post was; I expected him to have lots of objections. It's admirable that an old hand like Joe Armstrong can be so open and accepting of something that essentially sets out to improve on his lifework.

In fact, if you look at his paper on the development of Erlang [1] while at Ericsson, which is coincidentally a juicy, fascinating read, Armstrong is being very forthcoming about the struggle to develop the language, in particular developing a good syntax, and also very forthcoming about the involved parties' lack of experience with language design; in particular, the Prolog-like syntax seems less of a planned decision than a side-effect of the first implementations being written in Prolog itself, and following the path of least resistance. Also, it worked.

At any rate; it seems clear to me that Armstrong values the principles behind Erlang's design (concurrency, immutability, fault tolerance and so on) more than the actual syntax. I wonder, at this point, how amenable he would be to larger syntax changes to Erlang itself, or if he is happy with the fact that Elixir is a completely separate project.

(There is something weird about the effusive tone and surreal humour in the blog post, though. Is this his new "Erlang evangelist voice", or has he always been writing in this way?)

[1] https://docs.google.com/viewer?url=http%3A%2F%2Fwebcem01.cem...


He really doesn't care: http://erlang.org/pipermail/erlang-questions/2013-January/07...

  "Today there is an unhealthy concentration on language and 
  efficiency and NOT on how things fit together and 
  protocols - teach protocols and not languages.
  
  And teach ALGORITHMS."
(previous HN https://news.ycombinator.com/item?id=5109052)


I started working with Erlang for work, on and off, for the past year. I had been working with Ruby for a lot longer. I too, liked the Erlang design, but the syntax is a wreck. It's also true, use something long enough and you get used to it. I've noticed long-time Erlang users tend to have this mystical ability to see the underlying elegance expressed by the Erlang syntax while ignoring the syntactic awkwardness.

Elixir brings a lot of good stuff onto the table. I hope the Elixir community incorporates the changes Joe Armstrong suggests.

One in particular: f.() makes perfect sense in the Ruby world because everything is an object (we're sending the '()' message to the 'f' object); but things are built out of functions in the Erlang world, and f() makes more sense there. There are no objects or messages to send them, so 'f.()' gets parsed as an extra dot at the end of the name. I think Armstrong's other suggestions follow in the same vein.

The point isn't to try to make Elixir have a Ruby-like syntax so much as, having distilled the syntax design principles developed in the Ruby community, apply it in Elixir.


"I've noticed long-time Erlang users tend to have this mystical ability to see the underlying elegance expressed by the Erlang syntax while ignoring the syntactic awkwardness."

It's just practice. It no longer trips me up, but I still find it klunky and unpleasant after nigh on 6 years of medium-duty usage.

    lists:map(fun (X) -> X + 1 end, [1, 2])
vs.

    map (+1) [1, 2]
Augh. Yes, I'm cheating perhaps a bit with the (+1), but Erlang syntax has enough other stuff in the way for it to still be fair in the end. For instance, the example Joe gave, where you end up with this long sequence of

    IdentifierA = operationA(ArgA),
    IdentifierB = operationB(IdentifierA, Something),
    ...


"Ant turd tokens", or .,; are a big pain in the neck when refactoring stuff. For instance

    case Something of
       {ok, Val} ->
          do_something();
       _Error ->
          barf()
    end,
The ; and the , are easy to forget about. Indeed, the , might be changed to a . if you eliminate the next expression, and those things can be easy to miss when fiddling with code.


[ fun(N) -> N + 1 end || N <- [1,2] ]


That will produce a list of 2 funs. I think you meant:

    [ N + 1 || N <- [1,2] ].


I picked that as a simple example. Yes, I suppose I should have used a fold, or any of the other "everything else" functions that don't have syntax support. My point still stands.


Comparing Haskell and Erlang syntax isn't even fair. Haskell threw homoiconicity and homogeneity way out the window in exchange for some very nice, mathematical notation.


Erlang is hardly homoiconic, unless you mean Lisp-Flavoured Erlang.


No, it's not. I wasn't being precise. I believe Erlang to have a less complex syntax than Haskell, though, being based on Prolog.


You need to understand that fundamentally Joe Armstrong is 'a good egg'.

No higher praise is there, in my book...


A precursor to Elixir, Reia, got me interested in Erlang. After having written Erlang for a little while now, I'm not sure of the benefits of a language like Elixir or Reia anymore (which seem mostly focused on improving syntax). Sure, Erlang syntax is odd starting out, but you get over that very quickly.

I can't help but compare it to CoffeeScript. Sure, CoffeeScript papers over some inconveniences of JavaScript, but at the end of the day I find myself writing JavaScript in a disciplined way instead of reaching for yet another abstraction. I realize it's not a good comparison as CoffeeScript compiles to JS while Elixir and Erlang both compile to a shared VM (BEAM), but I don't think Elixir has added enough new ideas to warrant focusing on it in favor of Erlang, yet (for me at least). That may change in time.


As a professional Erlang developer who now develops with Elixir, I need to stop this right here. This is NOT just about syntax. Elixir simply is not just a pretty face for Erlang, but enables metaprogramming that is simply NOT possible in Erlang without writing 10x more code. Elixir comes with it's own standard library, HashDict, Reducers, and more and more. I'll have to write another blog post, because this misconception that Elixir is just a prettier syntax is somehow still around.


I apologize for my misconceptions and I would really enjoy reading such a blog post. Do you have an address or RSS feed I could check in at later? At the risk of making another bad estimation, I still feel like (at this point in time anyway) you still need to know Erlang and OTP to understand and appreciate Elixir.

As an aside, have you seen Joxa? It's a LISP for the Erlang VM. I'm really not trying to be a downer about this, I think it's great that the Erlang VM is having these new languages pop up and José Valim is one of my favorite Ruby programmers, so I have high hopes for Elixir. I hope after I get better at Erlang I can revisit Elixir and appreciate the things you are talking about.


I'll begin writing it this weekend and publish it to my blog next week: http://devintorr.es/ (Atom feed: http://devintorr.es/atom.xml)


You should link to it on your profile: https://news.ycombinator.com/user?id=devinus



So exactly like Coffee - it enables you to do class-based inheritance and mixins which is NOT possible in JavaScript... without writing 10x more code.

Standard library of Elixir should be available to pure Erlang too, right? From what I recall from interoperability docs.

Could you post a tiny little example of metaprogramming in Elixir that would appeal to quite experienced Erlang developer who knows about parse transforms? I am NOT dismissing Elixir, I know too little about it and I want to finally learn about some feature that would convince me to learn some Elixir.


1) Do you also think of e.g. Scala as the CoffeeScript of Java? Scala : Java :: Elixir : Erlang

2) Yes, interoperability is there and, just like you can use Scala libraries from Java, you just need the Elixir runtime in your path.

3) My favorite is from the String.Unicode module:

    defmodule String.Unicode do
      # ...

      def upcase(""), do: ""

      lc { codepoint, upper, _lower, _title } inlist codes, upper && upper != codepoint do
        def upcase(unquote(codepoint) <> rest) do
          unquote(upper) <> upcase(rest)
        end
      end

      def upcase(<< char, rest :: binary >>) do
        << char >> <> upcase(rest)
      end

      # ...
    end


Ok, I'm almost convinced - at least I'll give Elixir a try after I finish with Joxa. Any tips for someone who would like to learn Elixir fast? Is the "Getting Started" on Elixir page OK or should I search somewhere else?

As for Scala and CoffeeScript... well, that's a tough one. On some level they are very similar, but the differences are huge. I'd say they both, and Elixir, are in the same class of things with CS being on the lower level than Scala and Elixir.


Yes, the Getting Started guide is great. There is also Dave's book[1] and many talks done by José and Yurii[2].

[1]: http://pragprog.com/book/elixir/programming-elixir [2]: http://www.youtube.com/watch?v=m32CGvzixrQ


Introducing Elixir by Simon St Laurent is coming out soon. I read a pre-release version and it is exactly what you want.


Its all about the macros, man. If you are familiar with Erlang and gen_server, then perhaps looking at the examples in the readme of Exactor (https://github.com/sasa1977/exactor) will be enlightening to you. It presents a very straightforward DSL for defining gen_servers plus function wrappers in a very small amount of code with little boilerplate and repetition. There are other great libraries that make excellent use of macros, I just think this one makes this point really well.


It depends if that newer syntax allows you to handle more things at the same time. Without explicitly measuring and mentioning it that's what these super-set languages are trying to do I think.

With CoffeeScript I always end up translating to JavaScript into my head so cognitively it's more effort for me. Another JavaScript super-set might liberate me from thinking of otherwise trivial things and leave more room for planning or "registry" access.


It was very enlightening to see one guy who created a language go over someone else's language. The point about versioning source code files is interesting: you can tell Joe would like to be able to make some changes to Erlang itself without worrying about all those lines of code out there in mission critical deployments. Great read, in any case, for anyone interesting in language design.


I like the way it's done in Clojure, where Leiningen projects declare Clojure itself as a dependency, with an explicit version.


Also not sure I like the idea of ​​having it for the. Besides the extra work of maintaining it may imply, I believe that leaving it in the hands of the isolation system dependencies over worked.


The package manager I work on for Dart supports something similar: a package can which version(s) of the Dart SDK itself that it works with.


But it's odd that he brings up XML specifically, and lays so much praise on its designers, given that XML versioning has not mattered much since its inception. Most people still happily use 1.0, where the version declaration is optional.


I generally like Elixir approach, but find that in many cases it's more verbose than standard Erlang syntax.

I like Erlang way of using lowercase for atoms and uppercase for variables, in Elixir they use ':' sigil to denote atoms like in Ruby, this makes code much more verbose, since atoms are widespread in Erlang and also used for module names.

Elixir should take good parts of Ruby, not sigils, which are inherited from Perl. They are the reason I dislike Ruby's internal DSLs, b/c they are not English, but English with sigils.

If possible I would get rid of commas, I.e. [1 2 3] instead of [1,2,3] .

I agree about f.() being ugly. if function names were lowercase and variables uppercase - there would be no need to introduce new fun call syntax.

Also agree about docstrings moved inside the functions (like in Python and Clojure). Same apply to dialyzer typespecs.

I think single assignment should be default, but there are should be way to explicitly override it, i.e.:

    a = 1
    a = 2   - bad match, but
    'a = 2  - ok


You can explicitly override multiple assignment in elixir by using a carat:

    a = 1  
    ^a = 1  - ok
    ^a = 2  - bad match


I know, what I said is that multiple assignment should be explicit, when single assignment should be default. I.e. the reverse of what is in Elixr.


This is great timing. We just recorded a two hour Intro to Elixir with its creator Jose Valim. We'll be publishing it in June at https://peepcode.com

I think it will be a good companion to the books from Pragmatic Programmers and O'Reilly. Jose works through a real-world project. You can see how he writes code with Elixir, uses metaprogramming, converts code to run concurrently, etc.

I was impressed with the syntactical consistency that makes more sense than Ruby, such as putting "do" after "def". You can write native-looking structures in Elixir that wouldn't be possible in Ruby (such as an if-then).


Very good, it's great to see Elixir is aligned with what Joe's vision of good practice and how things should evolve. This can be the start of something that will help both sides, we will follow what will happen.


As someone who ever wanted to learn erlang but didn't like the syntax, i'm hoping elixir will do it easy for "non-functional" programmes to enter the world of erlang.


Erlang's syntax has little to do with its functional paradigm - you should just bite the bullet and learn functional programming if syntax is what you're worried about.

If you are irritated by the idea/syntax implementation of pattern matching, folds/unfolds, recursion, immutability, function guards, partial function application, function currying, and higher-order functions then you won't enjoy any language that has as its basis, the functional paradigm.

Once you grok the functional idioms used in Erlang, the syntax becomes "not that bad". Granted Elixir is great, its meta-programming features are awesome, but it doesn't "get rid of that yucky functional programming stuff" (which I don't think is yucky at all, after Haskell I can't think in anything BUT the functional paradigm).


I know, i know. But i have to admit that elixir looks "nicer" to me. Whatever that means...


Well yes. Beauty is often in the eye of the beholder :) If you learn Erlang and understand it I think you would actually grow an appreciation for the why and how of its syntax. It's definitely an acquired taste.

I'm also one of those people that think homoiconicity and sexps are beautiful...


I love visually distinct/suggestive operators so long as they're easy to type on a standard layout. So for that reason alone I agree that a ! b is better than a <- b

With many punctuation infix operators (see Scala for an extreme case) people who don't use the language won't understand the code, and you'll have to use an appropriate search engine or emacs mode to look up docs, but it's worth it for what you get in exchange.

It would be nice for the community to standardize on unicode glyphs for enhanced visual representation of ascii-art operators like |> <- etc. (so that online syntax highlighters / code review / diff interfaces show the same as your editor). Pretty glyphs instead of mere ASCII could really help readers (the source code should still be ASCII).


Every time I see "Elixir" used in reference to software I'm reminded of Xerox' Elixir circa 1993, when I was forced to learn how to use the proprietary interface - this was before Windows support had been integrated.

http://www.outputlinks.com/html/people/Entrepreneurial_Spiri...

http://www.xerox.com/digital-printing/workflow/printing-soft...

We used Xerox Elixir to typeset forms pre-press for a Xerox DocuTech.


Lets hope that more of these changes make it upstream or that they modify the vm to make it easier for other languages to work on the erlang vm. Erlang has lots of potential but lots of people get scared away from the syntax and other oddities.


Joe's points are really good. This drives me crazy in Elixir:

iex(1)> f = fn x -> x + 1 end

#Function<erl_eval.6.82930912>

iex(2)> f()

(UndefinedFunctionError) undefined function(stack trace trimmed...)

iex(2)> f.(1)

2


https://groups.google.com/forum/?fromgroups#!topic/elixir-la...

This was José Valim's rationale on the mailing list. Once you understand what's involved, f.() begins to look like a pretty good compromise.


That kind of variable shadowing is a smell. The compiler should warn about it, and/or re-bind the local method as expected (possibly shooting programmer in the foot, but hey... that's why it's a smell, Don't Do It). Forcing an inconsistent syntax to handle one corner case seems like another smell in itself.


Personally I would rather leave the syntax disambiguation to the programmer when relevant, rather than enforcing a single, awkward-looking syntax for all cases.


Its true, but Joe is also correct that this is going to be something people complain about for decades.


see also the discussion on lambda the ultimate http://lambda-the-ultimate.org/node/4754


Gut feeling precedes logic. I know when things are right, I don’t know how or why I know, but the explanation of why things are right often comes weeks or years later. Malcolm Gladwell in his book Blink: The Power of Thinking Without Thinking talks about this. Experts in a particular field can often instantly know that something is right, but they can’t explain why.

Funny, no one talks about the other phenomenon. The one where experts think things are right and then they turn out not to have been. I guess that phenomenon just isn't as interesting.

http://en.wikipedia.org/wiki/Confirmation_bias http://en.wikipedia.org/wiki/Cherry_picking_(fallacy)


Really? I hear about confirmation bias and cherry-picking far more often than I do about expert intuition. I don't even know what the common name is for the latter phenomenon.


I think you missed the point. I wasn't offering confirmation bias+cherry-picking as an interesting phenomenon alongside "expert intuition." I was suggesting that the latter is nothing more than a manifestation of the former.


Makes me cringe to hear someone say `|>` is the `pipe operator`.

If you're thinking operators your probably doing it wrong in functional programming.

It's simply another higher-order function that enables function composition. g |> f = λx → f (g (x))

edit: My reasoning might be really flawed as I have no idea if erlang/elixr can define functions that look like `operators` and therefore don't know if `|>` is built in. Yet, you shouldn't assume |> is some magical thing, but respect it as a higher-order function in my opinion.


The word "operator" need not imply "a built-in construct"; instead it's often used to describe a name made up of symbols, which is how it appears to be used here. In F#, for instance, where |> is used frequently because it improves type inference, it is defined in the standard library as `let (|>) x f = f x` (note that the definition you give is actually for the related (>>) operator). Would you claim that someone is "doing it wrong" because they call (+) the "addition operator"?


ye you're right. (|>) = flip ($) now I come to think of it.


> If you're thinking operators your probably doing it wrong in functional programming.

I'm sorry but that simply makes no sense. Yes, many FP languages have custom & customizable operators. They still have built-in operators which are actual operators for real. And there are also FP languages which do not have custom & customizable operators. Erlang is one of the latter.

> My reasoning might be really flawed as I have no idea if erlang/elixr can define functions that look like `operators`

It can not.


> If you're thinking operators your probably doing it wrong in functional programming.

Stating that the creator of Erlang is doing FP wrong is a bold statement.


Two points:

* Erlang, nor Elixir, has currying. And they can't define their own infix identifiers/operators. This severely limits the way the language works, and you need built in support. * the |> notion is not even a higher-order combinator in Elixir. It is a special-case built-in you cannot redefine.

I agree with you that this is a bad design decision if you are to evolve the Erlang language :P


You're probably the only one who got my point. That's not because others were stupid, but because of my horrible formulation.


Elixir does have currying/partial application.

I can say:

plus_one = &1 + 1

Enum.map [1,2,3], plus_one


Partial application and currying are not the same thing. (That's not a value judgment, they're just different things.) That's partial application.


> Makes me cringe to hear someone say

Do you have an inkling of who the 'someone' is in this case?

Let me help you, in case you don't:

http://en.wikipedia.org/wiki/Joe_Armstrong_%28programming%29


I'm not going to change the way I speak based on who I am speaking to. fine, accuse me of speaking wrongly by telling me why and i'll accept it. I made a bit of a bold statement, an I appreciate people correcting me appropiatly by giving me valid reasons why my statement is wrong. But basing your argument on an appeal to authority is just a logical falacy and is annoying.


> But basing your argument on an appeal to authority is just a logical falacy(sic) and is annoying.

But you are also making statements full of adjectives and subjective descriptions such "makes me cringe" and "probably doing it wrong". That is quite a bit of flair for someone expecting logical and nice refutation of their own statements.

If you jump in the middle of the discussion, throwing around "you're wrong, you're wrong, you're wrong" at everyone then don't be surprised you get replies that are equally accusatory and harsh.

BTW I still don't see what is really so cringe-worthy in calling it an operator. It is just syntactic sugar. Call it green tomatoes if you want. Joe calls it an operator. I understand what Joe means. It is like yelling at someone talking about function default arguments and saying "ha! bit it is all assembler underneath, all this is wrong, it is just registers and pointers!".


And when someone says that the original author of Erlang is speaking wrong about a basic mechanism of... Erlang, I don't think there's going to be many objective responses, probably more pointing and laughing.


It's not a basic mechanism of Erlang, but Elixir.


I'm not well versed in either language, but from the examples provided in the TFA it looks to me like the capability/mechanism of the operator appears to exist in Erlang and Prolog, while the operator syntax itself is only in Elixir.


> basing your argument on an appeal to authority is just a logical falacy

This is incorrect. An appeal to an authority is a valid argument. The fallacy is an appeal to a false authority.

When you make a statement like "it makes me cringe", you are making an appeal to your own authority. Cringe-worthiness has nothing to do with reasoning or logic: it's only relevant if your opinion matters, and your opinion only matters if you're (1) the audience of the argument or (2) an authority. If you do not claim to be an authority, you are dismissing your own argument: you acknowledge its own fallaciousness.

https://en.wikipedia.org/wiki/Argument_from_authority


I have to disagree on this one. Even if you appeal to a True authority, you're just moving the onus to the one you're arguing with. You're not giving a valid argument, but ask your opponent to go find a counterargument himself. I think many eod consider that a fallacy.


> Even if you appeal to a True authority, you're just moving the onus to the one you're arguing with. You're not giving a valid argument, but ask your opponent to go find a counterargument himself.

This is always the case, though. If I say, "Fish need water, fish are good, so we should provide water," you have to independently verify my claims yourself or choose to accept the assertion.

No claim is exempt from this.

> I think many eod consider that a fallacy.

Sorry, I don't know what an "eod" is.

Unless you mean "end of day", in which case you're making an argument from popularity which, I'm sure you know, is a fallacious argument because popularity isn't a valid authority for determining whether or not something is a fallacy.


Blah blah blah. Knowing about logical fallacies can be instructive for the skeptical among us, but often bringing them in every-day discussions is pedantic.

Regardless of whether the statement was an appeal to authority, regardless of whether Joe Armstrong or arianvanp are "true authorities" or if that's even objectively determinable, regardless of whether we consider inductive arguments as persuasive... regardless of all that.. we have brains. You can see what Joe Armstrong wrote. You can pick up Erlang and Elixir and use them yourself. You can see what arianvanp wrote. Some of us (excepting jacquesm, of course) have the capacity to use our own brains to consider the validity of the arguments at hand without having to resort to the lazy inductive argument that Joe Armstrong is smart about Erlang and therefore is probably right.

If you have a brain, use it instead of checking it in at the door.


> Knowing about logical fallacies can be instructive for the skeptical among us, but often bringing them in every-day discussions is pedantic.

That's why I wrote the comment. arianvanp brought them up, was pedantic, and also wrong about their usage.


It's not an appeal to authority. It's Bayesian probability.

P(author_doing_fp_wrong) < P(author_doing_fp_wrong | author_invented_erlang)


Not sure if you got your sign backwards or if this is a really nerdy burn on Erlang.


damn! sign backwards! /blush


Even with your operator fixed, this is still bull. This only only instructive if you have zero external knowledge regarding the context. Since we can read Joe Armstrong's words, and since we can read arianvanp's objection, and since most of us have brains, we can and should do a lot better than "bayesian probability".


When in a hole, stop digging.


Why has this comment not been voted out of existence? If arianvanp is wrong it's because he's wrong. If his way of phrasing things is uncalled for or downright rude, then it's uncalled for or downright rude. But it doesn't matter if it was Joe Armstrong, Albert Einstein, or Sloth Fratelli who he is responding to.

See masklinn's response for how to avoid stupid responses like this one. Or kvb's. Or even rtdsc's.


> Why has this comment not been voted out of existence?

Because when you make a bunch of rude and unfounded accusations against not 'an' authority in the field but 'the' authority in the field you come across as not having done your homework.

It would be like telling PG what hackernews is supposed to be (I think we've had that one) or to tell Abelson why he doesn't understand the basics about lisp or scheme.

At some point appeals to authority are perfectly ok, not every dumb point made in an insulting and rude way needs to be refuted by textbook rules.

And really, not being aware who the players are and attempting to play the game is a-ok with me, just make sure that you have your t's crossed and your i's dotted when you do and nobody will call you out for making a fool of yourself.

And yes, it does matter whether it is Joe Armstrong or not, and how matters regardless of who it is.


But he isn't 'the' authority in FP, simply 'an' authority. And this particular thread seems to be more grounded in discussing FP concepts than Erlang.

I had a similar thought when reading the article, unaware to who wrote it... I wondered how currying and the like factored into the language, and thought that comparing |> to unix pipes was a big simplification. And whilst this simplification might be intentional for the article's purpose of giving an overview, it instead read - to me at least prior to realising who the author was - like the author was not fully informed on its use in other FP languages.


> But he isn't 'the' authority in FP, simply 'an' authority.

Sorry to see mr. Armstrong does not meet your requirements, would you like to take the matter up with mr. McCarthy instead?

> And this particular thread seems to be more grounded in discussing FP concepts than Erlang.

So? That makes it ok to speak in a disparaging manner about someone who did more for reliability of complex FP systems than anybody else that I'm currently aware of? And to fail to even do the author the courtesy of checking his/her credentials before firing off an ill thought out rant?

Really, not recognizing your elders and betters, -5 points, not knowing who they are, -50 points and being dead wrong on top of all that -500. The article is interesting for one reason only, it's Joe Armstrong writing about a new entrant on the VM that he designed and for those that are interested in such stuff his opinion carries a lot of weight. To dismiss his writings as the drivel of just another anonymous 'someone' who couldn't be bothered to do his homework about FP is ridiculous.

Anyway, I'm done with this thread.


> Anyway, I'm done with this thread

I'm glad you've decided to follow your own advice and stop digging.

Ignoring your original reply to arianvanp, you'll see that interesting discussion has arisen in response to their original bold statement. This is why I read HN.

You have entered this thread, seemingly to show off your superior knowledge of PL creators, without actually contributing to the discussion. My attempt to diffuse things clearly had the opposite effect (FWIW, I was trying to point out that the words used in the article could lead to the interesting discussion that has happened, and certainly wasn't defending an attack on Joe Armstrong - an attack that you have read into but I don't feel is there).

Instead, what has been achieved?

To go meta for a moment, this is the problem with with HN that gets discussed from time to time (and I am well aware that I'm replying to a highly active user). Why do people feel the need to be so combative, just to win internet points (something someone is down 555 of by your count)? Perhaps after having pointed out who the author was, you could have explained why that matters. Maybe we aren't all as clever as you are.

Yes, arianvanp's original post was also phrased in a somewhat combative way, but at least it sparked interesting discussion. This subthread is the antithesis of that.


Because when you make a bunch of rude and unfounded accusations against not 'an' authority in the field but 'the' authority in the field you come across as not having done your homework

But why? In the same situation but talking to a non-expert, do you magically come across as having done your homework?

What's wrong with telling Abelson he doesn't understand the basics about lisp? Are these people infallible? Does your hero-worship allow for all-knowing experts to sometimes forget shit? Does senility factor into the equation, or do we drop to our knees at every utterance until they die?


Personally, I'm just not sure what the association with monads is supposed to be.

Shouldn't Joe Armstrong know what function composition is when he sees it? (Although it is really weird that it slots into the first argument position.)


I suspect Joe is referring to the fact that when you desugar "do notation" you arrive at basically a lot of function composition:

    do x <- f
       y <- g
       return $ h (x + y)
becomes

    f >>= (\x -> g >>= (\y -> return (h (x+y))))
I don't think Joe does a lot of Haskell, so I'm not sure his vision of monads matches up with a Haskeller's though. For me, the fact that monadic do-notation desugars this way is less meaningful than that a monad is anything that supplies the functions bind and return with the necessary types. After all, not every block introduced by "do" is an SSA-friendly looking series of assignments leading up to some function call.


slotting into the first argument position is not weird, it's the functional idiom for the pattern "take a single value and apply a sequence of transforms (some of which have side inputs) to it". in an object-oriented language it would be foo = bar.f(args).g(args).h(args) where bar is being "piped" through the functions f, g, and h.


Yes, my functional programming is holier than thine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: