Where can I find a clear description of how OCaml executes code. In particular, I want to understand when functions with several values are evaluated - is the...
andrew cooke
andrew@...
Nov 3, 2004 7:03 pm
2734
... No, for example # let f1 x = x;; val f1 : 'a -> 'a = <fun> # let f2 x = -x;; val f2 : int -> int = <fun> # let example1 a b x = let a' = f1 a in let b' =...
On Wed, 3 Nov 2004 16:03:20 -0300 (CLST), andrew cooke ... These two are equivalent. I have a question, however, for the list. Why does example2, when so...
Thanks for the reply. Just to get this straight, because i think I wasn't anything like clear enough (I was not talking about function signatures, but about...
andrew cooke
andrew@...
Nov 4, 2004 12:54 am
2737
On Wed, 3 Nov 2004 21:54:11 -0300 (CLST), andrew cooke ... let example1 a b x = let a' = f1 a in let b' = f2 b in f3 a' b' x let example2 a b = let a' = f1 a...
... You guys can play with the hidden counter example. The problem is: create a function that takes as argument the first value of a counter that should be...
Thanks! (I hadn't even thought about how you might preserve polymorphism within the loop). Andrew ... -- ` __ _ __ ___ ___| |_____ work web site:...
andrew cooke
andrew@...
Nov 4, 2004 8:03 pm
2740
That seems easy to do with a reference, but how does it shed light on the relative optimisations for examples 1 and 2? Are you saying that the optimisations...
andrew cooke
andrew@...
Nov 4, 2004 8:05 pm
2741
... Yes. OCaml is not a pure functional language. It is possible to make a program compute things in a specified order without difficulties. And the compiler...
RE: counter example. That was easy enough. Still not sure why # let f1 x = x;; val f1 : 'a -> 'a = <fun> # let f2 x = x;; val f2 : 'a -> 'a = <fun> # let f3 a...
... I don't know why it is like this (but I don't want to know :-) There are a few paragraphs about this topic in the FAQ if you did not read it yet: ...
I had seen those, yes. Still don't really undersand it. Are the pages translated? On Thu, 4 Nov 2004 18:28:21 -0800 (PST), Martin Jambon ... -- Seth Fogarty...
... The monomorphic types '_a and others are needed in order to ensure type safety. for example : let id x = x let f = ref id ... if it's type was 'a -> 'a ,...
... Thanks... that's the example I needed to fit this in my head. I'm still slightly bothered by the fragility with which '_a is introduced or not. # let f a b...
On Wed, 3 Nov 2004 16:03:20 -0300 (CLST), andrew cooke ... The awnser of Issac is correct, but I wabt to insist one one thing : the ocaml semantic is the more...
... It's easy. You get monorphic variables every time you having polymorphic variables on the right side of a let x = ... expression . That means for values...
... well, when the typer compute the type of an expression, he only know the type of the part of the computation. So if two function do have the same type, and...
... It's called 'value restriction'. For full polymorphism, the expression on the right hand side of the '=' sign must be a value. ... (a,b) is a value. ... 'f...
... Well not exactly, if the value on the right hand side of the = is an hashtable for example, it is a value, but it won't be polymophic (it would be realy...
... I was under the impression that current O'Caml, like SML 97, employed a system of value polymorphism as suggested by Andrew Wright in his paper "Simple...
Hi, How do I find the directory in which the executable is located (I want to be able to read data from files that are part of my program's install directory)....
andrew cooke
andrew@...
Nov 5, 2004 5:59 pm
2756
... Compile the following code to find out: let () = let dir = Filename.dirname Sys.argv.(0) in print_endline dir...
Christophe TROESTLER
Christophe.Troestler@...
Nov 5, 2004 8:28 pm
2757
... Of course, that only works if you supply the full path to the executable when you call it. If you have the executable somewhere in your path, for example,...
... I've had a need to do this, too, and the only solution I could come up with was to preprocess the file during compilation so that the location is...
... to ... This is system dependant issue and I have been reporting this problem to OCaml team. On windows for example, if your exe is in the PATH you can only...
... On Unix this isn't possible in general. For example, the executable might have been deleted. However there are various heuristics you can use to try to...