Haskell is to math as Perl is to English?

Fortran superficially looks like mathematics. Its name comes from “FORmula TRANslation,” and the language does provide a fairly straightforward way to turn formulas into code. But the similarity to mathematics ends there at the lowest level of abstraction.

Haskell, on the other hand, is more deeply mathematical. Fortran resembles math in the small, but Haskell resembles math in the large. Haskell has mathematical structures at a higher level of abstraction than just formulas. As a recent article put it

While Fortran provides a comfortable translation of mathematical formulas, Haskell code begins to resemble mathematics itself.

On its surface, Perl is one of the least English-like programming languages. It is often criticized as looking like “line noise” because of its heavy use of operators. By contrast, Python has been called “executable pseudocode” because the source is easier to read, particularly for novice programmers. And yet at a deeper level, Perl is more English-like than other programming languages such as Python.

Larry Wall explains in Natural Language Principles in Perl that he designed Perl to incorporate features of spoken language. For example, Perl has analogs of articles and pronouns. (Larry Wall studied both linguistics and computer science in college.) Opinions differ on how well his experiment with incorporating natural language features into programming languages has worked out, but it was an interesting idea.

Related posts

7 thoughts on “Haskell is to math as Perl is to English?

  1. Perl is not in the least bit like English. If you speak English to an English speaker, they can generally understand what you just said.

  2. Perl has such a large vocabulary that two users can choose almost disjoint subsets of the language. But even this is English-like.

    Perl is a mess, but it contains some interesting ideas. Unfortunately these ideas are all bundled together and hard to evaluate separately.

  3. @Dan Piponi Historically, that hasn’t generally been true. It’s only relatively recently (last century) that regional differences in languages have eliminated to the extent that all “English” (or “German”, for that matter) speakers are speaking mutually intelligible languages. The tendency to create dialects is strong. Computer languages suffer from this, too. One difference between Perl and other computer languages is that Perl embraces that, while Python was consciously designed to discourage it.

  4. I like Haskell, I don’t like Perl. Upon seeing the title I thougt this article was going to be critical of Haskell, based on analogy with Perl. Surprise.

    > Opinions differ on how well his experiment with incorporating natural language features into programming languages has worked out, but it was an interesting idea.

    Well, look up Perl’s popularity over the years, there’s your answer.

  5. Perl was created based on some of Larry Wall’s ideas about languages. That’s the limit of how much Perl is like English.

    Larry is not a linguist, and even if he was he only had a few ideas about languages to even try to make Perl like.

  6. You may want to take a look at j at http://jsoftware.com. I’ve resolved to teach myself j this year with much success. J is a derivative of APL, the extension of math to logic language that was a paper first, A Programming Language. Someone later coded the programming language as a thought experiment.

  7. FLOW-MATIC, an early computer language designed by Adm. Grace Hopper, and the primary ancestor of COBOL, was also designed to be English-like. The result, perhaps predictably, was a language that managers loved and hackers hated.

Comments are closed.