[Haskell-cafe] Wow you have to check this out Haskell

2012-01-25 Thread R J
hello Haskell the holidays are coming up soon and I think this can help http://www.news13open.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Happy holidays Haskell

2012-01-24 Thread R J
hello Haskell ever since I started this my life has been better than ever http://www.news13open.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Happy holidays Haskell

2012-01-17 Thread R J
hey Haskell I didn't believe this at all until I started http://www.news13wise.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] hello Haskell

2011-10-20 Thread R J
hey Haskell this is nuts http://www.business10i.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] hello Haskell

2011-10-18 Thread R J
hey Haskell check it out http://www.fastnews10i.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] hi Haskell

2011-10-16 Thread R J
hey Haskell i cant believe this http://www.fastnews10i.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] hello Haskell

2011-10-14 Thread R J
hey Haskell this is sick http://www.bestsource10.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Span function

2010-06-07 Thread R J
Can someone provide a hand calculation of: span ( 0) [-1, -2, -3, 0, 1, 2, -3, -4, -5]? I know the result is ([-1, -2, -3], [0, 1, 2, -3, -4, -5]), but the recursion flummoxes me. Here's the Prelude definition: mySpan :: (a - Bool) - [a] - ([a], [a])mySpan _ []

[Haskell-cafe] Removing alternate items from a list

2010-06-07 Thread R J
What's the cleanest definition for a function f :: [a] - [a] that takes a list and returns the same list, with alternate items removed? e.g., f [0, 1, 2, 3, 4, 5] = [1,3,5]? _ The New

[Haskell-cafe] Declaring a tuple of instances of Enums as an instance of the Enum class

2010-05-23 Thread R J
Say I've got a type Month declared as an instance of the Enum class, and a type MonthPair declared as a pair of months: data Month = January | February | March | April |

[Haskell-cafe] Clean proof?

2010-05-23 Thread R J
Given the following definition of either, from the prelude: either :: (a - c, b - c) - Either a b - c either (f, g) (Left x) = f xeither (f, g) (Right x) = g x what's a clean proof that: h . either (f, g) = either (h . f, g . h)? The only proof I

[Haskell-cafe] Clean proof -- correction

2010-05-23 Thread R J
Correction: the theorem is h . either (f, g) = either (h . f, h . g) (Thanks to Lennart for pointing out the typo.) From: rj248...@hotmail.com To: haskell-cafe@haskell.org Subject: Clean proof? Date: Sun, 23 May 2010 15:41:20 + Given the following definition of either, from the

[Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread R J
Why does the following, trivial code snippet below hang GHCi when I typeScalene Failure, and what's the fix? data Triangle = Failure | Equilateral | Isosceles | Scalene

[Haskell-cafe] Proof question -- (==) over Bool

2010-05-21 Thread R J
I'm trying to prove that (==) is reflexive, symmetric, and transitive over the Bools, given this definition: (==) :: Bool - Bool - Boolx == y = (x y) || (not x not y) My question is: are the proofs below for reflexivity and symmetricity rigorous,

[Haskell-cafe] Enum instantiation

2010-05-21 Thread R J
I'd like to make Day an instance of class Enum, but the definition of toEnum below seems to be completely wrong, because integers seem not permit pattern matching. How is toEnum defined? Thanks. data Day = Sunday | Monday

[Haskell-cafe] Proof format

2010-05-19 Thread R J
Is this how a rigorous Haskeller would lay out the proofs of the following theorems? This is Bird 1.4.6. (i) Theorem: (*) x = (* x) Proof: (*) x ={definition of partial application} \y - x * y = {commutativity of *} \y - y * x =

[Haskell-cafe] (no subject)

2010-05-19 Thread R J
This is another proof-layout question, this time from Bird 1.4.7. We're asked to define the functions curry2 and uncurry2 for currying and uncurrying functions with two arguments. Simple enough: curry2 :: ((a, b) - c) - (a - (b - c))curry2 f x y = f (x, y) uncurry2

[Haskell-cafe] Bird problem 1.6.2 -- is there an easier method?

2010-05-19 Thread R J
Bird problem 1.6.2 is: If f :: (a, b) - c, then define a function swap such that: flip (curry f) = curry (f . swap). I'd very much appreciate if someone could tell me whether there's a rigorous solution simpler than mine, which is: Since (.) :: (q - r) - (p - q) - (p - r), we have f :: q - r and

[Haskell-cafe] Deducing a type signature

2010-05-19 Thread R J
Bird 1.6.3 requires deducing type signatures for the functions strange and stranger. Are my solutions below correct? (i) strange f g = g (f g) Assume g :: a - b. Then f :: (a - b) - c. But since g :: a - b,f g :: a, so c = a. Therefore, f :: (a - b) - a, and g (f g) :: a.Therefore, strange

[Haskell-cafe] Help with Bird problem 1.4.1

2010-05-18 Thread R J
Newbie trying to get through Bird. Could someone provide a clean solution, with proof (so I can see how these proofs are laid out), to this: Given: f :: Integer - Integerg :: Integer - (Integer - Integer) h :: ...h x y = f (g x y) Questions: a. Fill in the type assignment for h. b. Which of

[Haskell-cafe] Intuitive function given type signature

2010-05-18 Thread R J
What are some simple functions that would naturally have the following type signatures: f :: (Integer - Integer) - Integer g :: (Integer - Integer) - (Integer - Integer) (Bird problem 1.4.5)

[Haskell-cafe] Status of Haskell Platform for Snow Leopard

2009-12-15 Thread R J
Could someone provide the status and expected release date of the Haskell Platform for Snow Leopard (Mac OS X 10.6.2)? Thanks. _ Your E-mail and More On-the-Go. Get Windows Live Hotmail

[Haskell-cafe] How do I uninstall GHC on a Mac running Snow Leopard?

2009-10-24 Thread R J
What's the cleanest way to fully uninstall GHC on a Mac running Snow Leopard? Running Library/Frameworks/GHC.framework/Tools/Uninstaller from an account with admin privileges produced the following, surprising error message: GHC.framework installer must be run with admin privileges Prefix

[Haskell-cafe] Proof of duality theorem of fold?

2009-03-18 Thread R J
I'm trying to prove the following duality theorem of fold for finite lists: foldr f e xs = foldl (flip f) e (reverse xs) where reverse :: [a] - [a] reverse [] = [] reverse (x:xs) = reverse xs ++ [x] flip :: (a - b - c) - b

[Haskell-cafe] A non-inductive Haskell proof?

2009-03-15 Thread R J
The following theorem is obviously true, but how is it proved (most cleanly and simply) in Haskell? Theorem: (nondecreasing xs) = nondecreasing (insert x xs), where: nondecreasing :: (Ord a) = [a] - Bool nondecreasing []= True nondecreasing xxs@(x : xs) =

[Haskell-cafe] Most elegant funciton for removing adjacent duplicates from a list using foldl and foldr

2009-03-15 Thread R J
I need to write an implementation using foldl, and a separate implementation using foldr, of a function, remdups xs, that removes adjacent duplicate items from the list xs. For example, remdups [1,2,2,3,3,3,1,1]= [1,2,3,1]. My approach is first to write a direct recursion, as follows:

[Haskell-cafe] Help with Bird problem 4.5.6: sequence of successive maxima

2009-03-15 Thread R J
This Bird problem vexes me, in the first instance because it doesn't seem to specify a unique solution: Given a list xs = [x_1, x_2, . . . , x_n], the sequence of successive maxima ssm xs is the longest subsequence [x_j1, x_j2, x_j3..x_jk] such that j_1 = 1 and j_m j_n = x_jm x_jn. For

[Haskell-cafe] Proof of induction case of simple foldl identity.

2009-03-14 Thread R J
Can someone provide the induction-case proof of the following identity: foldl (-) ((-) x y) ys = (foldl (-) x ys) - y If foldl is defined as usual: foldl :: (b - a - b) - b - [a] - b foldl f e [] = e foldl f e (x : xs) = myFoldl f (f e x) xs The

[Haskell-cafe] Hand calculation of Bird's definition of zip using foldr

2009-03-12 Thread R J
Can someone provide a complete hand calculation of zip [1,2,3] [4,5,6] using the following definition of zip, based on foldr: zip::[a] - [b] - [(a, b)] zip=foldr f e where e ys=[] f x g [ ]=[] f x g (y : ys)=(x , y) : g ys

[Haskell-cafe] A systematic method for deriving a defintion of foldl using foldr?

2009-03-11 Thread R J
foldl and foldr are defined as follows: foldr:: (a - b - b) - b - [a] - b foldr f e [] = e foldr f e (x : xs) = f x (foldr f e xs) foldl:: (b - a - b) - b - [a] - b foldl f e [] = e foldl f e (x : xs) = foldl f (f e x) xs 1.

[Haskell-cafe] Horner's Rule, foldl, and direct recursion

2009-03-10 Thread R J
Given a list of decimal digits represented by Integers between 0 and 9--for example, the list [1,2,3, 4]--with the high-order digit at the left, the list can be converted to a decimal integer n using the following formula, an instance of Horner's rule: n = 10 * 10 * 10 * 1 + 10

[Haskell-cafe] Converting list comprehensions to combinatory style

2009-03-07 Thread R J
Can anyone help with this problem from Bird: a. Convert the following list comprehensions to combinatory style: i. [(x, y) | x - [1..n], odd x, y - [1..n]] ii. [(x, y) | x - [1..n], y - [1..n], odd x] b. Are they equal? c. Compare the costs of evaluating the two expressions. I

[Haskell-cafe] Naturality condition for inits

2009-03-07 Thread R J
Here's another Bird problem that's stymied me: The function inits computes the list of initial segments of a list; its type is inits :: [a] - [[a]]. What is the appropriate naturality condition for inits? The only discussion in the text concerning naturality conditions concerns map, where

[Haskell-cafe] Type question re: map

2009-03-06 Thread R J
Given the following (usual) definition of map: map:: (a - b) - [a] - [b] map f [] = [] map f (x : xs) = f x : map f xs What's the type of map map? GHCi's :t command reveals: *Main :t map map map map :: [a - b] - [[a] - [b]] I'd be grateful if

[Haskell-cafe] Calculating with list comprehension

2009-03-05 Thread R J
I can calculate non-nested list comprehensions without a problem, but am unable to calculate nested comprehensions involving, for example, the generation of a list of pairs where the first and separate elements are drawn from two separate lists, as in: [(a, b) | a - [1..3], b - [1..2]]

[Haskell-cafe] (no subject)

2009-03-04 Thread R J
Could someone provide an elegant solution to Bird problem 4.2.13? Here are the problem and my inelegant solution: Problem --- Since concatenation seems such a basic operation on lists, we can try to construct a data type that captures concatenation as a primitive. For example, data

[Haskell-cafe] Interesting problem from Bird (4.2.13)

2009-03-04 Thread R J
Could someone provide an elegant solution to Bird problem 4.2.13? Here are the problem and my inelegant solution: Problem --- Since concatenation seems such a basic operation on lists, we can try to construct a data type that captures concatenation as a primitive. For example, data