Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Assert fail in partial application
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] Assert fail in partial application
On Thu, 10 Jun 2004, Diego Olivier Fernandez Pons wrote:

>     Bonjour,
> 
> I would like a function that contains an assert to fail in partial
> application and the test are still removed when compiling in noassert
> mode
> 
> # let f = fun x y -> assert (x > 0); assert (y > 0); x + y
> val f : int -> int -> int
> # f 0;;
> - : int -> int = <fun>
> # f 0 0;;
> Exception: Assert_failure (" ", 1, 19).

This seems to work:

# let f x = assert (x > 0); fun y -> x + y;;
val f : int -> int -> int = <fun>
# f 0;;
Exception: Assert_failure ("", 1, 10).
#

-- 
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 
Brian

-------------------
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