Version française
Home     About     Download     Resources     Contact us    
Browse thread
OCaml efficiency/optimization?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thomas Fischbacher <Thomas.Fischbacher@P...>
Subject: Re: [Caml-list] OCaml efficiency/optimization?

On Fri, 28 Oct 2005, Tato Thetza wrote:

> I've been reading over
> http://caml.inria.fr/pub/docs/manual-ocaml/index.html and have learned
> two things:
> -lists are immutable and singly linked, which explains why 1::[2;3] is
> valid while [2,3]::1 is not, and why its efficient.
> -the proper way to ensure tail-recursive optimization
> 
> question: are these and other optimizations documented somewhere
> officially? I find it a little uncomfortable I've been learning OCaml
> without knowning such internal details. Any secrets I should definitely
> know if I were to use this language in production?

These are not really "OCaml internal details or optimizations", but rather 
ideas and techniques which have been around very long, and are relevant 
in virtually any (non-lazy) functional language.

I think you might benefit from reading the one book most often used in 
courses on the subject: Abelson & Sussman's "Structure and Interpretation 
of Computer Programs". The complete text is available online at

http://mitpress.mit.edu/sicp/

-- 
regards,               tf@cip.physik.uni-muenchen.de              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)