Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ _ = case p of
True -> t
False -> f
```

[wikipedia-syntactic-sugar]:
https://en.wikipedia.org/wiki/Syntactic_sugar
"Wikipedia: Syntactic sugar"
~~~~


Expand Down Expand Up @@ -113,6 +117,3 @@ In our solution above we have
[so-guards-if-cases]:
https://stackoverflow.com/questions/9345589/
"StackOverflow: Guards vs. if-then-else vs. cases in Haskell"
[wikipedia-syntactic-sugar]:
https://en.wikipedia.org/wiki/Syntactic_sugar
"Wikipedia: Syntactic sugar"
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Here, `infixr 3 &&` indicates that `&&` has precedence 3 and [associates][wikipe
Similarly, `infixl 6 +` means that `+` has precedence 6 and associates to the left.
No precedence is shown for `not`, because none has been explicitly defined.
However, `not` is just a regular function, and function application always has precedence 10.

[wikipedia-associativity]:
https://en.wikipedia.org/wiki/Operator_associativity
"Wikipedia: Operator associativity"
~~~~

~~~~exercism/note
Expand All @@ -55,6 +59,10 @@ Hint: fill out the [truth tables][wikipedia-truth-table] for both versions.
This is not possible in general: sometimes `(P && Q) || R` and `P && (Q || R)` disagree.

The motivation for the parentheses in the highlighted solution is efficiency; see below.

[wikipedia-truth-table]:
https://en.wikipedia.org/wiki/Truth_table
"Wikipedia: Truth table"
~~~~


Expand Down Expand Up @@ -141,15 +149,9 @@ As you can see, this version always does at least 2 tests.
[operators-source-code]:
https://hackage.haskell.org/package/ghc-prim-0.9.0/docs/src/GHC.Classes.html#line-509
"source code of the logical operators"
[wikipedia-associativity]:
https://en.wikipedia.org/wiki/Operator_associativity
"Wikipedia: Operator associativity"
[wikipedia-non-strict-evaluation]:
https://en.wikipedia.org/wiki/Evaluation_strategy#Non-strict_evaluation
"Wikipedia: Non-strict evaluation"
[wikipedia-precedence]:
https://en.wikipedia.org/wiki/Order_of_operations
"Wikipedia: Order of operations"
[wikipedia-truth-table]:
https://en.wikipedia.org/wiki/Truth_table
"Wikipedia: Truth table"