From 503ee0118ec9ff8c2a8deec4125db890a7afed92 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 3 Sep 2012 14:39:47 -0500 Subject: [PATCH] typos --- blog.html | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blog.html b/blog.html index 949714f..6eb0cc2 100644 --- a/blog.html +++ b/blog.html @@ -52,7 +52,7 @@

the dipert problem

(.) :: (b -> c) -> (a -> b) -> a -> c

This is a little pipeline, but reversed because that’s how mathematics does it. It says “the right-side function takes an a and gives a b, and the left-side function expects a b and gives a c; now you can stitch them together and have a function that skips the b and takes you right from a to c.” But we have a function that looks like:

(a -> b -> c)
-

on the right-hand side; it won’t work. how to we convert a (a -> b -> c) to a (a -> (b -> c))? This way:

+

on the right-hand side; it won’t work. how do we convert a (a -> b -> c) to a (a -> (b -> c))? This way:

{-
 f x y =  foldl1 (*) ((replicate x) y)
 f x y = (foldl1 (*) . (replicate x)) y
@@ -81,7 +81,7 @@ 

the dipert problem

(foldl1 (*) .) . replicate :: Int -> Int -> Int

And that’s it, we have a point-free function that takes two Ints and returns an Int. And so that’s our last, and final function:

f2 = (foldl1 (*) .) . replicate
-

In general, and I don’t know a term for this, but the operation of successive function composition lets compose higher and higher arity functions together. Here’s a dumb example using my little point-free succ function:

+

In general, and I don’t know a term for this, but the operation of successive function composition lets us compose higher and higher arity functions together. Here’s a dumb example using my little point-free succ function:

g :: Int -> Int
 g = (+1)
 (g .)       :: (a -> Int) -> a -> Int
diff --git a/index.html b/index.html
index ed4c31c..41b8a82 100644
--- a/index.html
+++ b/index.html
@@ -53,7 +53,7 @@ 

the dipert problem

(.) :: (b -> c) -> (a -> b) -> a -> c

This is a little pipeline, but reversed because that’s how mathematics does it. It says “the right-side function takes an a and gives a b, and the left-side function expects a b and gives a c; now you can stitch them together and have a function that skips the b and takes you right from a to c.” But we have a function that looks like:

(a -> b -> c)
-

on the right-hand side; it won’t work. how to we convert a (a -> b -> c) to a (a -> (b -> c))? This way:

+

on the right-hand side; it won’t work. how do we convert a (a -> b -> c) to a (a -> (b -> c))? This way:

{-
 f x y =  foldl1 (*) ((replicate x) y)
 f x y = (foldl1 (*) . (replicate x)) y
@@ -82,7 +82,7 @@ 

the dipert problem

(foldl1 (*) .) . replicate :: Int -> Int -> Int

And that’s it, we have a point-free function that takes two Ints and returns an Int. And so that’s our last, and final function:

f2 = (foldl1 (*) .) . replicate
-

In general, and I don’t know a term for this, but the operation of successive function composition lets compose higher and higher arity functions together. Here’s a dumb example using my little point-free succ function:

+

In general, and I don’t know a term for this, but the operation of successive function composition lets us compose higher and higher arity functions together. Here’s a dumb example using my little point-free succ function:

g :: Int -> Int
 g = (+1)
 (g .)       :: (a -> Int) -> a -> Int