datkin has quit [Read error: Connection reset by peer]
datkin has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
Tobu has quit [Ping timeout: 260 seconds]
NihilistDandy has quit []
Tobu has joined #ocaml
destrius has joined #ocaml
datkin has quit [Ping timeout: 250 seconds]
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
datkin has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
xenocons has quit [Read error: Connection reset by peer]
wtetzner has quit [Remote host closed the connection]
mjonsson has quit [Quit: Leaving]
tufisi has joined #ocaml
Tobu has joined #ocaml
kerneis has joined #ocaml
kerneis has left #ocaml []
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
zorun has quit [Read error: Connection reset by peer]
zorun has joined #ocaml
andreypopp has joined #ocaml
mcclurmc has quit [Excess Flood]
cago has joined #ocaml
andreypopp has quit [Quit: Quit]
Cyanure has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
dgfitch has quit [Ping timeout: 244 seconds]
djcoin has joined #ocaml
<Ptival>
anyone using typerex and showing trailing whitespaces?
<Ptival>
somehow typerex cancels my whitespace-highlighting stuff
silver has joined #ocaml
Tobu has joined #ocaml
zcero has joined #ocaml
avsm has joined #ocaml
abdallah has joined #ocaml
<abdallah>
what is the most efficient way to represent a "bool option array" of size, say, 81? I need to modify individual values and copy a lot, or have a persistent interface. If the size was always < 16 I would use the bits of an int, but in my application the size can vary from 25 to 361.
<pippijn>
bool option array?
<Ptival>
:D
<pippijn>
like, a tristate array?
<abdallah>
yes
<adrien>
type t = | Ja | Nein | Jein
<pippijn>
efficient in terms of what?
<adrien>
but what pippijn just said ;-)
<abdallah>
my current implementation is just "bool option array", but the Array.copy is killing me.
<pippijn>
speed?
<abdallah>
yes
<adrien>
best way would be to have less copies in the first place; would that be doable?
<abdallah>
it does not seem easy to reduce the number of copies.
<pippijn>
I don't know enough about ocaml's runtime behaviour to give good advice
<pippijn>
you can try adrien's suggestion and see if that's fast enough
zcero has quit [Quit: Lost terminal]
<abdallah>
basically I have a combinatorial search algorithm that can go in different directions, so for each possible direction I copy the structure I'm studying.
<pippijn>
otherwise you can try using an int array (if memory throughput is an issue)
<adrien>
depending on how your algorithm works, a list might even be fine
<zorun>
true, you wouldn't even need to copy it all other the place
<pippijn>
that might ever reduce copying (depending on the algorithm, indeed)
<pippijn>
even*
<zorun>
OCaml is clever enough to do some CoW when needs be
<pippijn>
zorun: how is that?
<zorun>
pippijn: how is what?
<zorun>
when you make recursive calls with a list, it doesn't copy the list
<abdallah>
If i use all the bits of the ints in the int array (as opposed to just the first two bits as in the tristate), it's the most efficient solution memory-wise and the copies should be faster since the arrays will be smaller, but it's a bit tricky to implement.
<djcoin>
abdallah: bool option could also be just bit rather than bool. You may then use masking and >> << to get the bool you want. Copying it would then be damn fast, access only a little slower
<djcoin>
If really optimization is needed
<abdallah>
I need random access so a list won't do it. I tried Filliatre's persistent arrays instead of copying mutable arrays but it's not really fast enough.
<abdallah>
djcoin: what do you mean with >> << (I don't know this syntax)
<abdallah>
?
<djcoin>
bit shifting ?
<abdallah>
ok, like with asr lsl etc.
<djcoin>
lsl / lsr
<pippijn>
abdallah: try using the first two bits, but not manually, just use a tristate type (Yes|No|Maybe) like adrien suggested
<djcoin>
Yep, did not remember the syntax :)
<abdallah>
but it's limited to 31 bits (I have a 32 bit machine) at a time, and spreading my 81 * 2 bits over several ints does not make things simple...
<pippijn>
abdallah: not very complicated either, though
<abdallah>
pippijn: you mean "tristate array" instead of a "bool option"?
<pippijn>
yes
<pippijn>
no
<abdallah>
^^
<pippijn>
"tristate array" instead of "bool option array"
<abdallah>
yes, sorry...
<pippijn>
or "tristate" instead of "bool option"
<pippijn>
wow, the lag is killing me
<abdallah>
I'm not sure it'll be much faster since the arrays will have the same size, but it's easy so I'll try that first.
<pippijn>
I think you'll have one level of indirection less
<pippijn>
array elements are generally boxed, so you're still storing pointers, though
<pippijn>
so maybe it doesn't help, at all
<pippijn>
but yes, it's easy, and it will be interesting to know how it behaves
<abdallah>
it's true, but the copy seem to be the bottleneck rather than accessing the elements individually. And I think the speed is the same when I copy, a bool option or a tristate.
<pippijn>
hm yes
<pippijn>
maybe :)
<pippijn>
depends on whether the copy is a deep one or a shallow one
<abdallah>
I don't think OCaml ever does deep copies (unless manually implemented).
<pippijn>
then it probably won't help at all
emmanuelux has joined #ocaml
<abdallah>
it would help if accesing the values was the bottleneck. Still I'll test it, just to be sure. After all, with less memory usage and fewer indirections, I might get fewer cache misses and the effect might be noticeable...
<djcoin>
Is there an ocaml bot in the chan ?
<pippijn>
I'm not sure about the indirections
<pippijn>
abdallah: you could try a BatBitSet
<pippijn>
abdallah: but then one access needs two library calls
<pippijn>
abdallah: or Bigarray if you want an unboxed array
<djcoin>
>> let f bitboolarray i = (bitboolarray lsr i) land 1;;
<abdallah>
BatBitSet looks good, I'll see if I can extract it from batteries (which I do not currently use).
<djcoin>
f (65536 * 2) 17;; > int = 1
Tobu has quit [Ping timeout: 272 seconds]
<pippijn>
abdallah: try using it first
<pippijn>
if it is what you need, consider extracting it
<abdallah>
I guess you're right, but that would require installing batteries, modifying my makefile, passing the right arguments to ocamlbuild, ocamlopt, and the linker and it all sounds more complicated than trying to extract (if I'm lucky I just need to get rid of the Enum references)... Perhaps after having a look at the source I'll realize extracting is not trivial so I'll install before spending time on the extraction.
Kakadu has joined #ocaml
thomasga has joined #ocaml
eikke has joined #ocaml
<abdallah>
changing to tristate does not seem to give big gains: Array.copy went from 20% to 22%, so it's probably good but not very insignificant.
<abdallah>
*not very significant
benozol has joined #ocaml
Tobu has joined #ocaml
munga has joined #ocaml
avsm has quit [Quit: Leaving.]
<abdallah>
djcoin: pippijn: thanks for your ideas.
abdallah has quit [Quit: Ex-Chat]
<djcoin>
:b
oriba has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
eikke has quit [Ping timeout: 265 seconds]
mart has left #ocaml []
Tobu has joined #ocaml
ulfdoz has quit [Quit: kernel-upgrade]
bacam_ has joined #ocaml
dsheets1 has joined #ocaml
dsheets has quit [*.net *.split]
bacam has quit [*.net *.split]
ski has quit [*.net *.split]
bacam_ is now known as bacam
ski has joined #ocaml
ftrvxmtrx has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
ulfdoz has joined #ocaml
destrius has quit [Quit: Leaving.]
Tobu has quit [Ping timeout: 272 seconds]
_andre has joined #ocaml
Tobu has joined #ocaml
oriba has quit [Quit: oriba]
ulfdoz has quit [Read error: Operation timed out]
ulfdoz has joined #ocaml
snearch has joined #ocaml
munga has quit [Ping timeout: 252 seconds]
err404 has joined #ocaml
eikke has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
benozol has quit [Read error: Connection reset by peer]
benozol has joined #ocaml
<eikke>
did anyone ever create pread/pwrite bindings for Lwt?
munga has joined #ocaml
<diml>
eikke: note that the best you can do is to write Lwt_unix jobs for them, fds that support seeking do not support non-blocking
<diml>
so maybe you can just use Lwt_preemptive
<eikke>
is that what's done for read(2) as well?
<diml>
no for sockets and pipes (except pipes on windows) and yes for the rest
fraggle_ has quit [Read error: Connection reset by peer]
ftrvxmtrx has quit [Quit: Leaving]
Tobu has joined #ocaml
wieczyk has left #ocaml []
dgfitch has joined #ocaml
mcclurmc has joined #ocaml
cdidd has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
smondet has joined #ocaml
avsm has joined #ocaml
Kakadu has quit [Quit: Page closed]
munga has quit [Ping timeout: 244 seconds]
avsm has quit [Quit: Leaving.]
probst has quit [Quit: probst]
snearch has quit [Quit: Verlassend]
munga has joined #ocaml
Cyanure has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
avsm has joined #ocaml
cago has quit [Quit: Leaving.]
benozol has quit [Quit: Konversation terminated!]
eikke has quit [Ping timeout: 260 seconds]
avsm has quit [Quit: Leaving.]
malouin_ has left #ocaml []
Submarine has joined #ocaml
silver has quit [Remote host closed the connection]
Submarine has quit [Read error: Connection reset by peer]
Tobu has quit [Ping timeout: 272 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
avsm has joined #ocaml
smondet has quit [Read error: Connection reset by peer]
JuzorBNC is now known as Juzor
Submarine has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
dnm has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.2]
ulfdoz has quit [Ping timeout: 260 seconds]
Kikaxa has joined #ocaml
Kikaxa has left #ocaml []
ulfdoz has joined #ocaml
joelr has joined #ocaml
<joelr>
moin
<joelr>
can you match strings?
<pippijn>
yes
<_habnabit>
sure, why not
<pippijn>
have you tried?
<joelr>
yep
<joelr>
here
<pippijn>
what happened?
<joelr>
let s1 = "foo";;
Tobu has joined #ocaml
<joelr>
# let f = function | (_, s1) -> true | _ -> false;;
<joelr>
Warning 11: this match case is unused.
<pippijn>
oh
<joelr>
i suppose this s1 is taken as a variable name
<pippijn>
no, you can't do that
<pippijn>
s1 is a new binding
<_habnabit>
you have to do `s when s = s1`
<joelr>
# let f = function | (_, s = s1) -> true | _ -> false;;
<joelr>
Syntax error: ')' expected, the highlighted '(' might be unmatched
<thelema>
joelr: let f = function (_,x) when x = s1 -> true | _ -> false
<joelr>
oooh!!!
<joelr>
thanks a lot
<thelema>
or let f (_,x) = x = s1
<joelr>
the when is what i was missing
<joelr>
thank you guys
<joelr>
and girls?
smondet has joined #ocaml
Submarine has quit [Read error: Connection reset by peer]
ulfdoz has quit [Ping timeout: 265 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
Submarine has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
jderque has joined #ocaml
pango has quit [Ping timeout: 252 seconds]
joelr has quit [Quit: joelr]
pango has joined #ocaml
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
Xizor has joined #ocaml
avsm has quit [Quit: Leaving.]
Tobu has joined #ocaml
err404 has quit [Quit: Ex-Chat]
albacker has quit [Ping timeout: 246 seconds]
munga has quit [Ping timeout: 265 seconds]
Tobu has quit [Ping timeout: 272 seconds]
Juzor is now known as JuzorBNC
Tobu has joined #ocaml
ben_m has joined #ocaml
<ben_m>
Hello :) I'm want to make some animations/simulations (maybe with a bit of interaction) for my CompSci class. Is there a good OCaml library for this?
<hcarty>
ben_m: Gtk2 + Cairo may be your best bet under OCaml if you want interactivity. If you want something simpler and easier to get started with, the Graphics module that comes with OCaml may be useful.
<ben_m>
Thanks Graphics seems to be just what I wanted.
iago has joined #ocaml
eikke has joined #ocaml
jderque has quit [Quit: leaving]
<_habnabit>
is there a way to make an in_channel/out_channel pair? like pipe(20
<_habnabit>
pipe(2), even
stephane__g has joined #ocaml
stephane__g has left #ocaml []
stephane__g has joined #ocaml
stephane__g has left #ocaml []
cdidd has joined #ocaml
Schadenfreude has quit [Changing host]
Schadenfreude has joined #ocaml
Schadenfreude is now known as Qrntz
stephane__g has joined #ocaml
<hcarty>
_habnabit: Unix.pipe?
<_habnabit>
oh, well, I guess that would do it
<_habnabit>
just turn each into an $x_channel
<hcarty>
_habnabit: Yes, I think the Unix module does that internally in a few places
<hcarty>
Batteries likely has something more readily available, perhaps in the IO module
<_habnabit>
this was for something that takes specifically a Legacy.Pervasives.out_channel
stephane__g has quit [Quit: stephane__g]
<eikke>
would anyone have a myocamlbuild file which contains whatever is required so the compiler will find lwt/lwt_unix.h when compiling a C file?
_andre has quit [Quit: leaving]
Cyanure has joined #ocaml
<_habnabit>
er, can optional arguments not be erased? I have a function that's `?a:int -> ?b:int -> int -> int` and I tried to pass it to a function that takes `?b:int -> int -> int`, but ocaml tells me it's a type mismatch
<_habnabit>
hmm, I tried doing (f :> ?b:int -> int -> int) and I get "is not a subtype"
andreypopp has joined #ocaml
<_habnabit>
well, I solved it with doing `(f ?a:None)`
<jonafan>
can ocamlbuild watch files andr ebuild automatically
thomasga has quit [Quit: Leaving.]
<_habnabit>
but it seems like this should be acceptable without explicity partially applying the function
<thelema>
_habnabit: yes, that's the solution - for functions as arguments, the type doesn't auto-erase
<jonafan>
guess i can make a sh to make things slightly less tedious
<thelema>
for application is when optional parameters erase
<_habnabit>
ah
<_habnabit>
is there a specific reason for that?
<thelema>
jonafan: typerex
<thelema>
jonafan: are you using typerex?
<thelema>
_habnabit: I expect Jacques Garrigue could give you much more insight into that design decision, if you care to ask him on the list
<jonafan>
hmmmmm
<thelema>
_habnabit: I don't know myself.
<_habnabit>
haha, okay
<jonafan>
i also need to restart ocsigen every time
yroeht has quit [Ping timeout: 244 seconds]
yroeht has joined #ocaml
ggherdov has joined #ocaml
Xizor has quit []
ulfdoz has joined #ocaml
tufisi has quit [Read error: Operation timed out]
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
Submarine has quit [Remote host closed the connection]
willb has quit [Read error: Operation timed out]
cyphase has quit [Ping timeout: 246 seconds]
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
willb has joined #ocaml
cyphase has joined #ocaml
eikke has quit [Ping timeout: 260 seconds]
Tobu has quit [Ping timeout: 260 seconds]
smondet has quit [Remote host closed the connection]
andreypopp has quit [Quit: Computer has gone to sleep.]