caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Issac Trotts" <ijtrotts@ucdavis.edu>
To: caml-list@inria.fr
Subject: [Caml-list] Announce: Nativize 0.1
Date: Mon, 8 Mar 2004 01:11:28 -0800	[thread overview]
Message-ID: <20040308091128.GA4026@manzanita> (raw)

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


             reply	other threads:[~2004-03-08  9:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08  9:11 Issac Trotts [this message]
     [not found] ` <Pine.LNX.4.44.0403082258090.6523-100000@lcmpc4.epfl.ch>
2004-03-08 23:29   ` Issac Trotts

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=20040308091128.GA4026@manzanita \
    --to=ijtrotts@ucdavis.edu \
    --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).