Five and a half months late

If only the XKCD guy had published this comic five and half months earlier, I could have used it to illustrate my functional-vs.-imperative-programming article.

C’est la vie.

Unrelated addendum

Am I the only person in the whole world who finds this joke funny?  “A man walked into a pub.  He said ‘Ouch!’.  It was an iron pub.”  It makes me laugh even to type it here, but so far not one single person I’ve told it to has laughed.

Also: “1st man: My wife’s gone to Jakarta.  //  2nd man: Of her own accord?”

16 responses to “Five and a half months late

  1. My wife’s gone to the West Indies
    Jamaica?
    No, she went of her own accord

    And the rest: http://www.jokefile.co.uk/numerical_order/1105.html

  2. I use a shorter version. “A man walks into a bar. Ouch.”

  3. I feel like that cartoon — and the parallel example in your other post — are more a case of imperative vs. declarative programming. Paradigmatic functional programming languages like Lisp still require the programmer to specify how something is to be done, just in a different way. They do allow the interpreter more flexibility in terms of order and concurrency, but that’s not very helpful on a road trip!

  4. Justin, it’s not funny if you say “bar”. Well, it is, but not in the same way. The whole point of my version is that you don’t say “bar”.

    Ben N., I take the point that declarative programming is broader than just functional programming; but you seem to be saying here it is something separate from, rather than a superset of, functional. Did I understand you right? If so, then what would you consider to be a declarative language? Prolog, I guess, but anything else?

  5. Love it! Andy Kaufman classic: “I just flew in from Chicago and boy am I tired.”

    Not to ruin with overanalysis, but there’s a nice pieces with some of these here.

  6. “My wife exploded on holiday”.

    “Grenada?”

    “No, she went off of her own accord”.

  7. > Justin, it’s not funny if you say “bar”. Well, it is, but not in the same way. The whole point of my version is that you don’t say “bar”.

    Curiously, I find all humor in the joke lost when you *don’t* say bar.

    I miss your posts. :(

  8. Prolog is the only language that I would call declarative that I have any experience with. From what I’ve seen, Haskell is more declarative than Scheme, at least in terms of its type inference system.

    I think of declarative programming as literally just telling the interpreter what kind of result you want, not how to get it. That’s tricky because, at some level, if you really understand the interpreter, you know how it’s going to do what you asked, and presumably went ahead and wrote a program that would do it that way on purpose, so in the end you do have to think about the method by which your wish will be granted. For example, in both Scheme and Prolog you have to think about execution order if you want to avoid infinite loops.

    An address, considered as a “program” for Google Maps to “interpret”, is pretty thoroughly declarative, in that it contains in itself no information which constrains how it is to be processed, either in terms of the algorithm used to find a route or the route itself. On the other hand, the interpreter here needs to include a really big database which is much larger than the raw driving directions.

    I’m not sure that a “pure” declarative language exists, or can exist, because there exist problems with similar signatures that call for very different algorithms. A pure declarative language would be one where you tell it what you want, and it does the right thing (which is almost certainly undecidable in the general case), but real declarative languages always do whatever it is that they always do (e.g. depth-first search and unification in the case of Prolog), which is sometimes wrong. That’s why Prolog includes cut, which you use when you have to tell it not only what you want done, but how.

  9. I laughed when reading your pub joke, but I’m always showing my wife things that to her are not funny at all. I think it has a few levels of indirection which most people don’t care to follow or don’t find funny. Slapstick in comparison has zero or one level of indirection depending on how you look at it. Unexpected event humour has more indirection, word humour even more and the jokes above yet more.

  10. Good observation, Jay. Who was it that said every programming problem can be solved by one more level of indirection? (Conversely, every programming problem is caused by one too many levels of indirection.)

  11. Andrew Hickey

    I like those. They remind me of John Thompson’s character from the 90s, Bernard Righton, a Manningesque club comedian who did jokes like:
    “There was this black feller, an Irishman and a Jew in a bar… what a great example of a multicultural society”
    or
    “Two nuns on a tandem, going down a cobbled street. One says ‘I’ve never come this way before’. The other says ‘No, there’s roadworks on the A30, and this is the diversion'”

  12. Q: How many Prolog programmers does it take to screw in a lightbulb?
    A: NO

    (I can’t believe this one didn’t occur to me earlier)

  13. LOL @ the Prolog joke.

  14. Not just Prolog. You could also say that SQL was declarative.

    SELECT * FROM table1, table2 where table1.col1 = table2.col2;

    but there are many ways to do this and the SQL optimiser will choose a suitable one depending on indexes, number of records etc..

  15. That looks like a bit of a stretch to me. If we’re going to say that SQL is declarative because the query optimiser decides how best to perform a select, we might just as well say that C is declarative because the compiler’s optimiser decides how best to perform an sequence of assignments. We have to mean something more than that.

  16. Well, I didn’t get it but my punster wife did. She agree with others, however, that “bar” would be more punful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s