Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Missing tabs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Missing tabs
On Sun, Oct 26, 2003 at 01:17:58PM +0100, Nicolas George wrote:
> Le quintidi 5 brumaire, an CCXII, Richard Jones a 'ecrit:
> > # List.iter (printf "\t%s\n") ["foo"; "bar"; "baz"; "buz"];;
> 
> This is a FAQ: you can not partially apply the format string of
> printf-like functions. Try (fun x -> printf "\t%s\n" x) instead.

I've now read: http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#printf
thanks.

Hmmm ... This does appear to violate the principle of least surprise.

So:

  let g = Printf.printf " ** %i";;

is supposed to be equivalent to:

  let g = print_string " ** "; fun i -> print_int i;;

I would say that it should be equivalent to:

  let g = fun i -> (print_string " ** "; print_int i);;

and that the other behaviour is a bug, even if there are
implementation reasons why it is otherwise ...

Just my EUR 0.02.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you.
MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles,
RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/

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