Hi Johan, I tried to compile an old library of mine using camlidl (I also use OPAM with the 4.00.1 compiler). I had to add a CCopt option in the _oasis file to...
13750
Sergei Steshenko
sergstesh
Feb 20, 2013 5:17 am
Hello, as I am playing with data structures, I need to write my own *to_string functions. And for that I need to concatenate strings that are string...
13751
Francois Berenger
f_berenger
Feb 20, 2013 5:24 am
Maybe not. Hence the Buffer module: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Buffer.html...
13752
Francois Berenger
f_berenger
Feb 20, 2013 5:27 am
... A little more advanced way would be S-expressions as in the core library from janestreet....
13753
Jason Yeo
goosebumpsov...
Feb 20, 2013 5:59 am
Hi, I am trying to achieve some form of polymorphism to print my data structures (ints, floats, List of ints, List of floats or List of ADTs). Is there a way...
13754
Francois Berenger
f_berenger
Feb 20, 2013 6:25 am
... Maybe you are looking for this: http://mmottl.bitbucket.org/projects/sexplib/README.html...
13755
Gabriel Scherer
ga_sche
Feb 20, 2013 7:06 am
Complementing François's useful answer: to concatenate lots of strings together, Buffer is definitely the way to go. If you want to serialize data, printing...
13756
Philippe Veber
philippeveber
Feb 20, 2013 7:16 am
Hi Jason, I'm affraid what you're looking for (ad-hoc polymorphism) doesn't exist in ocaml. You have to give your print functions different names and apply the...
13757
Sergei Steshenko
sergstesh
Feb 20, 2013 8:40 am
Regarding serialization and stuff. First of all, I am learning. And as I've discovered, implementing something similar to Perl data structures is a good test...
13758
Gabriel Scherer
ga_sche
Feb 20, 2013 8:54 am
Avoid camlp{4,5} at (nearly) all cost. It's tempting but too often misused in practice (been there, done that). Find a good way to have something clean in the...
13759
Francois Berenger
f_berenger
Feb 20, 2013 9:13 am
... Using camlp4/p5 is not for beginners. I would never mention these tools to someone starting to learn OCaml!...
13760
Sergei Steshenko
sergstesh
Feb 20, 2013 9:21 am
Regarding "Avoid camlp{4,5} at (nearly) all cost" - well, it's my very purpose to be outside of the language. In Perl I write as I think, something like this: ...
13761
Gabriel Scherer
ga_sche
Feb 20, 2013 9:56 am
Meh, I think jumping on Camlp{4,5} head first will result in you making bad design choices. Could you elaborate on what you would like to write, what would be...
13762
Sergei Steshenko
sergstesh
Feb 20, 2013 10:10 am
I suggest to look at examples here: http://perldoc.perl.org/perldsc.html . Fundamentally, I am looking for a "better Perl". OCaml seems to fit the "definition"...
13763
Gabriel Scherer
ga_sche
Feb 20, 2013 10:33 am
It looks like you're looking for either: - embedding all the values you're interested in a single big sum type (like you have in a dynamic language); you lose...
13764
Sergei Steshenko
sergstesh
Feb 20, 2013 8:52 pm
... From: Gabriel Scherer <gabriel.scherer@...> Subject: Re: "ocaml_beginners"::[] is String.concat efficient enough for "production" use ? To:...
13765
Sergei Steshenko
sergstesh
Feb 20, 2013 9:11 pm
This is what I already have :) : " type plds_type =    Plds_int of int  | Plds_float of float  | Plds_string of string  | Plds_list of...
13766
Sergei Steshenko
sergstesh
Feb 20, 2013 11:41 pm
Hello, I've checked Sys.max_string_length: " # Sys.max_string_length;; - : int = 16777211 ". By my standards it's a small value. For example, in Perl strings...
13767
Hongbo Zhang
hongbozhang88
Feb 20, 2013 11:45 pm
Hi Sergei, try 64 bit ocaml. The length limit is due to the data representation chosen by ocaml. ... -- -- Regards, Hongbo [Non-text portions of this message...
13768
Sergei Steshenko
sergstesh
Feb 20, 2013 11:52 pm
Even though my desktop (but not laptop) CPU is capable of running 64 bits, I still prefer 32 bit versions of Linux for various practical reasons. Could you...
13769
oliver
oliver@...
Feb 21, 2013 2:12 am
... [...] Initially OCaml was written/designed with 64 Bit systems in mind. Later, when it shows up that 32 Bit machines will stay on market for quite long...
13770
Francois Berenger
f_berenger
Feb 21, 2013 2:21 am
Gabriel mentioned the rope data structure. That would allow you to create giant strings, I guess. There are several implementations in OCaml. ...
13771
Gabriel Scherer
ga_sche
Feb 21, 2013 8:49 am
Ropes are indeed a reasonable choice for long strings. Another solution is to use Bigarray ( ...
13772
Marek Kubica
pymastr
Feb 21, 2013 9:43 pm
On Wed, 20 Feb 2013 13:59:43 +0800 ... Well, not really cleanly but Batteries has some kind-of-solution, check out the "dump" function there. regards, Marek...
13773
Sergei Steshenko
sergstesh
Feb 22, 2013 5:55 am
Hello, in Perl there is 'x' binary operator which replicates its left operand string: " sergei@amdam2:~/junk> perl -e 'print "foo" x 3, "\n"' foofoofoo ". I...
13774
Francois Berenger
f_berenger
Feb 22, 2013 6:21 am
... open Printf let v = "foo" in printf "%s%s%s92;n" v v v; ... More seriously, for more string fun, you can have a look in the Str module from the stdlib, the...
Thanks. Is the batteries library compatible with standard libraries ? I.e. will some standard library functions be overridden, or the batteries do no export...
13777
Sébastien Dailly
s_dailly
Feb 22, 2013 8:56 am
... Yes, it's even recommended to add batteries in your project library ! ... Depends, when you'r opening the batteries module, it will overide some standard...
13778
Jason Yeo
goosebumpsov...
Feb 23, 2013 8:35 am
Hi, ... What's the difference between sexplib and camlp4? They both seem to be libraries that do some form of meta-programming right? Thanks, Jason...