Hi, I'm writing a couple of modules implementing a binary tree. Im proceeding adding a functions one by one becouse of checking with ocaml interpreter. Here...
4891
micha
scheischeischei
Nov 1, 2005 12:29 pm
On Tue, 01 Nov 2005 12:59:21 +0100 ... that's rigth not right, so ocaml is right :-) Michael...
4892
Java
segolas1212
Nov 1, 2005 1:50 pm
... ARGH! I lost lots of time checking errors like theese, anyone knows if is there a possibility to let ocaml interpreter highlight the error line? It only...
4893
Jon Harrop
harropjon
Nov 1, 2005 2:17 pm
... It should underline the error by default. Are you using Windows or something? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for...
4894
Richard Jones
rwmjones
Nov 1, 2005 2:20 pm
On Tue, Nov 01, 2005 at 12:59:21PM +0100, Java wrote: [...] Someone else has found the obvious error; I have a few other ... You're using tuples as parameters,...
4895
William D. Neumann
scoey13
Nov 1, 2005 2:43 pm
... Well, it does. (********************************************************) Objective Caml version 3.09.0 # type 'a tree = ... let rec search (x, tree) = ...
4896
Java
segolas1212
Nov 1, 2005 3:16 pm
I'm getting crazy {O.o} first of all a very beginner question: writing "let rec search x tree" is the same as "let rec search (x,tree)"???? (if not pleas...
4897
Holger Schulz
schulz_mathe
Nov 1, 2005 3:27 pm
I want to implement an operator "comp" which shall deliver the composition of two functions. I said let comp : ('b -> 'c) -> ('a -> 'b) -> ('a -> 'c) = fun f g...
4898
Jonathan Bryant
jonboy3182
Nov 1, 2005 3:30 pm
... No, it is not. (x, tree) is a tuple, which is a single type/entity/whatever word you want to use. parenthesis and commas are not used in OCaml to...
4899
Richard Jones
rwmjones
Nov 1, 2005 4:04 pm
... No they're not the same. let rec search x tree = (* definition *) defines a recursive function called search which takes two parameters. Whereas: let rec...
4900
Java
segolas1212
Nov 1, 2005 4:09 pm
... Ok, thanks for the link...
4901
Richard Jones
rwmjones
Nov 1, 2005 4:14 pm
... I think this is just because -> is right-associative. The toplevel is just omitting parentheses where it can. Rich. -- Richard Jones, CTO Merjis Ltd. ...
4902
Java
segolas1212
Nov 1, 2005 4:20 pm
... Ok, but I need to use tuples becouse I'm defining data types for a didattical language. Or probably my teacher knows ML syntax and say us touse Ocaml...
4903
William D. Neumann
scoey13
Nov 1, 2005 4:22 pm
... I think he was referring to OCaml's renaming of his polymorphic parameters. E.g. # type 'blah_blah tree = E ... type 'a tree = E | N of 'a tree * 'a * 'a...
4904
Java
segolas1212
Nov 1, 2005 5:51 pm
Hi, I need to build a tree datatype defined like this: "type 'a tree = Empty | Node of 'a * 'a tree * 'a tree" How can I print all the leafs in this way? I...
4905
micha
scheischeischei
Nov 1, 2005 6:22 pm
On Tue, 01 Nov 2005 18:51:13 +0100 ... for example: let rec frontiera tree = match tree with ... you can change the placement of the print to change how the...
4906
William D. Neumann
scoey13
Nov 1, 2005 6:42 pm
... Well, there are a couple of problems here. The one you are having now, I'm guessing, is due to your not handling cases like Node (y,Empty,right) ...
4907
Java
segolas1212
Nov 1, 2005 7:03 pm
... RIGHT!!! thanks a lot Segolas...
4908
Brian Hurt
bhurt42
Nov 1, 2005 7:49 pm
... You've already figured out the problem, now I want to solve the problem you were trying to solve- which is probably that you wanted to raise the exception...
4909
Holger Schulz
schulz_mathe
Nov 2, 2005 3:59 pm
... I'd call that a disadvantage of O'Caml. Thanks. hs...
4910
Jon Harrop
harropjon
Nov 2, 2005 4:06 pm
... I don't think anyone has mentioned the problem that your leaves (nodes with no children) are all Empty, so there isn't a whole lot to print. ;-) -- Dr Jon...
4911
vamsika2004
Nov 2, 2005 4:28 pm
Also I think you are missing two cases ... --Vamsi ... frontiera(right) ... (nodes with no...
4912
vamsika2004
Nov 2, 2005 4:38 pm
We have to build a binary tree data structure for out software. And on the tree we distinguish nodes into either ordinary nodes or handles. type node = Leaf of...
4913
Seth J. Fogarty
aravthamis
Nov 2, 2005 7:40 pm
... It is isomorphic to what you ordered. OCaml is NOT ignoring your type suggestions, it is simply using different names. This is a subtle distinction, but an...
4914
Brian Hurt
bhurt42
Nov 2, 2005 11:12 pm
... If this is the biggest disadvantage Ocaml has, count your blessings. Brian...
4915
Jon Harrop
harropjon
Nov 3, 2005 12:05 am
... The type that you specify is plugged into the unifier and the result of unification is not necessarily the same. For example: # let f : 'a -> 'b = fun x ->...
4916
Hugo Ferreira
hugotwo3
Nov 3, 2005 10:41 am
Hi, While looking at my imperative style code for the set-union algorithm to make it functional I realized that I could speed it up because I was setting ...
4917
Frederic van der Plan...
fplancke2001
Nov 3, 2005 10:53 am
... No, "let s_b = v in sequel" creates a new variable named s_b that shadows the variable defined and bound by the match. That new s_b variable is indeed...
4918
Hugo Ferreira
hugotwo3
Nov 3, 2005 11:34 am
Hi Frédéric, ... You are so correct. Obviously I should have seen this. ... Not what I am looking for. In the above we are just setting s_b's value to v's ...
4919
William D. Neumann
scoey13
Nov 3, 2005 3:15 pm
... Well, that's not what you're doing. What "let _ = s_v = ref b in blah" does is check to see if s_v is equal to ref b (i.e. if it is a reference that...