Hi Anders ! ... I could not say my following code is smart ! It is just a trial to rewrite things an alternative way - using List module - after the smart...
8706
Jon Harrop
harropjon
Sep 24, 2007 5:21 pm
... I haven't checked but this particular case (construction and immediate deconstruction of a tuple for passing multiple arguments) is often optimized by...
8707
Florent Monnier
fmonnier@...
Sep 24, 2007 7:24 pm
... it's a good suggestion I'll try, thanks for your advices...
8708
a_lyckegaard
Sep 25, 2007 7:13 am
... rewrite things an alternative way - using List module - after the smart short code of Martin. ... Hi all, Thank you for the suggestions. I will try them...
8709
Jon Harrop
harropjon
Sep 26, 2007 4:49 am
Andrei Formiga has been kind enough to post a review of my book OCaml for Scientists on his blog: ...
8710
Christian Konrad
konrad@...
Sep 26, 2007 8:20 am
Hello, I am currently studying for a virtual machines lecture and they present a CAML-like language with a VM for that language. I am a bit puzzled how the...
8711
Y Liung
yangliung
Sep 26, 2007 10:10 am
Dear all, Is there anyone who is clear about camlp4, and can help me sort out my problem. *First of all, I 'm not sure when compiling source code, how many...
8712
Joerg van den Hoff
vdh_j
Sep 26, 2007 11:38 am
... do you mean the following behaviour? (*----------------------------------------------*) let r = ref "initial_value";; let v = "initial_value";; let f() =...
8713
Christian Konrad
konrad@...
Sep 26, 2007 12:10 pm
Hi Joerg, I am thinking ok sth like: let r = ref 10;; Now some expression that refers to r, like: (!r + 10) Let's now assume that this piece of code doesn't...
8714
Jon Harrop
harropjon
Sep 26, 2007 12:14 pm
... Yes: $ ocaml Objective Caml version 3.10.0 # let add x y = !x + !y;; val add : int ref -> int ref -> int = <fun> # let two = ref 2;; val two : int ref =...
8715
Jon Harrop
harropjon
Sep 26, 2007 12:41 pm
... No, "expr" is just an int (OCaml is not a lazy language) and cannot therefore be "later evaluated". In a lazy language like Haskell, "expr" could be either...
8716
Christian Konrad
konrad@...
Sep 26, 2007 3:54 pm
Thanks, that explains all I wanted to know. chris...
8717
Phil Tomson
rubyfan@...
Sep 29, 2007 12:54 am
I've come across this a few times and, while I like pattern matching, in this case it seems to be inefficient: let rec get_clauses_without lit clauses = match...
8718
Phil Tomson
rubyfan@...
Sep 29, 2007 1:07 am
To partially answer my own question, this is probably preferrable: (* this one is probably more efficient and thus preferrable *) let rec get_clauses_without...
8719
Jon Harrop
harropjon
Sep 29, 2007 1:38 am
You've already answered your own question correctly but here are some interesting asides: ... This is a bad idea because List.length is T(n). Use: match...
8720
Fabrice Marchant
fabrice.marc...
Sep 29, 2007 9:01 am
Hello ! Designing things from scratch, the order of parameters a function can use is right now completely free. So if there are n parameters, we have n! ways...
8721
Martin Jambon
BioMim
Sep 29, 2007 5:34 pm
... You could use labelled arguments: # let f ~x ~y = x + y;; val f : x:int -> y:int -> int = <fun> # f ~y:1;; - : x:int -> int = <fun> # f ~x:2;; - : y:int ->...
8722
Grant Olson
olsongt@...
Sep 29, 2007 9:24 pm
Suprisingly this works fine on Windows but I'm having problems on Unix. I'm trying to interface with various chess engines that send text back and forth on...
8723
Grant Olson
olsongt@...
Sep 29, 2007 9:47 pm
... One thing to consider is what order makes sense for currying. For example, ... Because it's in this order, I can use currying to make some useful ...
8724
Peng Zang
peng.zang@...
Sep 30, 2007 2:54 pm
... Hash: SHA1 Hi, I have some confusion about modules and functors that I'm hoping someone can help clear up. Namely, I was under the impression that two...
8725
Jon Harrop
harropjon
Sep 30, 2007 5:57 pm
... It doesn't matter if two different abstract types happen to have evolved in the same way to produce semantic equivalence, OCaml will still only see them as...
8726
Peng Zang
peng.zang@...
Sep 30, 2007 6:43 pm
... Hash: SHA1 Wait, I'm confused. What types are abstract? (and forgive me if I have a poor notion of what an abstract type is) In the example I gave, both...
8727
Fabrice Marchant
fabrice.marc...
Sep 30, 2007 8:13 pm
Thanks a lot Martin, On Sat, 29 Sep 2007 19:33:55 +0200 (CEST) ... I first thought to these labelled arguments ( I've never use them however ) but the problem...
8728
Fabrice Marchant
fabrice.marc...
Sep 30, 2007 8:13 pm
Thanks a lot Grant ! On Sat, 29 Sep 2007 17:47:25 -0400 ... Sometimes I feel parameters are 'backwards39; too. For example, the Map parameters order for a fold :...
8729
Peng Zang
peng.zang@...
Sep 30, 2007 8:42 pm
... Hash: SHA1 Just as a note functions with labelled arguments can be applied without the labels: # let f ~x ~y = x + y;; val f : x:int -> y:int -> int =...
8730
Martin Jambon
BioMim
Sep 30, 2007 8:48 pm
... They can, but only if all the arguments are given (no partial application) ... Not exactly, it's just that the higher-order functions that you might want ...
8731
Jon Harrop
harropjon
Sep 30, 2007 8:48 pm
... This is certainly a bit wierd but the general rule of thumb is that a "fold" function is a "fold_right" function, so it has that signature. Also, the ...
8732
Michael Wohlwend
scheischeischei
Sep 30, 2007 9:01 pm
... type t in Foo is not abstract but when defining Bar you restrict Foo to interface FOO which declares an abstract type t, so t is considered different for...
8733
Peng Zang
peng.zang@...
Sep 30, 2007 10:32 pm
... Hash: SHA1 This sounded like it might solve the problem, but when I tested it (I explictly specified type t = int in the FOO module type) I get the same ...
8734
dmitry grebeniuk
dmitrygrebeniuk
Oct 1, 2007 6:36 am
Hello, Peng. PZ> Apropo partial application, I didn't think ocaml PZ> did partial application... I mean you can always PZ> give a function fewer arguments...