[Haskell-cafe] Missing Symbol (2)

Thomas Hartman thomas.hartman at db.com
Wed Sep 19 10:04:40 EDT 2007


as provided, this won't compile because v hasn't been defined.

f [] = 0
f (x:xs) = x . f xs

compiles but gives 

f :: (Num (a -> c)) => [c -> c] -> a -> c

which seems wrong. maybe I'm not understanding what v is not supposed to 
be.

I am thinking maybe you want iterate

*Main> take 5 $ iterate (+1) 0
[0,1,2,3,4]

It would be easier to understand your desired function if you would 
provide an example of desired usage.

t.




PR Stanley <prstanley at ntlworld.com> 
Sent by: haskell-cafe-bounces at haskell.org
09/19/2007 02:17 AM

To
haskell-cafe at haskell.org
cc

Subject
[Haskell-cafe] Missing Symbol (2)






Hi
Here's another one:
f [] = v
f (x:xs) = x . f xs
The "." is supposed to denote a generic operator - f [] maps to some 
value v and applied to non-empty list applies head to ? operator.
Thanks, Paul

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070919/b4cf210f/attachment.htm


More information about the Haskell-Cafe mailing list