[Haskell-beginners] Just clarifying the "pred" and "succ" functions in Haskell

Andy Elvey andy.elvey at paradise.net.nz
Sat Feb 6 00:27:24 EST 2010

Hi all -

I'm doing a public-domain package of "functional" programs" in C, and 
that involves trying to replicate (in C) a number of Haskell functions. 

The two that I'm looking at now are "pred" and "succ".  I've seen the 
examples on zvon.org, which give "pred 5" as being 4, and "pred B" as 
being "A".   Ok, that's fine, no problem. 

However, is my understanding correct that this can be extended to lists 
(arrays in C) so that (for example)  for a list ["foo", "bar", "baz"] 
,   "pred "bar" " would give you "foo" , and "succ "bar" "  would give 
you "baz"? 

Thanks in advance - bye for now -
- Andy 

More information about the Beginners mailing list