caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sam Steingold <sds@podval.org>
To: caml-list@inria.fr
Subject: programmatic access to toplevel print facilities
Date: Wed, 26 Apr 2006 14:59:02 -0400	[thread overview]
Message-ID: <alr73kp3ih.fsf@quant8.janestcapital.quant> (raw)

is there a way to access the top-level printing facilities from a program?

e.g., ocaml toploop will print a complex structure nicely:
# let x = make_my_huge_struct ();;
val x : my_huge_struct =
{a = 1; b = 2; c = 3; ...}

how do I access this from a program?
e.g., if I have an array of my_huge_struct, I want to be able to examine
a part of it:

let show_part arr p1 p2 =
  for i = p1 to p2 do
    ocaml_toploop_print (Array.get arr i)
  done

# show_part array_of_huge_structs 100 105;;

(in lisp I would do
 (loop :for i :from p1 :to p2 :do (print (aref array_of_huge_structs i))))

-- 
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 5 (Bordeaux)
http://ffii.org http://truepeace.org http://palestinefacts.org
http://memri.org http://dhimmi.com http://openvotingconsortium.org
Your mouse has moved - WinNT has to be restarted for this to take effect.


             reply	other threads:[~2006-04-26 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-26 18:59 Sam Steingold [this message]
2006-04-27  9:23 ` [Caml-list] " Richard Jones
2006-05-03 18:08 ` Lukasz Stafiniak

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=alr73kp3ih.fsf@quant8.janestcapital.quant \
    --to=sds@podval.org \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).