caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <pierre.weis@inria.fr>
To: writetosafi@hotmail.com (mohammad siddiqui)
Cc: skaller@users.sourceforge.net, rich@annexia.org, caml-list@inria.fr
Subject: Re: [Caml-list] sscanf help
Date: Tue, 20 Apr 2004 11:56:42 +0200 (MET DST)	[thread overview]
Message-ID: <200404200956.LAA02367@pauillac.inria.fr> (raw)
In-Reply-To: <BAY7-F39GA9jq8lUrrk00056a79@hotmail.com> from mohammad siddiqui at "Apr 18, 104 03:59:17 am"

> 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


      reply	other threads:[~2004-04-20  9:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-18  3:59 mohammad siddiqui
2004-04-20  9:56 ` Pierre Weis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404200956.LAA02367@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    --cc=skaller@users.sourceforge.net \
    --cc=writetosafi@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).