From 4e00fa4734bd39436f3336b4ce1034b65c265657 Mon Sep 17 00:00:00 2001 From: Cornel Punga Date: Mon, 16 Mar 2015 21:09:17 +0200 Subject: Update haskell.html.markdown. Wrong explanation about '$' operator --- haskell.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index 79fbf09f..d5dfd122 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -202,9 +202,9 @@ foo = (*5) . (+10) foo 5 -- 75 -- fixing precedence --- Haskell has another function called `$`. This changes the precedence --- so that everything to the left of it gets computed first and then applied --- to everything on the right. You can use `$` (often in combination with `.`) +-- Haskell has another function called `$`. Anything appearing after it will +-- take precedence over anything that comes before. +-- You can use `$` (often in combination with `.`) -- to get rid of a lot of parentheses: -- before -- cgit v1.2.3 From 9fb21f1ce4c02e8cad50046f90d026ccab284626 Mon Sep 17 00:00:00 2001 From: Cornel Punga Date: Mon, 16 Mar 2015 21:24:21 +0200 Subject: Haskell.html.markdown. Wrong result of an expression. The seventh Fibonacci number is 13 (odd number), so the result of 'even 13' is false. --- haskell.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index d5dfd122..f1025d44 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -208,13 +208,13 @@ foo 5 -- 75 -- to get rid of a lot of parentheses: -- before -(even (fib 7)) -- true +(even (fib 7)) -- false -- after -even . fib $ 7 -- true +even . fib $ 7 -- false -- equivalently -even $ fib 7 -- true +even $ fib 7 -- false ---------------------------------------------------- -- 5. Type signatures -- cgit v1.2.3 From 2f43da109ffab5a4d3dd582cc51a7c3d95dd4987 Mon Sep 17 00:00:00 2001 From: Cornel Punga Date: Wed, 25 Mar 2015 18:08:32 +0200 Subject: [haskell.html.markdown] Changed explanation for Haskell '$' operator --- haskell.html.markdown | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index f1025d44..6bdc78e0 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -202,10 +202,12 @@ foo = (*5) . (+10) foo 5 -- 75 -- fixing precedence --- Haskell has another function called `$`. Anything appearing after it will --- take precedence over anything that comes before. --- You can use `$` (often in combination with `.`) --- to get rid of a lot of parentheses: +-- Haskell has another operator called `$`. This operator applies a function +-- to a given parameter. In contrast to standard function application, which +-- has highest possible priority of 10 and is left-associative, the `$` operator +-- has priority of 0 and is right-associative. Such a low priority means that +-- all other operators on both sides of `$` will be evaluated before applying +-- the `$`. -- before (even (fib 7)) -- false -- cgit v1.2.3 From e8a1ee8912d1c9bb0145c2afbdc530463fc612b7 Mon Sep 17 00:00:00 2001 From: Cornel Punga Date: Fri, 27 Mar 2015 15:25:33 +0200 Subject: [haskell.html.markdown] Explanation for Haskell '$' operator with support from @geoffliu --- haskell.html.markdown | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index 6bdc78e0..6c98c2b6 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -205,9 +205,8 @@ foo 5 -- 75 -- Haskell has another operator called `$`. This operator applies a function -- to a given parameter. In contrast to standard function application, which -- has highest possible priority of 10 and is left-associative, the `$` operator --- has priority of 0 and is right-associative. Such a low priority means that --- all other operators on both sides of `$` will be evaluated before applying --- the `$`. +-- has priority of 0 and is right-associative. Such a low priority means that +-- the expression on its right is applied as the parameter to the function on its left. -- before (even (fib 7)) -- false -- cgit v1.2.3