Le lundi 31 mai, à 21h30 -0500, ... What's wrong with the previously mentionned module encapsulation ? # module A = struct type a = {b:int} end;; module A :...
I would like to see some examples of the usage of Arg please. I have seen examples in the Ocaml book and also in Markus Mottl's example of grep but I would...
Johann Spies
jspies@...
Jun 1, 2004 1:19 pm
2036
... Module encapsulation is what generally should be used; I was just providing ideas for temporary 'hack' alternatives that can be sufficient for cases that ...
Jeffrey J. Cook
jjcook@...
Jun 1, 2004 5:12 pm
2037
... Rich, Thanks for the link. I guess I got it. -- Manfred...
Hello I have tried to devellop applications with ocaml, going deeper than simple student applications. But every time I try to compile more than 3 or 4 files...
... Thanks. Most of what you did I have used in the past. Your "collection" is something that gives a hint to me. I still do would like examples of using...
Johann Spies
jspies@...
Jun 2, 2004 10:45 am
2040
... You've noticed that Arg.parse takes an argument (``anon_fun'' in the documentation) which is called for each remaining argument on the command line? No...
Unfortunately, if you don't like emacs you're in trouble, because there are not many options. In my case, I would like very much an eclipse plugin with OCaml...
... Why not use OCAMLMAKE file together with Vi ? It is quite straight forward. And wondering whether KDevelop can be that convenient if it can handle ocaml. ...
... Thanks Keith, Richard and the others. I have a better picture of the usage now and will use Arg more often than in the past. Regards Johann -- Johann Spies...
Johann Spies
jspies@...
Jun 3, 2004 1:55 pm
2044
Hi. I'd like to reach nth element of a tuple. I can't understand how it is done in Pervasives module, where I've found sth like fst : 'a * 'b -> 'a =...
... ML has a nice feature for doing this: #3 (a, b, c, d) ==> c But OCaml doesn't have such a feature. If you know how long your tuple is, then you can...
... Sorry, I reread your original message a bit more closely! It *is* possible to get the n'th element in a tuple using primitives, but it is horribly unsafe....
... A much clearer implementation would be: let fst (a, _) = a;; let snd (_, b) = b;; Note that these functions only work on two-element tuples, not on tuples ...
... This is a trickier operation than it looks like, because lists are immutable. To remove the nth element from the list, you need to allocate n-1 new list...
... Here is a slightly more general approach: # let head (a,b) = a;; val head : 'a * 'b -> 'a = <fun> # let tail (a,b) = b;; val tail : 'a * 'b -> 'b = <fun> #...
In C# it is possible to do something like this: XmlSerializer serializer = new XmlSerializer(typeof(MyClass)); TextWriter writer = new StreamWriter(filename); ...
From: Radu Grigore <radugrigore@...> Subject: "ocaml_beginners"::[] data structure serialization Date: Sun, 6 Jun 2004 23:48:34 -0700 (PDT) ... There...
Yamagata Yoriyuki
yoriyuki@...
Jun 7, 2004 6:57 am
2055
... An element in a list can be identified by its very nature or by its relationship with the list, say, its position. In case it is identified by its nature,...
I want to store all the objects of a class in a list. In C++ I would write: class c = { public: c() {list->add(this);} ~c() {list->del(this);} } How to do...
From: "Tomasz Jamroszczak" <d119000@...> Subject: "ocaml_beginners"::[] object(self) Date: Mon, 07 Jun 2004 18:06:03 +0200 ... Did you cast...
Yamagata Yoriyuki
yoriyuki@...
Jun 7, 2004 4:27 pm
2058
... The only way I think this sort of type introspection can be done in ocaml is by means of an ocamlp4 macro. I'm currently writing a data structure...
====cut=== class stack = object val mutable l : int list = [] method pop = match l with [] -> raise Exit ... method push a = l <- a :: l end ===cut=== seems to...
Holger Schulz
schulz@...
Jun 8, 2004 4:19 pm
2060
... You need to do something along the lines of: # class ['a] stack = object val mutable l = [] method pop = match l with [] -> raise Exit ... method push (a :...
... class ['a] stack = object val mutable l : 'a list = [] method pop = match l with ... method push x = l <- x :: l end -- "Usenet is like a herd of...
Haven't worked with a compiled language before (just shell scripts, a little Perl, and what not), but have been trying to find a programming language I feel...