From: "Ludovic Coquelle" <lcoquelle@gmail.com>
To: Andrej.Bauer@andrej.com
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] invoke function from its name as string
Date: Thu, 13 Mar 2008 15:10:36 +0800 [thread overview]
Message-ID: <d6c7b34d0803130010x48c71286n1523a64aa384c5ad@mail.gmail.com> (raw)
In-Reply-To: <47D8CE92.2020009@fmf.uni-lj.si>
On Thu, Mar 13, 2008 at 2:49 PM, Andrej Bauer
<Andrej.Bauer@fmf.uni-lj.si> wrote:
> Ludovic Coquelle wrote:
> > (re-send as it seems it didn't go through)
>
> It did.
Sorry for the double post (gmail probably filtered the mail I sent to list).
> > First, hello everyone as it is my first message to this list ;)
> >
> > I'm trying to solve this problem:
> > I have a module name and function name in string variables,
> > and I would like to call this function, like :
> > let mod = "MyMod" in
> > let fn = "my_fun" in
> > what_come_here mod fn
> >
> > Can this problem be solved?
>
> If you are new to ocaml then we can help you much better if you explain
> what problem you are trying to solve. It looks like you are trying to
> write in Ocaml something that is common in Python/perl/shell. There is
> likely to be a different, better way of doing the same thing in Ocaml.
>
> Best regards,
>
> Andrej
>
Thanks for this answer.
Problem I'm trying to solve is the following:
I use 'make_suite' which is a program that do regex matching on source
code to extract a list of function that looks like OUnit tests; from
this list, it write an ocaml source code file which is a test case
that call all the previous functions found.
(see: http://skydeck.com/blog/programming/unit-test-in-ocaml-with-ounit/)
Now, instead of having a program which write a source file that I have
to compile and run, I would prefer if I can change 'make_suite' to
create the test case and run it directly.
Thus, I have a list of function's names as string and I would like a
list of functions.
Is this possible?
Is there a better way to achieve automatic test case construction?
PS: this is not a *real problem* to use an intermediate file; just
wanna learn if we can do without :)
next prev parent reply other threads:[~2008-03-13 7:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 4:07 Ludovic Coquelle
2008-03-13 5:04 ` Ludovic Coquelle
2008-03-13 6:49 ` [Caml-list] " Andrej Bauer
2008-03-13 7:10 ` Ludovic Coquelle [this message]
2008-03-13 16:41 ` Andrej Bauer
2008-03-13 17:03 ` Andrew Gacek
2008-03-14 0:53 ` Ludovic Coquelle
2008-03-13 9:44 ` Berke Durak
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=d6c7b34d0803130010x48c71286n1523a64aa384c5ad@mail.gmail.com \
--to=lcoquelle@gmail.com \
--cc=Andrej.Bauer@andrej.com \
--cc=caml-list@yquem.inria.fr \
/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