summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorven <vendethiel@hotmail.fr>2015-10-20 21:40:49 +0200
committerven <vendethiel@hotmail.fr>2015-10-20 21:40:49 +0200
commite596def97b311315d0591923120c5f60acc2dd07 (patch)
treeb394d290e4b8217db4b850c730a81b866a49c12b
parentb354013dc9bcba5e76bd3cf720eae8af7d9eba89 (diff)
parentf0bbebe789e310ecd76fcfdfa334291928591fb7 (diff)
Merge pull request #1703 from Gregly/function_composition
Modify the function composition example to avoid two 5's
-rw-r--r--haskell.html.markdown8
1 files changed, 4 insertions, 4 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown
index 369b1b20..08611e63 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -195,11 +195,11 @@ foo 5 -- 15
-- function composition
-- the (.) function chains functions together.
-- For example, here foo is a function that takes a value. It adds 10 to it,
--- multiplies the result of that by 5, and then returns the final value.
-foo = (*5) . (+10)
+-- multiplies the result of that by 4, and then returns the final value.
+foo = (*4) . (+10)
--- (5 + 10) * 5 = 75
-foo 5 -- 75
+-- (5 + 10) * 4 = 60
+foo 5 -- 60
-- fixing precedence
-- Haskell has another operator called `$`. This operator applies a function