Redefining Arithmetic

In the arithmetic of love, one plus one equals everything, and two minus one equals nothing.

-Mignon McLaughlin


What does the following expression in haskell evaluate to?

1
let 2+2=5 in 2+2

4 Error: 2+2 != 5 5 Error: Incorrect use of the let statement

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Addition is just a binary operation. It works the way you define it!

In Haskell, you are allowed to overwrite the way + works like an ordinary function. In particular, this code defines 2+2 to be 5

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...