gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
tony_ has quit [Quit: Ex-Chat]
BiDOrD has quit [Quit: No Ping reply in 180 seconds.]
BiDOrD has joined #ocaml
BiDOrD has quit [Ping timeout: 246 seconds]
kaustuv has joined #ocaml
BiDOrD has joined #ocaml
BiDOrD has quit [Quit: No Ping reply in 180 seconds.]
joewilliams is now known as joewilliams_away
boscop has quit [Ping timeout: 240 seconds]
ulfdoz_ has joined #ocaml
lamawithonel has quit [Read error: Connection reset by peer]
ulfdoz has quit [Ping timeout: 255 seconds]
ulfdoz_ is now known as ulfdoz
BiDOrD has joined #ocaml
<kaustuv> thelema: when you have a few minutes to spare, can you take a look at: https://github.com/chaudhuri/batteries-included/commit/8f735a8 ? It's a proposal for a future release
alexyk has joined #ocaml
<alexyk> I'm trying to type a block with exceptions: http://paste.pocoo.org/show/336842/. The problem is, I can catch Not_found and Invalid_argument in two places, and report them i the same way. I created two exceptions and re-raise them, catching in the last with. I get an error that the handler returns unit, not string; but that's intended. Is it trying to type the first raise, which is after a let expecting string? How shoul
<alexyk> restructure it?
<alexyk> Here's the exceptions: exception NotFound of string;; exception RandomInt of string * int
<kaustuv> in (try e with pat -> f), the types of e and f must be the same
<kaustuv> so it all depends on what the types of jumpBack and addEdge are
<alexyk> ah ok, it was missing parentehses around jumpBack ... (x^y)
<alexyk> so try ... with doesn't bind syntactically, it's raising/catching through scopes, right?
<kaustuv> I have absolutely no idea what you mean
<alexyk> we can have: begin try e end with ... try e begin with ... end, etc.?
<alexyk> looks like begin .. end doesn't affect it
<kaustuv> no, that is ill formed. begin/end are like (/), and (try e) with ... is ill formed. You want (try e with ...)
<alexyk> ok
<alexyk> how do I compile mli for an ml?
<kaustuv> ocamlc -c foo.mli
<alexyk> should I compile mli before ml? and then where ml is used, should I include both?
<kaustuv> You should compile a .mli before its corresponding .ml. You don't have to include anything. The files a.mli and a.ml together define the signature and code for module A.
<alexyk> I use opt, and it complains there's no cmi
<kaustuv> Therefore, compile them as: ocamlc -c a.mli && ocamlopt -c a.ml
<mrvn> or just use one of the many well made build systems
mnabil has joined #ocaml
kaustuv has left #ocaml []
mnabil has quit [Remote host closed the connection]
smerz has quit [Remote host closed the connection]
lopex has quit []
Amorphous has quit [Ping timeout: 272 seconds]
Amorphous has joined #ocaml
philtor has quit [Ping timeout: 240 seconds]
alexyk has quit [Quit: alexyk]
arubin has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
arubin has quit [Quit: arubin]
eye-scuzzy has quit [Read error: Connection reset by peer]
sun28 has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
sun28 has quit [Ping timeout: 272 seconds]
alexyk has quit [Read error: Connection reset by peer]
eye-scuzzy has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
joewilliams_away is now known as joewilliams
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
myu2 has quit [Remote host closed the connection]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
Associat0r has quit [Quit: Associat0r]
alexyk has joined #ocaml
alexyk has quit [Client Quit]
alexyk has joined #ocaml
alexyk has quit [Quit: alexyk]
joewilliams is now known as joewilliams_away
myu2 has joined #ocaml
ygrek has joined #ocaml
edwin has joined #ocaml
Yoric has joined #ocaml
eye-scuzzy has quit [Quit: leaving]
eye-scuzzy has joined #ocaml
Fullma has joined #ocaml
sepp2k has quit [Quit: Leaving.]
munga has joined #ocaml
spearalot has joined #ocaml
waern has joined #ocaml
ulfdoz has quit [Ping timeout: 255 seconds]
ikaros has joined #ocaml
munga has quit [Ping timeout: 246 seconds]
boscop has joined #ocaml
ankit9 has quit [Ping timeout: 245 seconds]
munga has joined #ocaml
fholm has joined #ocaml
coucou747 has joined #ocaml
tony_ has joined #ocaml
munga has quit [Ping timeout: 260 seconds]
lopex has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
drunK has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Client Quit]
tony_ has quit [Quit: Ex-Chat]
Snark has joined #ocaml
eye-scuzzy has quit [Quit: leaving]
eye-scuzzy has joined #ocaml
<thelema> Time to have fun with bigarrays in implementing http://volnitsky.com/project/str_search/
ulfdoz has joined #ocaml
<thelema> string -> bigarray anyone?
<mfp> thelema: that's rather easy to implement (even w/o any C code, by using a hack like in bigstring.ml & some unsafe blit), all you have to do is a memcpy
<thelema> have to memcpy because bigstring has to be off heap?
<mfp> (* untested *) let blit_string_to_ba s ba = let s' = (Obj.magic (Obj.field (Obj.repr ba) 1) : string) in for i = 0 to String.length s - 1; do String.unsafe_set s' i (String.unsafe_get s i); done
<mfp> yes, you cannot set the bigstring's data pointer to the string since it could be moved by the GC
<mfp> OTOH you could have a string outside the heap, which would make it safe
<thelema> well, for the moment assume an ocaml string, since I want this to be easy to use from ocaml.
<mfp> but in the end you have to track (de)allocation manually, which you don't have to if you memcpy and let the GC release the bigstring's mem in the finalizer
<thelema> your s' is backwards
<thelema> or not... hmm, this blits a string into an existing ba...
<mfp> but then again, why do you want to go from string to bigarray?
<thelema> I guess I can fold the ba construction in
<thelema> I want word access to a string
<thelema> for the above-linked string search algorithm
mfp has quit [Ping timeout: 255 seconds]
mfp has joined #ocaml
<thelema> I want word access to a string for the above-linked string search algorithm
avsm has joined #ocaml
kaustuv has joined #ocaml
<mfp> thelema: need a C/C++ implementation then? copying would defeat the purpose
<thelema> mfp: one is provided.
<mfp> it can work on the string directly then
<thelema> kaustuv: Splay trees look good - any chance of getting a testsuite that both it and regular map pass?
<mfp> as long as it doesn't release the runtime lock
<thelema> mfp: in the end, I think that's a better solution than writing it in ocaml
<mfp> kaustuv: was about to ask how splay trees were supposed to work on immutable structures when I saw [Obj] ;)
<mfp> thelema: it's not for batteries, is it? btw, what's batteries' policy regarding C stubs?
tony_ has joined #ocaml
<thelema> mfp: no official policy at the moment. I'm preferring to avoid them when possible, but I'm sure I'll find some good use of a stub that's irresistable
<thelema> that C code better be pretty portable, though
<thelema> At the moment, batteries is being auto-tested on linux, armel and win2k
<thelema> it'd be nice to get some additional buildbots, and to know whether that linux is 32 or 64 b it
<thelema> but if it auto-builds on all the currently working platforms, it's probably not so bad
<thelema> mfp: does that help?
tony_ has quit [Quit: Ex-Chat]
tony_ has joined #ocaml
<mfp> thelema: will keep in mind when I find interesting stubs
<thelema> mfp: the first stub successfully included will likely be the hardest
<mfp> camlzip comes to mind... also raises the external dep issue
<thelema> yes, maybe first something without external deps
<thelema> if anyone else has comments on https://github.com/ocaml-batteries-team/batteries-included/pull/113#pull_comment_form, I'm sure elehack would appreciate (and I'm happy encouraging code review)
<thelema> (especially my own code needs reviewing)
harrison has joined #ocaml
<mfp> ugh, I think I'll try to write some BatOptParse example --- never used it, and reading the .mli demands a fair amount of patience
joewilliams_away is now known as joewilliams
<thelema> mfp: thank you
<kaustuv> mfp, thelema: yes, Obj. However, it's only a pointer update and contention does not break the search tree invariant.
<kaustuv> Problem is I could have done it with refs or mutable fields also, except for the annoying covariance annotation on map types
spearalot has quit [Ping timeout: 240 seconds]
<thelema> kaustuv: no problem. I just want to make sure it's compatible with other maps
<kaustuv> It should be indistinguishable from ordinary (non-polymorphic) maps except it has different performance characteristics (statically optimal amortized time vs. worst case time)
<thelema> yup, that's what I want to verify (and get some tests on Map at the same time)
<kaustuv> I think testsuite/test_pmap can be adapted to test for BatMap.Make/BatSplay.Map
<kaustuv> or in generaly any functor (Ord:BatInterfaces.OrderedType) -> BatMap.S with type key = Ord.t
<thelema> I wonder if both testsuite/ and qtest/ are worth keeping
<thelema> this kind of test might be the reason to keep testsuite/
<kaustuv> I think you will have a lot of difficulty in moving stuff like testsuite/test_file etc. to inline tests
<kaustuv> because of all the auxiliary functions
<kaustuv> anyhow, dinner time
kaustuv has left #ocaml []
harrison has quit [Ping timeout: 276 seconds]
groves has joined #ocaml
arubin has joined #ocaml
groves has left #ocaml []
alexyk has joined #ocaml
<alexyk> why 1111947858 is an Invalid_argument to Random.int?
<alexyk> on a 64 bit platform
<alexyk> apparently Random.int takes an int but can handle a subset of it?
<flux> correct. I do wonder why that is. there is no value that indicates the maximum, either, so you need to with 1 lsl 30 - 1
<flux> I don't think it would _break_ any program just to accept the full (positive) range of integers
<adrien> might be to make sure you know the limitation, "Return 30 random bits in a nonnegative integer."
<thelema> alexyk: Random.int only ranges over 31-bit ints (so it's compatible across platforms)
<alexyk> thelema: this is very sneaky and unfortunate. So what do I do to use any regular int on 64-bit platform? Convert to int64 and call Random.int64?
<thelema> yes
avsm has quit [Read error: Operation timed out]
<alexyk> how do I convert an int to int64?
<thelema> Int64.of_int
<alexyk> and does the literal look different?
<thelema> 1111947858L
<alexyk> ok
<alexyk> Random.int must throw a better exception
<thelema> Yes, it should
<thelema> and be better documented
<alexyk> currently, it'll throw Invalid_argument both for 0 and a large int
<alexyk> I had to re-raise with my own RandomInt(int) to see what's wrong
<_habnabit> Is there a way to pass around a type constructor as a parameter? e.g. List.map (Arg.Set_float) some_list
<thelema> _habnabit: List.map (fun x -> Arg.Set_float x) some_list
<_habnabit> thelema, yes, that's what I have now and it's totes ugly
<thelema> there's nothing prettier - move along
<_habnabit> thelema, ... that's why I asked; no need to be rude
<thelema> sorry, there was a smile with that that didn't come through
Snark has quit [Quit: Ex-Chat]
waern has quit [Ping timeout: 255 seconds]
tony_ has quit [Quit: Ex-Chat]
sepp2k has joined #ocaml
aaaaa has joined #ocaml
<aaaaa> salve
<aaaaa> c'è qualche italiano ?
thieusoai has joined #ocaml
<thelema> aaaaa: unlikely, this is an english channel. maybe in #ocaml-fr
smerz has joined #ocaml
<adrien> don't know if anyone there actually speaks italian
<adrien> might want to try english here
companion_cube has joined #ocaml
joewilliams is now known as joewilliams_away
<aaaaa> adrien: ocaml know the language?
bbc has joined #ocaml
<adrien> aaaaa: I'm sorry, I didn't understand
<aaaaa> ok
ygrek has quit [Ping timeout: 240 seconds]
lopex has quit [Ping timeout: 276 seconds]
lopex has joined #ocaml
bbc has quit [Ping timeout: 240 seconds]
alexyk has quit [Quit: alexyk]
alexyk has joined #ocaml
agarwal1975 has joined #ocaml
edwin has quit [Remote host closed the connection]
Associat0r has joined #ocaml
mnabil has joined #ocaml
Yoric has quit [Quit: Yoric]
bbc has joined #ocaml
aaaaa has quit [Quit: Il diavolo è vivo e altamente popolare in moltissima gente.]
tony_ has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
myu2 has quit [Remote host closed the connection]
mnabil has quit [Remote host closed the connection]
ikaros has quit [Quit: Leave the magic to Houdini]
smerz has quit [Quit: Ex-Chat]
seafood has joined #ocaml
philtor has joined #ocaml