caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Announce: Nativize 0.1
@ 2004-03-08  9:11 Issac Trotts
       [not found] ` <Pine.LNX.4.44.0403082258090.6523-100000@lcmpc4.epfl.ch>
  0 siblings, 1 reply; 2+ messages in thread
From: Issac Trotts @ 2004-03-08  9:11 UTC (permalink / raw)
  To: caml-list

Nativize : Compile and run native functions from the toplevel.

http://redwood.ucdavis.edu/~issac/software/nativize-0.1.tar.gz

Introduction
============
  It is useful to be able to easily run native code from the toplevel.
  Nativize makes this possible for functions whose arguments and return
  values can be serialized using the functions in OCaml's Marshal
  module.

Example: running Ackermann's function in the toplevel
=====================================================

# #require "nativize";;
Loading /usr/lib/ocaml/3.07/nativize/nativize.cma
# Nativize.nativize "Ack1" "
  let rec ack m n =
      if m = 0 then n + 1
      else if n = 0 then ack (m - 1) 1
      else ack (m - 1) (ack m (n - 1));;
  " [];;
Please type #load "Ack1.cmo";;
- : unit = ()
# #load "Ack1.cmo";;
# assert(Ack1.ack 5 0 = 65533);; (* Wait about 10 seconds. *)
- : unit = ()
# let rec ack m n =
      if m = 0 then n + 1
      else if n = 0 then ack (m - 1) 1
      else ack (m - 1) (ack m (n - 1));;
# ack 5 0;;  (* Wait a good while longer. *)

-- 
Issac Trotts
http://redwood.ucdavis.edu/~issac

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2004-03-08 23:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-08  9:11 [Caml-list] Announce: Nativize 0.1 Issac Trotts
     [not found] ` <Pine.LNX.4.44.0403082258090.6523-100000@lcmpc4.epfl.ch>
2004-03-08 23:29   ` Issac Trotts

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