Version française
Home     About     Download     Resources     Contact us    
Browse thread
Optional arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Teller <David.Teller@u...>
Subject: Re: [Caml-list] Optional arguments
What were you expecting?

Your definition of [a] always passes argument [i] to [b], so the default
value is never used.

Cheers,
 David

On Sun, 2008-11-09 at 22:17 +0300, malc wrote:
> Objective Caml version 3.10.0
> 
> # let a i = let b ?(i=i mod 3) () = i in b ~i ();;
> val a : int -> int = <fun>
> # for i = 0 to 5 do print_int (a i); done;;
> 012345- : unit = ()
> 
> Is this something to be expected? Or perhaps something which calls
> for an upgrade?
> 
-- 
David Teller-Rajchenbach
 Security of Distributed Systems
  http://www.univ-orleans.fr/lifo/Members/David.Teller
 Angry researcher: French Universities need reforms, but the LRU act brings liquidations.