Commit 81ba46b4 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-06-28 02:04:20 by afrisch] Test OCaml/CDuce interface

Original author: afrisch
Date: 2004-06-28 02:04:20+00:00
parent 566498a2
# Do "make install_cdml" before running this test
run:
ocamlc -c a.mli
../../cduce --compile a.cd
../../cdo2ml a.cdo > a.ml
ocamlfind ocamlc -package cduce -linkpkg -o a a.ml b.ml
./a
clean:
rm -f *.cmo *.cdo *.cmi a.ml *~ a
let f (g : Byte -> Byte)(s : Latin1) : Latin1 = map s with x -> g x
let x = ref Byte 'a'
let g (r : ref Byte) : [] = r := 'a'
let re (c : { x = Float }) : Float = c . x
let diag (x : Float) : {| x = Float; y = Float |} = { x = x; y = x }
let map_complex (f : (Float,Float)->Float)(c : { x = Float; y = Float })
: Float =
f (c . x, c . y)
let pp (x : Any) : Latin1 = string_of x
val f : (char -> char) -> (string -> string)
val x : char ref
val g : char ref -> unit
type complex = { x : float; y : float }
val re : complex -> float
val diag : float -> complex
val map_complex : (float * float -> float) -> complex -> float
type t = A of t | B of t * t | C of int
val pp : t -> string
print_endline (A.f Char.uppercase "Abc");;
print_endline (A.pp (A.A (A.C 2)));;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment