hcarty 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
erickt1 has joined #ocaml
jeddhaberstro has joined #ocaml
erickt1 has quit ["Leaving."]
kaustuv_` has joined #ocaml
erickt1 has joined #ocaml
knight[rage] has joined #ocaml
kaustuv_ has quit [Read error: 110 (Connection timed out)]
kr has joined #ocaml
verte has joined #ocaml
kr is now known as Guest66969
etoxam has quit [Read error: 110 (Connection timed out)]
knightrage has quit [Read error: 113 (No route to host)]
knight[rage] has quit [Read error: 113 (No route to host)]
ski_ has joined #ocaml
rcloud has joined #ocaml
jeddhaberstro has quit [Client Quit]
caligula_ has joined #ocaml
jeddhaberstro has joined #ocaml
caligula__ has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has quit [Client Quit]
Hadaka has quit [hubbard.freenode.net irc.freenode.net]
ski_ has quit [hubbard.freenode.net irc.freenode.net]
gaze___ has quit [hubbard.freenode.net irc.freenode.net]
julm has quit [hubbard.freenode.net irc.freenode.net]
M| has quit [hubbard.freenode.net irc.freenode.net]
mehdid has quit [hubbard.freenode.net irc.freenode.net]
tab has quit [hubbard.freenode.net irc.freenode.net]
cmeme has quit [hubbard.freenode.net irc.freenode.net]
davidL has quit [hubbard.freenode.net irc.freenode.net]
rcloud has quit [hubbard.freenode.net irc.freenode.net]
bacam has quit [hubbard.freenode.net irc.freenode.net]
tomaw has quit [hubbard.freenode.net irc.freenode.net]
Hadaka has joined #ocaml
rcloud` has joined #ocaml
ski_ has joined #ocaml
gaze___ has joined #ocaml
julm has joined #ocaml
M| has joined #ocaml
mehdid has joined #ocaml
cmeme has joined #ocaml
davidL has joined #ocaml
tab has joined #ocaml
bacam has joined #ocaml
tomaw has joined #ocaml
Guest66969 is now known as knightrage
thrasibule has joined #ocaml
rcloud` has quit [Read error: 110 (Connection timed out)]
rcloud` has joined #ocaml
rcloud` has quit [Remote closed the connection]
rcloud` has joined #ocaml
rcloud` has quit [Remote closed the connection]
thrasibule has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
Modius has quit [Read error: 104 (Connection reset by peer)]
Modius has joined #ocaml
tvn2009 has quit ["Leaving"]
valross has joined #ocaml
peddie has joined #ocaml
palomer has quit [Read error: 113 (No route to host)]
palomer has joined #ocaml
komar___ has joined #ocaml
f[x] has joined #ocaml
komar_ has quit [Read error: 110 (Connection timed out)]
|Jedai| has joined #ocaml
erickt1 is now known as erickt
Jedai has quit [Read error: 110 (Connection timed out)]
_zack has joined #ocaml
Submarine has quit [Remote closed the connection]
_zack has quit [Read error: 113 (No route to host)]
cognacc has joined #ocaml
_zack has joined #ocaml
tmaeda0 is now known as tmaeda
cmeme has quit [No route to host]
Ringo48 has quit [Read error: 113 (No route to host)]
flx_ has joined #ocaml
cognacc has quit [Read error: 110 (Connection timed out)]
flux has quit ["Lost terminal"]
cognacc has joined #ocaml
valross has quit [Remote closed the connection]
cognacc has quit [Read error: 145 (Connection timed out)]
Ringo48 has joined #ocaml
gaze___ has quit []
Alpounet has joined #ocaml
ski_ has quit ["Lost terminal"]
jdavis has quit [Read error: 110 (Connection timed out)]
_zack has quit ["Leaving."]
_andre has joined #ocaml
flx_ is now known as flux
kaustuv_ has joined #ocaml
_zack has joined #ocaml
kaustuv_` has quit [Read error: 110 (Connection timed out)]
dabd has joined #ocaml
LeCamarade|Away has quit [Read error: 104 (Connection reset by peer)]
LeCamarade_ has joined #ocaml
jdavis has joined #ocaml
komar___ has quit [Read error: 145 (Connection timed out)]
derdon has joined #ocaml
tmaeda0 has joined #ocaml
tmaeda has quit [Read error: 145 (Connection timed out)]
derdon has quit []
derdon has joined #ocaml
th5 has joined #ocaml
f[x] has quit [Read error: 110 (Connection timed out)]
komar_ has joined #ocaml
<derdon> it is possible to write this snippet simpler? http://paste.pocoo.org/show/139895/
<flux> not really, except you can use fun instead of function
<flux> you could use some higher order magic functions, but I'm not sure it would make it simpler, only shorter :)
<flux> perhaps let int_pow a b = int_of_float (float a ** float b) would help?
<derdon> oh, I didn't know that the function float exists
<derdon> I thought I had to know from which type I wanna convert
Smerdyakov has joined #ocaml
<olegfink> # List.map ((lsl) 1) [0; 1; 2; 3; 4; 5] ;;
<olegfink> - : int list = [1; 2; 4; 8; 16; 32]
<flux> olegfink, :-)
<olegfink> ?
<flux> neat. I didn't even think of going that way.
<derdon> olegfink: what is lsl?
<flux> rather thinking it as a class of problems. too complicated :)
<thelema> derdon: logical shift left
<thelema> derdon: float = float_of_int
<olegfink> flux, I've been probably doing too much C lately. :-)
<derdon> thelema: do I have to use an expression before it? lsl says here: "Error: Syntax error"
<flux> derdon, lsl is a binary operator
<flux> like +
<derdon> oh, I see
<derdon> thanks
<th5> there's also a (**) defined on ints in batteries
<thelema> lsl is an ocaml keyword, so that it can be used infix
<th5> left shift logical
<derdon> th5: but then both parameters have to be ints I think
<th5> i thought that's what you wanted - isnt float_of_int just a hack to make ** work with ints?
<derdon> yep
<derdon> is "batteries" a synonym for the stdlib of OCaml?
<th5> its a project that hopes to supplement the stdlib
<thelema> derdon: no, it's an extended stdlib.
<derdon> ok
<flux> it's like boost to c++ :-)
<thelema> th5: we don't hope to supplement stdlib, we do supplement it. We hope to become the new standard.
<th5> ah ok
<olegfink> thelema: by the way, how;
<thelema> th5: I'm just being unnecessarily defensive. :)
<derdon> thelema: is the OCaml devteam against it?
<olegfink> *'s int ( ** ) defined in Batteries?
<thelema> derdon: the ocaml devteam is for it, they just don't want to maintain it, and insist it stay separate from ocaml proper
<th5> i think the ocaml team wants the stdlib to be minimal for portability
<thelema> oleg: let pow = generic_pow ~zero ~one ~div_two:(fun n -> n / 2) ~mod_two:(fun n -> n mod 2) ~mul
<th5> derdon: the lsl trick will work for you - you should do a few pen and paper examples so see why adding a zero to the end of a binary number gives this effect
<th5> of course its a dirty dirty bit slinging trick
<derdon> th5: it does work, I already tested it :)
<th5> the relationship between binary numbers and 2^x and log base 2 is very important
<derdon> and it is only an example for me to train a bit with OCaml while I learn the language
<thelema> generic pow is implemented at the bottom of: http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=batteries/batteries.git;a=blob_plain;f=src/core/extlib/number.ml;hb=master
<olegfink> uhhh, and the poor compiler optimises that? :-)
<thelema> no, it's not super optimized, it's good enough, though.
jimmyb2187 has left #ocaml []
<thelema> err, it's not good enough. hmm, I wonder who wrote / and mod instead of bit shifting...
* thelema tests difference
<th5> thelema: that interface is pretty nice
<thelema> as good as we could make it.
<th5> what do you mean? were you hindered in some way?
julm_ has joined #ocaml
<thelema> there might be some better way we didn't think of. The main hinderance is the lack of overloading in ocaml.
<th5> oh ok
derdon has quit []
<th5> keep up the good work - i think a lot of us are excited about batteries
jimmyb2187 has joined #ocaml
<th5> now if only there was a good IDE...
<thelema> olegfink: the difference between /,mod and bit shifting in Int.pow shows up as a 7% increase in runtime.
<thelema> but both functions are so rediculously fast, I had to exponentiate 10_000_000^2 times to even measure that.
<olegfink> ocamlopt? that's almost unnoticeable
<thelema> no, that's the toplevel.
<thelema> maybe there's a difference in optimized code.
<olegfink> probably it's not worth discussing that. :-)
<flux> I guess there's a bigger difference if you do that a million times ;)
<olegfink> I like the pow interface
<thelema> flux: it should be 7% no matter
<flux> oh, ok
<flux> I was thinking you were comparing single runs on x^10e6
<flux> I think it might differ from 10e6 runs of x^2 ?
<thelema> I was doing 2..n ^ n..2
<thelema> for n = 10_000_000
tmaeda0 is now known as tmaedaZ
Amorphous has quit [Read error: 110 (Connection timed out)]
julm has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
<thelema> inling into generic_pow saves a lot of time. Bytecode:
<thelema> Time pow1: 5.980374
<thelema> Time pow2: 5.584349
<thelema> Time pow3: 2.076130
<thelema> pow1 is as batteries, pow2 is using bit-shifts, pow3 is manually inlined generic_pow for ints
<thelema> Time pow1: 1.348084
<thelema> Time pow2: 1.448090
<thelema> Time pow3: 0.232015
<thelema> same with native code.
<thelema> The test is 1 million random exponentiations (same set for each function)
<thelema> Random.bits ** Random.bits
* thelema wonders why ocaml didn't inline automatically such small functions
<thelema> back after class
<olegfink> that's indeed interesting
<olegfink> even large -inline values don't change anything
<Camarade_Tux> -inline has always seemed weird to me, often giving no difference and also giving worst performance for values >= 20
<Camarade_Tux> and what is actually the value?
<olegfink> probably just a coefficient
<olegfink> aha
<olegfink> Time pow4: 0.876610
<olegfink> (the other times are like thelema's)
<olegfink> that's the same generic_pow but without labels
<olegfink> now that's some fun
<flux> how would adding a 256 * 256 lookup table to handle the end help?
<flux> I guess not much..
<olegfink> but why a function with labels is about 4 times slower?
komar_ has quit ["WeeChat 0.2.6.3-ohshi"]
<Camarade_Tux> had a look at the asm? :)
<olegfink> the code for the functions looks identical
luisgrin has joined #ocaml
_zack has quit [Read error: 113 (No route to host)]
verte has quit ["~~~ Crash in JIT!"]
<hcarty> Are missing symbols caml_* in dll_*.so files in OCaml C bindings normal? I've asked this before, but I want to double-check.
<hcarty> I haven't found any documentation to say one way or the other.
<hcarty> A fellow developer is trying to clean up all of the missing symbols (according to "ldd -r") and I'm not sure if all of they should be cleared up as I think they are somehow provided by the OCaml runtime.
_zack has joined #ocaml
komar_ has joined #ocaml
tmaedaZ is now known as tmaeda0
f[x] has joined #ocaml
robocop has joined #ocaml
komar_ has quit ["WeeChat 0.2.6.3-ohshi"]
komar_ has joined #ocaml
komar_ has quit ["WeeChat 0.2.6.3-ohshi"]
tvn2009 has joined #ocaml
<tvn2009> how do I print special charater like \% , e.g, printf " \% " will not work
ski_ has joined #ocaml
<hcarty> tvn2009: What special character is "\%"?
<tvn2009> I just want to print "\%" on the screen
<tvn2009> treat "\%" as a string
<hcarty> print_endline "\\%"
<hcarty> print_endline "\%" also works, but gives a warning since "\" is used for escaping special characters.
<hcarty> So you generally need to double instances of \ to \\
<tvn2009> ah ok
komar_ has joined #ocaml
<tvn2009> ic
<tvn2009> thanks
<tvn2009> this is what I am trying to do
<tvn2009> let ss = "#line 21return (0);" and ls ="{#line 9printf(\"%g\n\", b);#line 21return (0);}" in Str.string_match (Str.regexp_string ss) ls 0 ;; <- it gives false , how come ?
<tvn2009> clearly ss is a substring of ls
<tvn2009> yet it says false
<hcarty> Are you literally using "and"?
<hcarty> If so, you should not as it would be using an older definition of "ss".
<hcarty> That said, I haven't used Str in a long time. I use Pcre when I need regexps.
<tvn2009> what's wrong with using "and" in there ?
<tvn2009> I don't see why it would be incorrect
<hcarty> "and", as I understand it, defines ss and ls together.
<hcarty> You want to define ss then define ls.
<Smerdyakov> hcarty, why?
<hcarty> Smerdyakov: Is my understanding incorrect here? I haven't had a need to use "and" so my understanding of its meaning may be incorrect.
<tvn2009> yes it defines both ls and ss together --- but that shouldn't matter
<Smerdyakov> hcarty, I think it has no effect here.
<hcarty> Smerdyakov, tvn2009: Yes, my apologies. I apparently do not currently understand the meaning of "and" in OCaml.
<hcarty> tvn2009: The problem is the "0"
<tvn2009> let ss = "b" and ls = "a b" in Str.string_match (Str.regexp_string ss) ls 0 ;; <- even a simpler example, it says false here
<hcarty> tvn2009: According to the Str docs, it is searching for ss at position 0 in ls
<tvn2009> yes
<tvn2009> oh
<tvn2009> is there a more general one that just search for ss in the entire ls ?
<hcarty> Str.search_forward may give you what you want. Or Pcre.pmatch.
<hcarty> The Pcre library is much nicer to work with in my experience.
<tvn2009> ah ic
<tvn2009> Pcre is not in the std lib is it ?
_zack1 has joined #ocaml
_zack has quit ["Leaving."]
<hcarty> No, it is not
<hcarty> There are Debian/Ubuntu/Fedora/GODI packages for it though.
<tvn2009> ic, though I am hesitate to use external lib since I am working on this collaborative proj
<tvn2009> and that would require everyone to install it on their machines
<tvn2009> but it's nice to know its existence nonetheless
<tvn2009> thanks hcarty , the search_forward works perfectly -- I think I'll stick with it
<hcarty> tvn2009: You're welcome, and good luck with it.
<tvn2009> thx
<thelema> olegfink: there are 5 labeled arguments, and it returns a function with 2 more arguments - I know that 5 is a magic cutting point for function arguments in ocaml's optimization of curried functions
_zack1 has quit [Read error: 113 (No route to host)]
<olegfink> thelema: hmm, but assembly is similar for both labeled and unlabeled version
<thelema> someone else will have to investigate the assembler.
authentic has left #ocaml []
smimou has joined #ocaml
tvn2009 has quit ["Leaving"]
rcloud has joined #ocaml
th5 has quit []
th5 has joined #ocaml
th5 has quit [Client Quit]
_zack has joined #ocaml
derdon has joined #ocaml
ttamttam has joined #ocaml
gaze___ has joined #ocaml
<qwr> iirc Str library used global state?
<thelema> yes, not thread safe
<flux> qwr, even the parts that look thread safe in Str, aren't, so avoid if if you have threads
<flux> or will in the future have threads
<flux> kids, Just Use PCRE And Stay Safe!
<qwr> ;)
Snark has joined #ocaml
_JusSx_ has joined #ocaml
acatout has quit [Read error: 113 (No route to host)]
BigJ has joined #ocaml
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
derdon has quit []
Submarine has joined #ocaml
julm_ is now known as julm
onigiri has joined #ocaml
robocop has left #ocaml []
slash_ has joined #ocaml
derdon has joined #ocaml
palomer has quit [Read error: 110 (Connection timed out)]
<kaustuv_> Only problem with pcre is that it is nonstandard, and therefore broken by default in Windows. Like everything else nonstandard.
<derdon> windows is not the standard
<f[x]> pcre is pretty easy to build on windows, quite an exception compared to the majority of other ocaml libs
albacker has joined #ocaml
<Camarade_Tux> ocaml libs aren't hard to build, usually the problem is that you lack ocamlfind or that you can't camlp4 or ...
ttamttam has quit [Read error: 113 (No route to host)]
<flux> will batteries eventually grow into an ocaml distribution?-)
ttamttam has joined #ocaml
<hcarty> flux: Community OCaml would be a nice thing to have.
<f[x]> Camarade_Tux, did you ever try?
<mbishop> will batteries eventually have a stable release? :P
<Camarade_Tux> f[x]: oh yeah... ;p
<f[x]> the usual problem is that the build process uses some collection of unix utilities, and using them without cygwin is br0ken in different ways
<f[x]> the C bindings are almost never targeted for msvc, only gcc
<hcarty> mbishop: Unfortunately, the departure of David Teller threw things off balance a bit.
<mbishop> Departure?
<mbishop> where'd he go?
<hcarty> New job
<mbishop> Ah
<mbishop> that's a shame
<hcarty> He stated that he can work on Batteries, but not take the lead any longer due to time constraints.
<Camarade_Tux> f[x]: msys usually fits but the trouble is often that forward and backward slashes are mixed
<hcarty> mbishop: Indeed.
<Camarade_Tux> like C:\\msys\\home\\me\\ocaml/some/lib
<f[x]> Camarade_Tux, that one too
<hcarty> If there are fixes for building on Windows, the upstream authors would probably like to hear about them.
<hcarty> If they don't use Windows and don't receive contributions for making things work on Windows, there isn't a lot of incentive to work on such issues.
<f[x]> hcarty, yes, of course.
<derdon> f[x]: isn't programming on windows totally PITA?
ulfdoz has joined #ocaml
<f[x]> derdon, no
<derdon> hm, ok
<Camarade_Tux> hcarty: sure, the trouble is that it's definitely far from easy ;)
<gildor_> f[x]: the problem is that ocaml, like gcc, heavily consider to have Unix tools at hand
<gildor_> (i.e. working make, sed, sort..)
<Camarade_Tux> another problem is that we try to have a posix system while not having one : we'd like to have all the nice things from posix but to run everything on base unmodified windows
Submarine has quit [Remote closed the connection]
onigiri_ has joined #ocaml
<derdon> Camarade_Tux: the problem is, that windows still exists ;)
<Camarade_Tux> derdon: he ;p
* qwr . o O ( windows has posix, although not a very useful one... )
<flux> gildor_, the obvious solution: implement said tools in ocaml \o/
Snark has quit ["Ex-Chat"]
<Camarade_Tux> one of the way windows has posix is SFU/SUA (Services For Unix) and that actually uses a windows service that doesn't exist out-of-the-box for sure ;)
<Camarade_Tux> flux: ^^
<flux> hmmm.. a camlp4-extension (rather a whole new ruleset embedding ocaml language) that would be like awk but in ocaml.. ;-) <- free idea, you may implement it without any royalties
<flux> I suppose the same idea wouldn't work for sed ;)
<flux> too bad bluestorm isn't around, he was a sucker for new camlp4 ideas :P
onigiri has quit [Read error: 110 (Connection timed out)]
onigiri_ is now known as onigiri
Yoric[DT] has joined #ocaml
komar__ has joined #ocaml
<julm> http://lwn.net/Articles/352432/rss "Writing kernel modules in Haskell" wow :}
<kaustuv_> it's a decent idea as long as it can figure out how to not allocate any memory
<Camarade_Tux> and "Just don't try to merge it upstream." ;-)
<julm> it says "we can have modules that are type safe and garbage collected." :}
<kaustuv_> it also says that there is no attempt to release allocated memory, leading to space leaks
<julm> outch
albacker has quit ["Leaving"]
<derdon> is it right that there are only two stable GUI-bindings: one for tk (ugly) and one for GTK (looks only good when you don't have win or mac)
<derdon> ?
<kaustuv_> when I was at CMU at the height of the proof carrying code craze, there was a lot of talk of kernel modules written in standard ML
<Camarade_Tux> derdon: gtk looks ok on windows, it doesn't look 100% native but at least 95%
<Camarade_Tux> derdon: also, on mac, it looks like native to me (I don't have a mac so I probably don't see all the details that could differ)
<derdon> Camarade_Tux: what about icons in the toolbox for example? wx does it wery well
<Camarade_Tux> the thing with gtk is that it used to require X on mac but now it can run directly with Cocoa
<Camarade_Tux> derdon: no idea
<derdon> oh, cool
<Camarade_Tux> derdon: but I suspect you'll find the tango icon theme pretty often, but you can change that
<kaustuv_> but last updated in 2004, so ymmv
<derdon> kaustuv_: thanks
<Camarade_Tux> the last solution was to have python and its bindings do the UI
<derdon> Camarade_Tux: did you test the binding for extending/embedding with python? does it work fine?
<derdon> I am already familiar with python, btw
<Camarade_Tux> derdon: I haven't tried it but (* link coming *)
komar_ has quit [Read error: 113 (No route to host)]
<derdon> Camarade_Tux: PyCaml? did you mean that? well, I did
<Camarade_Tux> "A Proper GUI for OCaml (Part One)" (and part two)
<Camarade_Tux> you might also be interested in the other posts ;)
<derdon> thanks
vpm has joined #ocaml
brooksbp has joined #ocaml
jeddhaberstro has joined #ocaml
Alpounet has quit ["Leaving"]
albacker has joined #ocaml
kaustuv_ has left #ocaml []
ulfdoz has quit [Read error: 110 (Connection timed out)]
albacker has quit ["."]
ttamttam has quit ["Leaving."]
_zack has quit ["Leaving."]
_andre has quit ["Lost terminal"]
Yoric[DT] has quit ["Ex-Chat"]
tvn2009 has joined #ocaml
<tvn2009> does Hashtbl.iter iterates the hashtable in specific order or it's not guarantee ? e.g., if I has values a , b , c , d , e ,f to hashtable ht ,
<tvn2009> then iterating ht always iterates a b c d e f
<tvn2009> ?
<tvn2009> in that order
f[x] has quit [Read error: 110 (Connection timed out)]
<julm> tvn2009: the doc says « The order in which the bindings are passed to f is unspecified. »
komar__ has quit ["WeeChat 0.2.6.3-ohshi"]
erickt has quit ["Leaving."]
erickt1 has joined #ocaml
bohanlon has quit ["leaving"]
derdon has quit []
_JusSx_ has quit ["leaving"]
travisbr1dy has joined #ocaml
dabd has quit [Client Quit]
Smerdyakov has quit ["Leaving"]
smimou has quit ["bli"]
thrasibule has joined #ocaml
brooksbp has quit [Read error: 110 (Connection timed out)]
rcloud` has joined #ocaml
rcloud` has quit [Remote closed the connection]
rcloud has quit [Remote closed the connection]
travisbr1dy is now known as travisbrady
travisbrady has quit ["Get MacIrssi - http://www.sysctl.co.uk/projects/macirssi/"]
travisbrady has joined #ocaml
travisbrady has quit [Client Quit]
luisgrin has left #ocaml []
jeddhaberstro has quit [Client Quit]