caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* programmatic access to toplevel print facilities
@ 2006-04-26 18:59 Sam Steingold
  2006-04-27  9:23 ` [Caml-list] " Richard Jones
  2006-05-03 18:08 ` Lukasz Stafiniak
  0 siblings, 2 replies; 3+ messages in thread
From: Sam Steingold @ 2006-04-26 18:59 UTC (permalink / raw)
  To: caml-list

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.


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

end of thread, other threads:[~2006-05-03 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-26 18:59 programmatic access to toplevel print facilities Sam Steingold
2006-04-27  9:23 ` [Caml-list] " Richard Jones
2006-05-03 18:08 ` Lukasz Stafiniak

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