From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA16740; Sat, 27 Sep 2003 09:23:28 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA23799 for ; Sat, 27 Sep 2003 09:23:27 +0200 (MET DST) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h8R7NQH15767 for ; Sat, 27 Sep 2003 09:23:26 +0200 (MET DST) Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1A39QM-0007v6-00 for ; Sat, 27 Sep 2003 08:23:26 +0100 Date: Sat, 27 Sep 2003 08:23:25 +0100 Cc: caml-list@inria.fr Subject: Re: [Caml-list] Printf question Message-ID: <20030927072325.GA14604@redhat.com> References: <20030926180248.GA14053@redhat.com> <16244.54690.54537.392805@karryall.dnsalias.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16244.54690.54537.392805@karryall.dnsalias.org> User-Agent: Mutt/1.5.4i From: Richard Jones X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 printf:01 andrieu:01 fprintf:01 sprintf:01 string':01 freshmeat:01 vectors:01 hashes:01 funcs:01 allocator:01 ltd:98 0200,:01 lib:01 lib:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, Sep 27, 2003 at 02:11:14AM +0200, Olivier Andrieu wrote: > You could use the %a format. See the Prinf module documentation : > > * `a': user-defined printer. Takes two arguments and apply the first > one to `outchan' (the current output channel) and to the second > argument. The first argument must therefore have type `out_channel > -> 'b -> unit' and the second `'b'. The output produced by the > function is therefore inserted in the output of `fprintf' at the > current point. > > (that's for fprintf, for sprintf the printer would be of type > `unit -> 'b -> string') I guess the problem with this is that I lose any type safety, which is the whole point of doing things this way. 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. C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes, trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/ ------------------- 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