caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Defining own types printers.
@ 1993-04-21 17:13 michel
  1993-04-22  0:58 ` Xavier Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: michel @ 1993-04-21 17:13 UTC (permalink / raw)
  To: Caml Light Mailing list

Hi,

I have some user-defined types , and I'd like to have them printed the
ritgh way under caml-ligth when I just want to see the contents of a var ->

Ex:
---
#x1;;
- : t_bdd_tree = cNode {label="x1"; alors=cNode {label="x2"; alors=cNode {label="x3"; alors=cTerm false; sinon=cTerm false}; sinon=cNode {label="x3"; alors=cTerm
 false; sinon=cTerm true}}; sinon=cNode {label="x2"; alors=cNode {label="x3"; alors=cTerm false; sinon=cTerm true}; sinon=cNode {label="x3"; alors=cTerm false; s
inon=cTerm true}}}
#

I'd like to see ->

#print_bdd x1;;
(x1, (x2, (x3, 0, 0), (x3, 0, 1)), (x2, (x3, 0, 1), (x3, 0, 1)))- : unit = ()

I see at the page #231 of the Caml-light ref manual, that the chapter
will deal with Streams, parsers and printers but there's nothing
concerning user-defined printers (like in CAML).

My question is : Is it possible to attach printers to user defined
types ?

BTW, I wrote in english, since there might be some non-french readers
reading this question.

Thank you in advance.
-- 
  Olivier MICHEL                           Email : michel@lri.lri.fr 
  Laboratoire LRI - Universite PARIS_SUD         : michel@FRLRI61.BITNET
  Bat. 490- bureau 69                      Fax   : 33-1-64-46-19-92
  91405 ORSAY CEDEX                        Phone : 33-1-69-41-65-79
  FRANCE                                   

"if you're not programming functionally, then you must be programming
dysfunctionally"




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Defining own types printers.
  1993-04-21 17:13 Defining own types printers michel
@ 1993-04-22  0:58 ` Xavier Leroy
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 1993-04-22  0:58 UTC (permalink / raw)
  To: michel; +Cc: caml-light

Bonjour,

La liste caml-light ne regroupant que des francophones, je vous
reponds en francais. Il y a un trait non documente de Caml Light 0.5
qui fait exactement ce que vous voulez: 

        new_printer "t_bdd_tree" print_bdd;;

C'est non documente parce que non sur (personne ne verifie que
print_bdd prend des arguments de type t_bdd_tree), mais quand meme
dans le systeme parce que tellement utile...

Il y a aussi default_printer "t_bdd_tree" qui annule l'effet de
new_printer.

- Xavier Leroy




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Defining own types printers.
       [not found] <9304220845.AA07570@margaux.inria.fr>
@ 1993-04-22 18:58 ` Xavier Leroy
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 1993-04-22 18:58 UTC (permalink / raw)
  To: Pierre Weis


> >         new_printer "t_bdd_tree" print_bdd;;
> Il me semble que cette question et sa re'ponse est interessante pour
> tout le monde. Puis-je les bouncer ds la tribune de discussion de Caml ?

Oui, certainement, quoique du coup j'aurais pu repondre en anglais.

- Xavier




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1993-04-23 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-04-21 17:13 Defining own types printers michel
1993-04-22  0:58 ` Xavier Leroy
     [not found] <9304220845.AA07570@margaux.inria.fr>
1993-04-22 18:58 ` Xavier Leroy

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).