<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
<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)]
<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)]