Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: boos@gr6.u-strasbg.fr (Christian Boos)
To: "Makofka, Doug (HT-MS)" <dmakofka@gic.gi.com>
Cc: Caml-list <caml-list@margaux.inria.fr>
Subject: output_value
Date: Fri, 20 Oct 95 14:53:53 +0100	[thread overview]
Message-ID: <9510201353.AA20016@gr6> (raw)
In-Reply-To: <30871CFF@gicpo2.gic.gi.com>



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

The second form is often better, since all you need to do for
retrieval and use is something like :

  do_list SomeCrazyFunctionOnProductionValue
	(input_value chan : ProductionValue list) 

However, if your 'ProductionLst' is constructed piece by piece, and if
it may grows very large, then you need perhaps the first form, but in
a slightly different way that the one you suggested. The 'do_list ...'
you wrote only outputs ProductionValues, without any structure along
them.
So, you'd better write :

  type 'a option = Some of 'a | None;;
  
  do_list (fun p -> output_value chan (Some p)) ProductionLst;
  (* - maybe multiple times - *)

  (* and, when you're done :  *)

  output_value chan None

Latter, you can retrieve your production values one by one:

let do_production_value_chan f chan =
  let rec do_one () =
     match (input_value chan:ProductionValue) with
     | Some p -> f p; do_one ()
     | None -> ()
   in
   do_one () 
;;

Hope it helps!

---------------------------------
Christian Boos





  reply	other threads:[~1995-10-20 19:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-20  3:48 output_value Makofka, Doug (HT-MS)
1995-10-20 13:53 ` Christian Boos [this message]
1995-10-20 19:18 ` output_value Pierre Weis

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=9510201353.AA20016@gr6 \
    --to=boos@gr6.u-strasbg.fr \
    --cc=caml-list@margaux.inria.fr \
    --cc=dmakofka@gic.gi.com \
    /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