X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=week1_advanced_notes.mdwn;h=99108d4ef13100eb2e45db2ee8b7931ba9eba0b1;hp=2cf6e3a9006369af3d64db7e46cdde86ea817440;hb=7f74879822e69d3b0dbf241ff053b76b8e177ff2;hpb=4bc207b758063abdd54a8247fe76af5e4cb65691;ds=sidebyside diff --git a/week1_advanced_notes.mdwn b/week1_advanced_notes.mdwn index 2cf6e3a9..99108d4e 100644 --- a/week1_advanced_notes.mdwn +++ b/week1_advanced_notes.mdwn @@ -161,7 +161,7 @@ is parsed as: ### Some common functions ### -Function composition, which mathematicians write as `f` ○ `g`, is defined as λ `x. f (g x)`. This notion is one you'll commonly be encountering in functional programming, so it's handy to have a short and clear notation for it. Haskell expresses this relation using a period, like this: `f . g`. But we are using the period for other purposes, as in our &lambda-constructions; and even Haskell gets into some awkwardness because they use it in other ways too. Perhaps we could use a simple `o` as an infix composition operator? I'm not sure if that would be clear enough. For the time being, I'm electing to write this notion as `comp`, but as an infix expression, so we write: `f comp g` to mean λ `x. f (g x)`. We may revisit this notational proposal later. +Function composition, which mathematicians write as `f` ˚ `g`, is defined as λ `x. f (g x)`. This notion is one you'll commonly be encountering in functional programming, so it's handy to have a short and clear notation for it. Haskell expresses this relation using a period, like this: `f . g`. But we are using the period for other purposes, as in our &lambda-constructions; and even Haskell gets into some awkwardness because they use it in other ways too. Perhaps we could use a simple `o` as an infix composition operator? I'm not sure if that would be clear enough. For the time being, I'm electing to write this notion as `comp`, but as an infix expression, so we write: `f comp g` to mean λ `x. f (g x)`. We may revisit this notational proposal later. We've already come across the `id` function, namely λ `x. x`.