kaustuv changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
pants2 has joined #ocaml
pants3 has joined #ocaml
pants4 has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
pants2 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
pants3 has quit [Read error: 110 (Connection timed out)]
pants1 has quit [Read error: 60 (Operation timed out)]
pants1 has joined #ocaml
pants4 has quit [Read error: 110 (Connection timed out)]
pants2 has joined #ocaml
jmou has joined #ocaml
pants1 has quit [Read error: 60 (Operation timed out)]
mgodshall has joined #ocaml
mgodshal1 has quit [Read error: 110 (Connection timed out)]
pants2 has quit [Read error: 110 (Connection timed out)]
julm has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
pants2 has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
pants2 has quit [Read error: 60 (Operation timed out)]
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
pants2 has joined #ocaml
jmou has quit [Read error: 60 (Operation timed out)]
pants1 has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
jeddhaberstro has joined #ocaml
peddie has joined #ocaml
pants2 has quit [Read error: 113 (No route to host)]
pants1 has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
pants2 has joined #ocaml
pants1 has joined #ocaml
pants2 has quit [Read error: 113 (No route to host)]
pants2 has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
pants2 has quit [Read error: 110 (Connection timed out)]
pants2 has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
pants2 has quit [Read error: 110 (Connection timed out)]
pants2 has joined #ocaml
pants1 has quit [Read error: 60 (Operation timed out)]
jeddhaberstro has quit []
pants1 has joined #ocaml
pants2 has quit [Read error: 60 (Operation timed out)]
tvn has joined #ocaml
<tvn> hi, is there a log base 2 in ocaml ?
<tvn> I can only find log10 and natural log
<mrvn> ln(x)/ln(2)
<tvn> ah ok --
<tvn> the manual way -
<tvn> thanks
pants1 has quit [Read error: 113 (No route to host)]
pants1 has joined #ocaml
<thelema> tvn: there's some other ways to count bits if it's an int, I think.
<tvn> ic --
<tvn> I've seen this bithacks in my PL class before -- finding loop inv
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
<tvn> is there a power function ? 2 ^ n ?
<mrvn> exp?
<tvn> or more general a^b
<mrvn> exp(b * lg(a)) I think
<tvn> let pow x n = exp ((float_of_int n) *. log(x) )
<tvn> that's how I just implemented my power
<tvn> but it doesn't work right --- e.g., pow 2. 3 gives 7.999999999 instead of 8 as I expected
pants2 has joined #ocaml
<tvn> let pow x n = ceil(exp ((float_of_int n) *. log(x) )) <- will this work ?
<tvn> nope, that wouldn't work pow 10. 2 gives 101
<flux> tvn, use let round x = int_of_float (floor (x +. 0.5))
<mrvn> if you are concerned with roundings then maybe better do it manually.
<tvn> let rec pow x n = if n = 0 then 1. else x *. pow x (n-1) --- I think this should work
pants1 has quit [Read error: 110 (Connection timed out)]
<mrvn> tvn: slowly. :)
<tvn> lol -- that's ok .
<flux> tvn, you can actually use bitwise magic to make that go from O(n) to O(lg n)
<mrvn> let rec pow x n = if n mod 2 = 0 then let t = pow x (n/2) in t *. t else x *. pow x (n-1) or something
ikaros has joined #ocaml
pants2 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
pants1 has quit [Read error: 60 (Operation timed out)]
pants1 has joined #ocaml
schmx has joined #ocaml
schmx has quit [Client Quit]
schme has joined #ocaml
schme has quit [Client Quit]
schme has joined #ocaml
schme has quit [Client Quit]
schme has joined #ocaml
schmx has joined #ocaml
schmx has quit [Client Quit]
dileep has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
pants2 has joined #ocaml
pants1 has quit [Read error: 54 (Connection reset by peer)]
esope has joined #ocaml
komar_ has joined #ocaml
jeanbon has joined #ocaml
mal`` has quit ["Coyote finally caught me"]
pants1 has joined #ocaml
youscef has joined #ocaml
Ched has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ertai has quit ["leaving"]
pants2 has quit [Read error: 113 (No route to host)]
mal`` has joined #ocaml
<tvn> I am trying to test this
<tvn> # Str.split (Str.regexp "hi") "hi hello" ;; but it gives this error Reference to undefined global `Str'
<C_Tux> you need to
<C_Tux> #load "str.cma";;
<C_Tux> or when starting ocaml, use : 'ocaml str.cma'
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
pants2 has joined #ocaml
pants3 has joined #ocaml
<tvn> ic
<tvn> when I want to compile a program using ocamlopt , how do I load str.cma ?
<julm> tvn use str.cmxa
<tvn> ocamlopt -o str.cmxa myfile.ml still gives error about no implementation for STr
<julm> tvn : ocamlopt -o myfile str.cmxa myfile.ml
<tvn> now it says The file str.cmxa is not a compilation unit description
<esope> ocamlbuild myfile.native -tag use_str
<esope> and look at _build/_log to see the command that are executed
<julm> tvn : rm str.cmxa
<tvn> ah that works julm
<tvn> thx
<julm> np ;)
tvn has quit [hubbard.freenode.net irc.freenode.net]
rwmjones_ has quit [hubbard.freenode.net irc.freenode.net]
rwmjones has quit [hubbard.freenode.net irc.freenode.net]
mishok13 has quit [hubbard.freenode.net irc.freenode.net]
rbancroft has quit [hubbard.freenode.net irc.freenode.net]
det has quit [hubbard.freenode.net irc.freenode.net]
lanaer has quit [hubbard.freenode.net irc.freenode.net]
pants1 has joined #ocaml
pants2 has quit [Read error: 113 (No route to host)]
lanaer has joined #ocaml
pants2 has joined #ocaml
pants1 has quit [Read error: 60 (Operation timed out)]
_zack has joined #ocaml
tvn has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones has joined #ocaml
mishok13 has joined #ocaml
det has joined #ocaml
rbancroft has joined #ocaml
pants3 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
hkBst has joined #ocaml
slash_ has quit [Client Quit]
pants3 has joined #ocaml
<tvn> How do I exit a list iteration ? for example I want to do something like List.iter (fun e -> if e_is_what_i_want then exit) alist
pants2 has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
pants2 has joined #ocaml
<julm> tcn raise an exception, or use List.exists
<julm> tvn*
pants1 has quit [Read error: 110 (Connection timed out)]
<tvn> ic
<tvn> thanks
<tvn> may be last question of the day
pants3 has quit [Read error: 110 (Connection timed out)]
<tvn> how do I use match string , i.e., I want a function f v u to return yes if u is a substring of v , e.g., f "this is a string" " a s" would return true
<tvn> I tried
<tvn> let str_match s ms = Str.string_partial_match (Str.regexp_string ms) s 0
<tvn> but it doesn't do what I want
pants1 has joined #ocaml
pants2 has quit [Read error: 60 (Operation timed out)]
Associ8or has quit ["#proglangdesign #ltu ##concurrency"]
<Yoric[DT]> tvn: are you using Batteries Included?
<Yoric[DT]> If so, just use [String.find].
<julm> tvn: I can see no string search function in Str, Str.string_match and Str.string_partial_match only use as starting point the given position..
<mfp> tvn: try ignore (Str.search_forward (Str.regexp_string ms) s 0); true with Not_found -> false
<tvn> Yoric[DT], no I don't use that -- not sure what it is
<Yoric[DT]> tvn: an extended standard library for OCaml.
<julm> oops, mfp is right
<Yoric[DT]> (unfortunately, that Str-based solution is not thread-safe)
<tvn> yep, that works ... thanks again mfp
Associat0r has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Client Quit]
delroth has quit [Read error: 110 (Connection timed out)]
Pepe_ has quit [Read error: 110 (Connection timed out)]
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
itewsh has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
caligula has quit [Nick collision from services.]
caligula_ has joined #ocaml
LeCamarade|Away is now known as LeCamarade
ched_ has joined #ocaml
Ppjet6 has joined #ocaml
Ppjet6 is now known as Pepe_
Ched has quit [Read error: 101 (Network is unreachable)]
dileep has quit ["Leaving"]
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
rjack has joined #ocaml
pants1 has joined #ocaml
ertai has joined #ocaml
rjack has quit ["leaving"]
Amorphous has quit [Read error: 110 (Connection timed out)]
esope has quit ["Leaving."]
Amorphous has joined #ocaml
esope has joined #ocaml
_andre has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
pants1 has joined #ocaml
robocop` has joined #ocaml
pants2 has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
pants1 has joined #ocaml
robocop` has quit [Remote closed the connection]
rjack has joined #ocaml
Associat0r has quit ["#proglangdesign #ltu ##concurrency"]
itewsh has quit [Read error: 60 (Operation timed out)]
thelema has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
pants2 has quit [Read error: 110 (Connection timed out)]
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
LeCamarade has quit ["Rebooting."]
rjack has quit ["leaving"]
pants2 has joined #ocaml
love-pingoo has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
pants2 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
pants2 has joined #ocaml
itewsh has joined #ocaml
pants3 has joined #ocaml
bombshelter13_ has joined #ocaml
itewsh has quit [Remote closed the connection]
pants1 has quit [Read error: 110 (Connection timed out)]
<C_Tux> hey, I have problem with mikmatch : I'm using some of its macros in my code and it was working, I just moved several functions to another file and now, it doesn't type check anymore =/
<C_Tux> however, if I run the code through camlp4 and copy its output, it works =/
<C_Tux> 'This expression has type string -> Pcre.regexp but an expression was expected of type Pcre.regexp'
pants1 has joined #ocaml
<C_Tux> has anyone experienced that or has an idea ?
pants2 has quit [Read error: 113 (No route to host)]
LeCamarade has joined #ocaml
pants3 has quit [Read error: 110 (Connection timed out)]
pants2 has joined #ocaml
pants3 has joined #ocaml
pants2 has quit [hubbard.freenode.net irc.freenode.net]
Pepe_ has quit [hubbard.freenode.net irc.freenode.net]
julm has quit [hubbard.freenode.net irc.freenode.net]
mattam has quit [hubbard.freenode.net irc.freenode.net]
hcarty has quit [hubbard.freenode.net irc.freenode.net]
acatout has quit [hubbard.freenode.net irc.freenode.net]
pants2 has joined #ocaml
Pepe_ has joined #ocaml
julm has joined #ocaml
mattam has joined #ocaml
hcarty has joined #ocaml
acatout has joined #ocaml
pants1 has quit [Success]
pants2 has quit [Connection timed out]
pants3 has quit [Read error: 60 (Operation timed out)]
pants1 has joined #ocaml
_zack has quit ["Leaving."]
pants1 has quit [Connection timed out]
pants1 has joined #ocaml
_zack has joined #ocaml
pants2 has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
pants1 has quit [Read error: 60 (Operation timed out)]
<C_Tux> anyway, if someone wants to try : you can 'git clone http://git.ocamlcore.org/ocaml-gir/ocaml-gir.git' and switch to the code_refactoring branch
<C_Tux> the current head doesn't typecheck, the previous does
<C_Tux> and in types.ml, around line 26, there are two definitions of raw_type_without_stars, the commented one doesn't typecheck but the uncommented one seems to do, and the uncommented code comes from the output of camlp4o, it's the other definition after camlp4o...
<julm> C_Tux: I've cloned the repository you gave but can find neither code_refactoring branch nor raw_type_without_stars type..
<C_Tux> julm: no branch, that's weird, let me check
<julm> last commit : Sun May 24 23:48:16 2009 Wrote down the basis for the code refactoring. Will serve as guidelines.
<C_Tux> right, had the same thing, my git-fu is probably not high enough
<C_Tux> but I have to leave for a bit, be back in about 30 minutes =/
Yoric[DT] has joined #ocaml
<julm> git-fu? like kung-fu? :P
<julm> ok, see you later \o_
<C_Tux> git-fu : unexplainable magic powers when using git ;)
<C_Tux> (mine is really pretty low right now ;) )
pants1 has joined #ocaml
<hcarty> C_Tux: [let x = (REPLACE '*' * -> "") "*foo*";;] gives x = "foo" in the toplevel.
<hcarty> C_Tux: But [(REPLACE '*' * -> "") "*foo*"] does not give anything. So perhaps the camlp4 magic behind mikmatch explicitly checks for "let"?
<hcarty> C_Tux: [object val x = (REPLACE '*' * -> "") "*foo*" method x = x end;;] also gives nothing. So this may be related to some mikmatch + objects feature or bug.
lutter has joined #ocaml
pants2 has quit [Read error: 110 (Connection timed out)]
pants2 has joined #ocaml
pants1 has quit [Read error: 60 (Operation timed out)]
esope has left #ocaml []
jmou has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb has joined #ocaml
pants1 has joined #ocaml
AnDee has joined #ocaml
AnDee has left #ocaml []
delroth has joined #ocaml
lutter has quit [Read error: 110 (Connection timed out)]
pants2 has quit [Read error: 110 (Connection timed out)]
lutter has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
pants1 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
ulfdoz has joined #ocaml
pants1 has quit [Read error: 113 (No route to host)]
<C_Tux> hcarty: I had to stop using mikmatch in the toplevel because of some weird/annoying behaviour
jmou is now known as julm
<C_Tux> also, I tried to put the code outside of any object and it still didn't typecheck, so I tried before some 'open' directive (very top of the file) and it seems to work
<C_Tux> so it's else a bug, else a very stupid problem
<C_Tux> I'm wondering if the problem isn't : open'ing a file which uses mikmatch inside another file which uses mikmatch too... except it doesn't make much sense
Submarine has joined #ocaml
LeCamarade is now known as LeCamarade|Away
pants1 has joined #ocaml
jeremiah has quit []
pants2 has joined #ocaml
pants3 has joined #ocaml
lutter has quit [Connection timed out]
tvn has quit [Remote closed the connection]
_zack has quit ["Leaving."]
lutter has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
pants2 has quit [Read error: 110 (Connection timed out)]
pants3 has quit [Read error: 104 (Connection reset by peer)]
<hcarty> C_Tux: You could check the interface for the open'd module
<hcarty> If you don't have an explicit .mli then mikmatch could be polluting the module somehow, and the "open" could expose that to your other code.
pants1 has joined #ocaml
ikaros has joined #ocaml
lutter has quit [Read error: 110 (Connection timed out)]
lutter has joined #ocaml
pants2 has joined #ocaml
itewsh has joined #ocaml
Yoric[DT] has quit [Read error: 113 (No route to host)]
lutter has quit [Read error: 110 (Connection timed out)]
jeanbon has quit [Read error: 104 (Connection reset by peer)]
pants1 has quit [Read error: 110 (Connection timed out)]
jeanbon has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
pants2 has quit [Read error: 113 (No route to host)]
pants1 has joined #ocaml
ErikRose has joined #ocaml
<ErikRose> I'm working my way through an OCaml tutorial and had a question about collisions between constructor names. If I have a `type checkercolor = Red | Black` and a `type chesscolor = White | Black`, do the two Blacks collide?
<ErikRose> How is something like this handled in practice? (i.e. what am I doing wrong?)
<hcarty> ErikRose: They will collide. The simplest options are to either change the names (ex. "type checkercolor = Red_check | Black_check ...") or to put each type in separate modules.
<Smerdyakov> It's important to be clear about what you mean by "collide."
<ErikRose> Then you can use the namespacing stuff, right?
<Smerdyakov> Constructors never go away. They can be shadowed just like variables, though.
<ErikRose> Smerdyakov: Right. Shadowing would be bad in that case. :-)
<Smerdyakov> OCaml has nothing called "namespacing" in the official terminology.
pants2 has joined #ocaml
<ErikRose> Sorry, coming from Python.
<Smerdyakov> Like hcarty suggested, a common solution involves putting the datatypes in separate modules.
<hcarty> ErikRose: For modules, you would then use something like "Chess.Black" and "Checkers.Black" to differentiate between the two.
<ErikRose> But I seem to remember some way of controlling which symbols you import from a module.
<ErikRose> Great; that's exactly what I wanted to know. :-)
<Smerdyakov> ErikRose, I think you're on the right track; read about the module system, and this should all become clear.
<ErikRose> Do you run into that much in practice?
<hcarty> ErikRose: Quite often :-) Smerdyakov's suggestion to read up on the module system is a good one. Both the OCaml manual and Jason Hickey's book are good resources for this.
<ErikRose> I think that's in 2 more chapters. :-)
<ErikRose> We've done the ICFP contest in Python the last few years--C and Python this year--and are jonesing for a language that'll give us better speed but still be quick to sketch out high-level flow control in.
<ErikRose> Shoving data over the language barrier bites. :-)
<ErikRose> I'm looking at OCaml, CL, and Haskell atm.
<hcarty> OCaml is a fun language to learn and work with in my experience.
<julm> ErikRose: this book is interesting too (but I dunno if an english version exists..): http://www.pps.jussieu.fr/Livres/ora/DA-OCAML/
<ErikRose> I think the team used it a few years ago before I joined.
ched_ has quit [Read error: 60 (Operation timed out)]
pants1 has quit [Read error: 110 (Connection timed out)]
pants2 has quit [Read error: 104 (Connection reset by peer)]
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
_andre has quit ["leaving"]
Yoric[DT] has joined #ocaml
itouch has joined #ocaml
itewsh has quit [Connection timed out]
ulfdoz_ has joined #ocaml
ErikRose has quit ["I quit!"]
itouch has quit [Read error: 110 (Connection timed out)]
Submarine has quit ["Leaving"]
itouch has joined #ocaml
* C_Tux hugs hcarty !
<C_Tux> it took me some time before I tried, mostly because it's really hot here, but in one of the module I open, if I use ocamlc -i, I get : val __mikmatch_regexp_1 : string -> Pcre.regexp
<C_Tux> jeanbon: you're the author of mikmatch, right ?
<jeanbon> no
<C_Tux> ok, sorry for the disturbance
<jeanbon> np :)
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
Ched has joined #ocaml
hcarty has quit [Remote closed the connection]
hcarty has joined #ocaml
<hcarty> C_Tux: Excellent, I'm glad you found the issue :-)
<hcarty> I think pa-do can cause some similar items to pop up. But IIRC the names are somewhat random/unique and less likely to clash.
itouch has quit [Read error: 110 (Connection timed out)]
<hcarty> "items" here being automatically generated values which show up in a module's unconstrained interface.
itouch has joined #ocaml
<C_Tux> hcarty: the identifier should be explicity prefixed with the module name then, giving My_module.my_module_somename instead of just my_module.somename, that should prevent collisions
<C_Tux> or they could write *after* the lines with 'open'
<hcarty> C_Tux: It's probably worth emailing the mikmatch author. They should be able to provide either a fix or reasonable work-around.
ulfdoz_ has joined #ocaml
<C_Tux> hcarty: yep, just making the rest of my code compile again before that ;)
lutter has joined #ocaml
<palomer> \o/
ulfdoz has quit [Read error: 101 (Network is unreachable)]
ulfdoz_ is now known as ulfdoz
itouch has quit [Connection timed out]
itouch has joined #ocaml
<C_Tux> it's quite surprising : the error messages are different now when some code doesn't type check : "the expression has type X but and expression was expected of type Y" (although it's still not perfect)
esope has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
esope has left #ocaml []
ikaros has left #ocaml []
itouch has quit [Read error: 60 (Operation timed out)]
<hcarty> C_Tux: Yes, the improvement in mismatched type errors is certainly welcome.
itouch has joined #ocaml
<julm> C_Tux: I've figured out that using git branch -a prints the remote branches.. And that's what code_refactoring is.
<C_Tux> but did that appear in 3.11.1 or did I miss it during several months of 3.11.0 ? :o
<C_Tux> julm: hmm, ok, I really need to brush up my git
* C_Tux checks git branch -a
<hcarty> C_Tux: It's new in 3.11.1 - I wondered the same thing and checked the Changelog to be sure :-)
<C_Tux> hcarty: he, ok, I would maybe have been to the doctor otherwise ;p
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 60 (Operation timed out)]
ulfdoz_ is now known as ulfdoz
Jedai has joined #ocaml
Associat0r has joined #ocaml
bombshelter13_ has quit []
hkBst has quit [Read error: 104 (Connection reset by peer)]
beanjon has joined #ocaml
jeanbon has quit [Nick collision from services.]
lutter has quit ["Leaving."]
beanjon has quit [".)(.)(."]
itouch has quit [Read error: 110 (Connection timed out)]
youscef has quit ["KVIrc 3.4.0 Virgo http://www.kvirc.net/"]
itouch has joined #ocaml
Smerdyakov has quit ["Leaving"]
slash_ has joined #ocaml
Yoric[DT] has joined #ocaml
komar_ has joined #ocaml
itouch has quit [Read error: 110 (Connection timed out)]
itouch has joined #ocaml
itouch has quit [Client Quit]
ulfdoz has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]