From a76be91a2d45c7c4a834c2ad6d5164ac907c1038 Mon Sep 17 00:00:00 2001 From: Greg Yang Date: Tue, 20 Oct 2015 12:05:16 -0700 Subject: modify function composition example --- haskell.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'haskell.html.markdown') 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 -- cgit v1.2.3 From 18edced524b790fe3e6c9bb5f69507ca1bfb0553 Mon Sep 17 00:00:00 2001 From: Greg Yang Date: Tue, 20 Oct 2015 12:10:01 -0700 Subject: update the comment in as well --- haskell.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index c6d97496..e3b29937 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -198,7 +198,7 @@ foo 5 -- 15 -- multiplies the result of that by 4, and then returns the final value. foo = (*4) . (+10) --- (5 + 10) * 4 = 75 +-- (5 + 10) * 4 = 40 foo 5 -- 60 -- fixing precedence -- cgit v1.2.3 From f0bbebe789e310ecd76fcfdfa334291928591fb7 Mon Sep 17 00:00:00 2001 From: Greg Yang Date: Tue, 20 Oct 2015 12:10:50 -0700 Subject: really update the comment --- haskell.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index e3b29937..08611e63 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -198,7 +198,7 @@ foo 5 -- 15 -- multiplies the result of that by 4, and then returns the final value. foo = (*4) . (+10) --- (5 + 10) * 4 = 40 +-- (5 + 10) * 4 = 60 foo 5 -- 60 -- fixing precedence -- cgit v1.2.3