Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-08 (06:58)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] ocaml complexity
William Chesters wrote:
> John Max Skaller writes:
>  >      The really BIG culture shift, in my opinion,
>  > is something much simpler: syntax.
> I agree that's very significant.  C++-style syntax with camlp4,
> anyone? :)

I know there's a sort of smiley there, but this is more or
less what I'm working on: I'm developing a new programming
language, Felix, for C++ users, which has the main features
of functional programming, including closures, higher
order functions, variants, pattern matching,
modules, and garbage collection.

Felix provides overloading, uses {} to denote blocks
in which all definitions are recursive,
has type inference for variables but not functions,
uses SML/Ocaml type grammar, and binds cleanly
with C++ (partly because it's a C++ code generator).

Here's a complete working example, I hope it is
readable to both C++ and Ocaml programmers.
[I also hope 6! = 720, because that's the answer
that gets printed :=]

header '#include <stdio.h>';

type bool = "bool";
type int = "int";
proc print: int = 'printf("%d\n",$1);';
fun sub: int * int -> int = "$1 - $2";
fun mul: int * int -> int = "$1 * $2";
fun gt: int * int -> bool = "$1 > $2";

fun fact(a:int): int
  fun f (a:int, p:int) : int {
    if(a>1) return f(a-1, p*a);
    else return p;
  return f(a,1);

print (fact 6);

John (Max) Skaller,
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper
download Interscript
Bug reports:  FAQ:
To unsubscribe, mail  Archives: