I believe the exercise is about understanding folds.
There are two references that are related to the exercise:
A tutorial on the universality and expressiveness of fold, by Graham Hutton.
Dealing with large bananas, by Ralf Lammel, etc.
The last paper motivates well the need to gather all
Ryan Ingram wrote:
On 12/3/07, Kalman Noel [EMAIL PROTECTED] wrote:
You're confusing sum and product types.
I'm not so sure; it looks like they already have that type (Exp) and wants
to use AlgExp to hold the folding functions used.
Ah, I didn't catch that on the first read. I suppose Carlo
Brent Yorgey wrote:
One comment: it looks like (add exp1 exp2), (and exp1 exp2) and so on
above
are not correct. The second argument of foldExp is a value of type Exp,
so
you are pattern-matching on the constructors of Exp, and constructors are
always uppercase. Perhaps Exp has
On Dec 3, 2007 12:18 PM, Carlo Vivari [EMAIL PROTECTED] wrote:
Hi! I'm a begginer in haskell and I have a problem with an exercise, I
expect
someone could help me:
In one hand I have a declaration of an algebra data, like this:
data AlgExp a = AlgExp
{ litI :: Int - a,
litB :: Bool -
Yes,as I said before to other of you
the exp data type was also declared in the exercise (my fault not to say
it), and look as this:
data Exp = LitI Int
|LitB Bool
|Add Exp Exp
|And Exp Exp
|If Exp Exp Exp
--
View this message
Hi! I'm a begginer in haskell and I have a problem with an exercise, I expect
someone could help me:
In one hand I have a declaration of an algebra data, like this:
data AlgExp a = AlgExp
{ litI :: Int - a,
litB :: Bool - a,
add :: a - a - a,
and :: a - a - a,
ifte :: a - a - a -
Carlo Vivari wrote:
data AlgExp a = AlgExp
{ litI :: Int - a,
litB :: Bool - a,
add :: a - a - a,
and :: a - a - a,
ifte :: a - a - a - a}
You're confusing sum and product types. That is, you're using a product type,
but you probably need a sum type, like this:
data Exp1 =
foldExp :: AlgExp a - Exp - a
foldExp alg (LitI i) = litI alg i
foldExp alg (LitB i) = litB alg i
foldExp alg (add exp1 exp2) = ¿¿¿???
foldExp alg (and exp1 exp2) = ¿¿¿???
foldExp alg (ifte exp1 exp2 exp3) = ¿¿¿???
One comment: it looks like (add exp1 exp2), (and exp1 exp2) and so on
On 12/3/07, Kalman Noel [EMAIL PROTECTED] wrote:
You're confusing sum and product types. That is, you're using a product
type,
but you probably need a sum type, like this:
I'm not so sure; it looks like they already have that type (Exp) and wants
to use AlgExp to hold the folding functions
On Mon, Dec 03, 2007 at 09:27:45PM -0600, Derek Elkins wrote:
On Mon, 2007-12-03 at 19:13 -0800, Stefan O'Rear wrote:
On Mon, Dec 03, 2007 at 09:18:18AM -0800, Carlo Vivari wrote:
Hi! I'm a begginer in haskell and I have a problem with an exercise, I
expect
someone could help me:
On Mon, Dec 03, 2007 at 09:18:18AM -0800, Carlo Vivari wrote:
Hi! I'm a begginer in haskell and I have a problem with an exercise, I expect
someone could help me:
In one hand I have a declaration of an algebra data, like this:
data AlgExp a = AlgExp
{ litI :: Int - a,
litB :: Bool
On Mon, 2007-12-03 at 19:13 -0800, Stefan O'Rear wrote:
On Mon, Dec 03, 2007 at 09:18:18AM -0800, Carlo Vivari wrote:
Hi! I'm a begginer in haskell and I have a problem with an exercise, I
expect
someone could help me:
In one hand I have a declaration of an algebra data, like this:
12 matches
Mail list logo