Loading ...
Sorry, an error occurred while loading the content.

222Re: [extremeperl] Terrence the Hypocrite

Expand Messages
  • Rob Kinyon
    Apr 3, 2005
      > Hypocrisy Two:
      > -------------
      >
      > After claiming that testing was irrelevant in Haskell, I am now at
      > Section 4.5 in the best Haskell instructional text I have seen, "Craft
      > of Functional Programming" by Thompson, and what is this chapter
      > called: "Program Testing". So, there we go. Two feet in my mouth in
      > less than 2 days.

      I believe Knuth said it best when he wrote "Beware of bugs in the
      above code; I have only proved it correct, not tried it." Functional
      programming allows for proofs. It doesn't mean that you didn't typo
      anything. Testing in such a situation is for making sure you typed

      twoExp n
      | n == 1 = 2
      | even n = (twoExp m) ** 2
      | odd n = 2 * (twoExp m) ** 2
      where m = n `quot` 2

      and didn't type

      twoExp n
      | n == 1 = 3
      | even n = (twoExp m) ** 2
      | odd n = 2 * (twoExp m) ** 2
      where m = n `quot` 2

      Rob
    • Show all 13 messages in this topic