From: Basile STARYNKEVITCH <basile@starynkevitch.net>
To: mohammad siddiqui <writetosafi@hotmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] help
Date: Fri, 9 Apr 2004 08:56:23 +0200 [thread overview]
Message-ID: <20040409065623.GA19890@ours.starynkevitch.net> (raw)
In-Reply-To: <BAY7-F1164a9MipUWPz0003ecd7@hotmail.com>
On Thu, Apr 08, 2004 at 10:57:26PM +0000, mohammad siddiqui wrote:
> I am new to OCAML. I Just started learning. I need to convert the
> source code of an application which runs in 4000 lines from C to
> OCAML.
You didn't tell use what kind of application is it...
> Can anyone help me how to get started?
I tend to believe that such a conversion is primarily a waste of
time.... And more importantly, if you convert blindly, you will get
ugly (and hardly maintainable) Ocaml code. You'll probably get an
Ocaml program as big as the original C source.
A more practical alternative might be to consider your lower C
routines as building blocks, ie to interface each of your (few) lower
C routines to Ocaml, and to recode the higher part of the application
in Ocaml.
You could also try to implement the same algorithms in Ocaml.
For completeness, you could translate your C code into an ugly,
unmaintainable Ocaml mess using references for C variables and mutable
fields all over the place. But the code will be shameful and you won't
learn anything doing it.
I strongly suggest - if you want to learn Ocaml :
first, to learn to code thru some basic (100 lines) programs -
learning how to use tail recursion and avoiding mutable data (and more
generally limiting side effects).
then, reimplement your 4000 C line program, starting from a
highlevel abstract view of the algorithm (not from the C source);
I'll bet you should get an Ocaml program smaller than 2000 lines.
There are many interesting books & online resources to learn Ocaml.
Starting by translating a C program into any better language is a bad way
to learn this better language (whatever the better language is).
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
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
next prev parent reply other threads:[~2004-04-09 6:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-08 22:57 mohammad siddiqui
2004-04-09 6:56 ` Basile STARYNKEVITCH [this message]
2004-04-09 9:04 ` Richard Jones
-- strict thread matches above, loose matches on Subject: below --
2004-04-25 16:30 mohammad siddiqui
2004-04-25 1:53 ` mohammad siddiqui
2004-04-25 12:13 ` Jon Harrop
2004-04-25 12:45 ` Henri DF
2004-04-26 19:13 ` Jon Harrop
2004-04-26 22:38 ` Andrew Lenharth
2004-04-25 17:28 ` Matt Gushee
2004-04-25 17:06 ` Jon Harrop
2004-04-25 17:39 ` Matt Gushee
2004-04-26 0:45 ` skaller
2004-04-23 2:31 mohammad siddiqui
2004-04-23 4:17 ` Jon Harrop
2004-04-23 6:52 ` Jean-Christophe Filliatre
2004-04-23 15:43 ` Brian Hurt
2004-04-22 23:34 mohammad siddiqui
2004-04-22 23:57 ` Karl Zilles
2004-04-16 18:04 mohammad siddiqui
2004-04-16 18:59 ` skaller
2004-04-17 0:34 ` Shawn Wagner
2002-11-05 12:22 ÀîÒÇ
2002-11-05 13:39 ` Alessandro Baretta
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=20040409065623.GA19890@ours.starynkevitch.net \
--to=basile@starynkevitch.net \
--cc=caml-list@inria.fr \
--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