Browse thread
[Caml-list] failwith, raise and type inference
-
Paul Guyot
- Frederic van der Plancke
- Correnson_Loïc
- Nicolas Cannasse
- Luc Maranget
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Nicolas Cannasse <warplayer@f...> |
| Subject: | Re: [Caml-list] failwith, raise and type inference |
> >let rec f1 key dict =
> > match dict with
> > [] -> failwith "The key " ^ key ^ " could not be found"
> > | (aKey, aValue)::tail ->
> > if (aKey = key)
> > then aValue
> > else f1 key tail;;
The tip is here :
failwith "The key " ^ key ^ " could not be found"
is actually equivalent to :
(failwith "The key ") ^ key ^ " could not be found"
and different from (what you were thinking) :
failwith ("The key " ^ key ^ " could not be found")
Regards,
Nicolas Cannasse
-------------------
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