caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Optional arguments
@ 2008-11-09 19:17 malc
  2008-11-09 19:51 ` [Caml-list] " David Teller
  0 siblings, 1 reply; 5+ messages in thread
From: malc @ 2008-11-09 19:17 UTC (permalink / raw)
  To: caml-list

         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?

-- 
mailto:av1474@comtv.ru


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Optional arguments
@ 2001-02-08 12:50 Serguei Ouklonski
  2001-02-09  1:19 ` Jacques Garrigue
  0 siblings, 1 reply; 5+ messages in thread
From: Serguei Ouklonski @ 2001-02-08 12:50 UTC (permalink / raw)
  To: caml-list

Hi,

Example1:

let fn1 a:string (?b = "") = (String.length a) + (String.length b)

let x = fn1 "test"

  result is function

Example2:

let fn1 (?a = "") b:string = (String.length a) + (String.length b)

let x = fn1 "test"

  result is 4 (number)


It seems that in both cases result should be 4.

Have I missed something from OCaml docs?


Regards

Serguei Ouklonski



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-10 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-09 19:17 Optional arguments malc
2008-11-09 19:51 ` [Caml-list] " David Teller
2008-11-10 20:52   ` malc
  -- strict thread matches above, loose matches on Subject: below --
2001-02-08 12:50 Serguei Ouklonski
2001-02-09  1:19 ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).