From: Martin Jambon <martin_jambon@emailuser.net>
To: Dmitri Boulytchev <db@tepkom.ru>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] String representation of the expression: may camlp4 help?
Date: Mon, 15 Aug 2005 13:14:29 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.63.0508151302300.6638@droopy> (raw)
In-Reply-To: <43009DF2.8090101@tepkom.ru>
On Mon, 15 Aug 2005, Dmitri Boulytchev wrote:
> Hello everybody,
>
> I'm looking for the way to get string representation of the OCaml
> expression
> at compile-time to facilitate test writing. Consider an example:
>
> let repr, value = WITH_REPR (1+2) in
> Printf.printf "%s=%d" repr value
>
> Here WITH_REPR is a meta-construction that returns ("1+2", 3) (generally
> speaking WITH_REPR(c) whould return (string * type_of c)).
>
> Is there some convinient way to do this? May camlp4 help?
Have a look at the pretty-printing functions that pr_o.ml
provides (from your Camlp4 installation). You can probably hack your own
(expr -> string) function if it does not already exist.
Martin
--
Martin Jambon, PhD
http://martin.jambon.free.fr
prev parent reply other threads:[~2005-08-15 20:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-15 13:51 Dmitri Boulytchev
2005-08-15 20:14 ` Martin Jambon [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=Pine.LNX.4.63.0508151302300.6638@droopy \
--to=martin_jambon@emailuser.net \
--cc=caml-list@inria.fr \
--cc=db@tepkom.ru \
/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