Version française
Home     About     Download     Resources     Contact us    
Browse thread
programmatic access to toplevel print facilities
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sam Steingold <sds@p...>
Subject: programmatic access to toplevel print facilities
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.