caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@ozemail.com.au>
To: William Chesters <williamc@paneris.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml complexity
Date: Fri, 08 Jun 2001 02:30:24 +1000	[thread overview]
Message-ID: <3B1FAC20.F93A7D5D@ozemail.com.au> (raw)
In-Reply-To: <15134.36136.766030.251564@beertje.william.bogus>

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, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-06-08  6:58 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-06 16:50 Miles Egan
2001-06-06 17:30 ` Chris Hecker
2001-06-06 18:25 ` Charles Martin
2001-06-06 19:27   ` Michael Hicks
2001-06-06 21:15   ` David Fox
2001-06-07 12:25   ` FabienFleutot
2001-06-08  0:27   ` Miles Egan
2001-06-06 19:36 ` William Chesters
2001-06-06 19:55   ` John Max Skaller
2001-06-06 20:06     ` William Chesters
2001-06-07 16:30       ` John Max Skaller [this message]
2001-06-08  0:32   ` Miles Egan
2001-06-08  0:56     ` David Fox
2001-06-07  7:35 ` wester
2001-06-07 17:27   ` John Max Skaller
2001-06-07  8:58 leary
2001-06-07 18:29 ` Jonathan Coupe
2001-06-08  9:41   ` leary
2001-06-08 12:27     ` Jonathan Coupe
2001-06-08 20:22       ` Chris Hecker
2001-06-08 20:31         ` Miles Egan
2001-06-08 22:17           ` Jonathan Coupe
2001-06-08 22:18             ` Miles Egan
2001-06-11 14:05             ` Pierre Weis
2001-06-09 19:41           ` John Max Skaller
2001-06-08 22:59         ` David Fox
2001-06-09  0:43         ` leary
2001-06-09  1:09           ` Mark Wotton
2001-06-09  8:36           ` Markus Mottl
2001-06-09 20:58           ` John Max Skaller
2001-06-08 22:46       ` leary
2001-06-09  1:18         ` David Fox
2001-06-12 14:17           ` John Max Skaller
2001-06-13 15:21             ` Brian Rogoff
2001-06-13 20:32               ` leary
2001-06-13 22:58                 ` Johann Höchtl
2001-06-13 21:18               ` John Max Skaller
2001-06-09 22:32         ` Jonathan Coupe
2001-06-11  0:20           ` leary
2001-06-11 20:33 Arturo Borquez
2001-06-11 21:17 ` Miles Egan
2001-06-12  7:19   ` wester
2001-06-13 21:04 David Gurr
2001-06-13 23:13 ` leary
2001-06-13 23:19 ` Brian Rogoff
2001-06-15 13:28   ` Tore Lund
2001-06-15 14:03     ` Nils Goesche
2001-06-15 14:54       ` Xavier Leroy
2001-06-15 15:14         ` Jonathan Coupe
2001-06-15 15:23         ` Nils Goesche
2001-06-15 17:38         ` Sven LUTHER
2001-06-15 20:36           ` Remi VANICAT
2001-06-15 14:16     ` Doug Bagley
2001-06-28 12:54   ` Didier Remy
2001-06-28 18:31     ` Brian Rogoff
2001-06-14 16:04 John R Harrison

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=3B1FAC20.F93A7D5D@ozemail.com.au \
    --to=skaller@ozemail.com.au \
    --cc=caml-list@inria.fr \
    --cc=williamc@paneris.org \
    /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).