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.

help an o'caml beginner
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2000-08-02 (11:10) From: Markus Mottl Subject: Re: help an o'caml beginner
```On Sat, 29 Jul 2000, John BEPPU wrote:
> This one was faster than the C version I posted.

It should be, because it computes the fibonacci function in logarithmic
time, whereas the "usual" function does it in linear time (fib2). The
"simple" fibonacci implementation (fib1) is even worse: exponential time.

> The others were pretty close, too.  I continue to
> be impressed.  I have a hard time believing fib3
> was created by a mechanical transformation...  it
> doesn't look anything like the other implementations.
> I mean, I believe you as a matter of good faith, but
> I'm amazed.

No, the OCaml-code was not generated by automated transformations, but the
techniques are known and presented in the reference I mentioned - I just
took their "transformed" solution and translated it to OCaml. But it is
principally possible to apply such transformation techniques to functional
languages in general, because of their nice mathematical properties.

Since implementing such transformation systems correctly is a fairly
difficult task, there are not yet many around, and those that exist
normally operate on simplified languages to make life for researchers
easier...

> <question type="stupid">
>     What does the keyword "in" mean?
> </question>

It is just a keyword to prevent ambiguities when writing expressions. E.g.:

let x = y z ...

is not the same as

let x = y in
z ...

Best regards,
Markus Mottl

--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl

```