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 LAA02581; Tue, 20 Apr 2004 11:57:30 +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 LAA02427 for ; Tue, 20 Apr 2004 11:57:29 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3K9uhYM004673; Tue, 20 Apr 2004 11:56:43 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA02367; Tue, 20 Apr 2004 11:56:42 +0200 (MET DST) From: Pierre Weis Message-Id: <200404200956.LAA02367@pauillac.inria.fr> Subject: Re: [Caml-list] sscanf help In-Reply-To: from mohammad siddiqui at "Apr 18, 104 03:59:17 am" To: writetosafi@hotmail.com (mohammad siddiqui) Date: Tue, 20 Apr 2004 11:56:42 +0200 (MET DST) Cc: skaller@users.sourceforge.net, rich@annexia.org, caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pierre:01 weis:01 pierre:01 weis:01 caml-list:01 sscanf:01 sscanf:01 fscanf:01 clue:01 caml's:01 fscanf:01 counterparts:01 scanf:01 stateful:01 scanf:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Hello, > I am having hardtime dealing with sscanf and fscanf fucntion. I am actually > converting code from C to OCAML. The functions uses multiple sscanf > fucntions. I have no clue how to deal with this. Can anyone please help me > out? [...] The Caml's sscanf and fscanf functions are fully documented and are easier to use and much more powerful than their C counterparts; so, unless the documentation is unclear (and then please report it to me), I think your problem is more related to C programming than to some O'Caml specific scanf difficulties. In effect, the C function you gave and have to translate to Caml looks extremely stateful and imperative style in spirit, while our programming language and its scanf facility are functional (or stateless). So, even if it is possible to mimic the C program in Caml, the resulting program is likely to be inelegant and contrived by an unatural one-to-one translation. In conclusion, you had better to understand the specification of the C parsing function and then reimplement it into a (simpler) functional Caml program. Hope this helps, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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