* 'a -> string ?
@ 1997-10-16 10:19 GillesDfnx
1997-10-16 21:32 ` wakita
1997-10-17 8:59 ` Xavier Leroy
0 siblings, 2 replies; 3+ messages in thread
From: GillesDfnx @ 1997-10-16 10:19 UTC (permalink / raw)
To: caml-list
Bonjour,
je cherche une fonction similaire à
val output_value : out_channel -> 'a -> unit
mais qui écrirait la représentation de l'élément de type 'a dans une
'string' au lieu d'un 'out_channel' (pour pouvoir le sauver dans dbm
après). Je voudrais éviter de recourir à un fichier temporaire suivi
d'un appel à 'input'.
Quelqu'un s'est-il déjà penché sur le problème ?
Merci,
Gilles
--- english ---
Hello,
I'm looking for an equivalent of
val output_value : out_channel -> 'a -> unit
that would output the representation of the element of type 'a into a
'string' instead of and 'out_channel' (for subsequent inclusion into a
dbm database). I would like to avoid using a temp file followed by an
'input' call.
Has anybody already designed such a function ?
Thank you,
Gilles
--
\\///
#include <std.disclaimer> (O O)
--------------------------------------------oOo--(_)--oOo--------
Gilles DEFOURNEAUX \ /
Automated Deduction Team |
ATINF project - LEIBNIZ lab --|--
Grenoble, FRANCE 0 GillesDfnx@mail.dotcom.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 'a -> string ?
1997-10-16 10:19 'a -> string ? GillesDfnx
@ 1997-10-16 21:32 ` wakita
1997-10-17 8:59 ` Xavier Leroy
1 sibling, 0 replies; 3+ messages in thread
From: wakita @ 1997-10-16 21:32 UTC (permalink / raw)
To: GillesDfnx; +Cc: caml-list
Hi,
Try the following:
external my_marshal : 'a -> string = "output_value_to_string"
Ken
On Thu, 16 Oct 1997 12:19:19 +0200 (MET DST)
GillesDfnx@mail.dotcom.fr wrote:
>
> Bonjour,
>
> je cherche une fonction similaire
>
> val output_value : out_channel -> 'a -> unit
>
> mais qui 馗rirait la repr駸entation de l'駘駑ent de type 'a dans une
> 'string' au lieu d'un 'out_channel' (pour pouvoir le sauver dans dbm
> apr鑚). Je voudrais 騅iter de recourir
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 'a -> string ?
1997-10-16 10:19 'a -> string ? GillesDfnx
1997-10-16 21:32 ` wakita
@ 1997-10-17 8:59 ` Xavier Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 1997-10-17 8:59 UTC (permalink / raw)
To: GillesDfnx; +Cc: caml-list
> I'm looking for an equivalent of
>
> val output_value : out_channel -> 'a -> unit
>
> that would output the representation of the element of type 'a into a
> 'string' instead of and 'out_channel' (for subsequent inclusion into a
> dbm database). I would like to avoid using a temp file followed by an
> 'input' call.
In the current release (OCaml 1.05), you can do that using
undocumented features, as follows:
let output_value_to_string v = Obj.marshal(Obj.repr v)
The forthcoming release 1.06 will provide a nicer interface for this
feature.
Regards,
- Xavier Leroy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-10-17 12:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-16 10:19 'a -> string ? GillesDfnx
1997-10-16 21:32 ` wakita
1997-10-17 8:59 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox