Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread David Tolpin
> type Person = (NI, Age, Balance) > type Bank = [Person] > > credit :: Bank -> [Person] > credit [(a,b,c)] = [(a,b,c)] if c >= 0 > then [(a,b,c)] > else error "overdrawn customer" > > except this doesn't work with things like: > > credit [(1,2,3),(4,5,6

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread Andrew Coppin
Donald Bruce Stewart wrote: Don types faster than me. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread Donald Bruce Stewart
junkywunky: > > That's the thing. I want to return a list of people who are not overdrawn. > Something like: > > type NI = Int > type Age = Int > type Balance = Int > type Person = (NI, Age, Balance) > type Bank = [Person] > > credit :: Bank -> [Person] > credit [(a,b,c)] = [(a,b,c)] if c >= 0

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread junkywunky
That's the thing. I want to return a list of people who are not overdrawn. Something like: type NI = Int type Age = Int type Balance = Int type Person = (NI, Age, Balance) type Bank = [Person] credit :: Bank -> [Person] credit [(a,b,c)] = [(a,b,c)] if c >= 0 then [(a,b,c

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread Andrew Coppin
junkywunky wrote: type Person = (NI, Age, Balance) type Bank = [Person] credit :: Bank -> [Person] credit [(a,b,c)] = [(a,b,c)] This code works when I type in: credit [(1,2,3)] but doesn't work when I type in: credit [(1,2,3),(4,5,6)] Any help? Thanks in advance. The expression [(1,2,

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread Donald Bruce Stewart
junkywunky: > > type Person = (NI, Age, Balance) > type Bank = [Person] > > credit :: Bank -> [Person] > credit [(a,b,c)] = [(a,b,c)] > > This code works when I type in: > > credit [(1,2,3)] > > but doesn't work when I type in: > > credit [(1,2,3),(4,5,6)] You're pattern matching in 'credit'

[Haskell-cafe] Newbie list question

2007-05-27 Thread junkywunky
type Person = (NI, Age, Balance) type Bank = [Person] credit :: Bank -> [Person] credit [(a,b,c)] = [(a,b,c)] This code works when I type in: credit [(1,2,3)] but doesn't work when I type in: credit [(1,2,3),(4,5,6)] Any help? Thanks in advance. -- View this message in context: http://www