Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: output_value
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <weis@p...>
Subject: Re: output_value

> could someone comment on the difference between:
>     do_list (output_value chan) ProductionLst
> and
>     output_value chan ProductionLst

If you output the entire list at once you preserve sharing between
values (and their subparts) that are in the list. This could make a
big difference. Still, when you input the list its very easy to
iterate on it.

Otherwise, if there is no sharing involved, and if you want to spare the space
occupied by the list cells, output the elements. Then you can input
them one at a time until end_of_file is reached.
  while true do f (input_value chan) done
 with Eof -> ())

Pierre Weis
WWW Home Page:
Projet Cristal
INRIA, BP 105, F-78153 Le Chesnay Cedex (France)
Telephone: +33 1 39 63 55 98
Fax: +33 1 39 63 53 30