diff options
author | Greg Yang <gregly@zoho.com> | 2015-10-20 12:05:16 -0700 |
---|---|---|
committer | Greg Yang <gregly@zoho.com> | 2015-10-20 12:05:16 -0700 |
commit | a76be91a2d45c7c4a834c2ad6d5164ac907c1038 (patch) | |
tree | 371d3a555c1aaa8444732240b9b5ace9c39f7772 | |
parent | b354013dc9bcba5e76bd3cf720eae8af7d9eba89 (diff) |
modify function composition example
-rw-r--r-- | haskell.html.markdown | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown index 369b1b20..c6d97496 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 = 75 +foo 5 -- 60 -- fixing precedence -- Haskell has another operator called `$`. This operator applies a function |