One of the reasons I don't like LISP
Jul. 18th, 2013 11:27 pmI've never really liked LISP or Scheme or what-have-you, for a number of reasons. Largely having to do with the syntax. But I was using Scheme recently for Less Wrong's Prisoner's-Dilemma-with-visible-source-code contest[0]. Scheme is hardly what I'd call the perfect language for holding such a thing, but of languages that people have actually come up with and are decently well-known, it's probably the best choice. (Though I might suggest restricting to a subset of Scheme might be even better.)
Anyway. I realized today that one of the things that most annoys me about LISP is actually very closely tied to the reason a LISP variant is the best language to hold the contest in: In LISP, there's a difference between what something *is*, and what it *evaluates to*.
You might think that in LISP, (* 2 3) is 6. But (* 2 3) isn't 6; it's a list of 3 elements. (* 2 3) evaluates to 6. And you might think that * is a function; but no, * is a symbol -- it evaluates to a function. And you might think that 2 is 2 -- well, that part's correct; 2 both is and evaluates to 2. But not everything evaluates to itself.
Having to keep straight this distinction is really annoying. I certainly don't have to worry about anything like this in Haskell!
But so it has to be in a contest like this -- if your entry were to *be* a function, rather than something that evaluates to a function, then your opponent could only have black-box access to it, and the contest would be rather different (and, I think, much less interesting).
-Harry
[0]I ended up not submitting an entry; I couldn't finish mine in time (largely because my idea, I later realized, fundamentally made no sense). I was going to submit a really simple one instead at the last minute, but I misremembered the deadline and didn't.
Anyway. I realized today that one of the things that most annoys me about LISP is actually very closely tied to the reason a LISP variant is the best language to hold the contest in: In LISP, there's a difference between what something *is*, and what it *evaluates to*.
You might think that in LISP, (* 2 3) is 6. But (* 2 3) isn't 6; it's a list of 3 elements. (* 2 3) evaluates to 6. And you might think that * is a function; but no, * is a symbol -- it evaluates to a function. And you might think that 2 is 2 -- well, that part's correct; 2 both is and evaluates to 2. But not everything evaluates to itself.
Having to keep straight this distinction is really annoying. I certainly don't have to worry about anything like this in Haskell!
But so it has to be in a contest like this -- if your entry were to *be* a function, rather than something that evaluates to a function, then your opponent could only have black-box access to it, and the contest would be rather different (and, I think, much less interesting).
-Harry
[0]I ended up not submitting an entry; I couldn't finish mine in time (largely because my idea, I later realized, fundamentally made no sense). I was going to submit a really simple one instead at the last minute, but I misremembered the deadline and didn't.