Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] '_a out of nowhere? (list.reverse)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Seth J. Fogarty <sfogarty@s...>
Subject: [Caml-list] '_a out of nowhere? (list.reverse)
# let cons x y = x::y
# and flip f x y = f y x ;;
val cons : 'a -> 'a list -> 'a list = <fun>
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c = <fun>
# let reverse = List.fold_left (flip cons) [];;
val reverse : '_a list -> '_a list = <fun>
# reverse [1;2;3];;
- : int list = [3; 2; 1]
# reverse ['a';'b';'c'];;
This expression has type char but is here used with type int

I've encountered similar things with references, but never with something as
basic as a fold_left. Can someone tell me why this is happening? This, to me,
is very wrong behavior. This is on Debian's OCaml 3.07.


-- 
Arav			bipsum

Aim: Sorrath		ICQ: 47462500

The same person. No difference at all. Just a different sex. -Orlando
							(Orlando, 1992)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners