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 IAA24793; Mon, 4 Nov 2002 08:54:43 +0100 (MET) 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 IAA28421 for ; Mon, 4 Nov 2002 08:54:39 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (host77-68.pool80116.interbusiness.it [80.116.68.77]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gA47sb507548 for ; Mon, 4 Nov 2002 08:54:38 +0100 (MET) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id 420042724F; Mon, 4 Nov 2002 08:54:13 +0100 (CET) Message-ID: <3DC627A5.9090900@baretta.com> Date: Mon, 04 Nov 2002 08:54:13 +0100 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: Ken Wakita Cc: Cezary Kaliszyk , caml-list Subject: Re: [Caml-list] format type References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Ken Wakita wrote: > Did you try "%t"? > > Printf.printf "%t": (out_channel -> unit) -> unit = Since Cezary mentions parsing, I suppose he meant Scanf, rather than Printf. > You could simply ignore out_channel if you are not interested. > > Ken Wakita > > >>From: Cezary Kaliszyk >>Date: Sun, 3 Nov 2002 08:08:58 +0100 >>To: caml-list@inria.fr >>Subject: [Caml-list] format type >> >>I'm trying to write a function that takes a format and a function and >>applies some (got from elsewere) arguments to the function. >> >> >> >>The only known workaround for me for now is to pass "%t" and >>make my function not (unit -> unit) but ('a -> unit). As far as I can see from the docs, "%t" is only meaningful with the Printf module. I see no mention of it in Scanf. What exactly are you trying to do anyway? Assuming you are talking about the Scanf module, I'd say you can't. Of course, if your function takes a unit input, it can very well be a perfectly polymorphic function (à la ignore) with type ('a -> unit). In which case you can force a call to such function while scanning the input buffer by passing it a range conversion with an empty range: "%[^\000-\255]". Your function would be called with an empty string as an actual parameter. Or, better yet, you can use the "%N" conversion, which passes the number of characters consumed. Just discard this value. >>Writing code with changed types just for the sake of the language is >>very bad. And with "%t" 'a seems to be (unit -> unit). It is also very bad to complain without doing any work yourself. You are probably the only one on this list wishing to call a function with no input while parsing a buffer. Nothing wrong with this, apart from stylistic considerations, but it implies two things: 1) I don't suppose Pierre ever even thought of such a conversion for Scanf, and 2) even if he did, I doubt he'd care to implement it. If you really think it is necessary, you might consider hacking it into the Scanf module and submitting the patch to the maintainers. Alex ------------------- 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