English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] lisp to ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-09-18 (13:04)
From: Christoph Bauer <ich@c...>
Subject: Re: [Caml-list] lisp to ocaml

> Hi,
> Does anyone know of a tool that can convert lisp to ocaml (or
> something other ML dialect)? I've tried googling and couldn't find
> anythinge Just all the parentheses gets a bit confusing for a first
> look at lisp ;t)

camlp4/scheme could be interesting.

input file `example.ml':
(define f (lambda (n) (+ n 1)))

output of
% camlp4 pa_scheme.cmo pr_o.cmo example.ml
let f n = n + 1

This extension is included in the ocaml distribution under


You have to install it by yourself, e.g.

make && cp *.cmo *.cmi `ocamlc -where`/camlp4

Christoph Bauer

let () = let rec f a w i j = Printf.printf "%.20f\r" a; let a1 = a *. i /. j in
if w then f a1 false (i +. 2.0) j else f a1 true i (j +. 2.0) in f 2.0 false 2.0 1.0