<tbrady>
Are you mutable record fields faster typically than using immutable w/ "functional update"? ala {myrec with some_field = 1}
<_habnabit>
tbrady, you profiled your code and found one of them was a bottleneck?
<tbrady>
_habnabit: nope. Just curious.
<_habnabit>
use whichever one makes more sense. they have different semantics
sepp2k has joined #ocaml
ski has joined #ocaml
ski has quit [Ping timeout: 255 seconds]
<rgrinberg>
is it possible to remove a random element out of BatSet without turning it into some other data structure?
<_habnabit>
rgrinberg, how random is random
<rgrinberg>
well i'm doing some simulation so i'd prefer it to be uniformly distributed
<_habnabit>
rgrinberg, using batteries, I hope? it would be easy with BatRandom.choice
<rgrinberg>
what i have working now is arr.(Random.int arr_length) but I also need fast membership checks
<rgrinberg>
yes im using batteries
<_habnabit>
YourSet.remove (YourSet.enum s |> Random.choice) s
<_habnabit>
hooray
<_habnabit>
are you going to do this repeatedly or just once in a while?
<rgrinberg>
I'm going to do this over and over
<rgrinberg>
probably 50 * 1000 times at least
<_habnabit>
removing just one element each time?
<rgrinberg>
i have a "step selector" function that picks how many elements get changed but it's not very sophisticated so about 1-3
<rgrinberg>
at every step
<_habnabit>
oh, so you're substituting elements? not just removing them?
<rgrinberg>
well not exactly, i remove them when I'm above my goal and add them when I'm below
<_habnabit>
okay
<rgrinberg>
i'll just explain my problem to you fast it's easy to state. I have a song library and I need to select a "playlist" out of it that is close to the to user's specified total duration as possible
<_habnabit>
oh
<rgrinberg>
order does not matter, but I cannot have duplicates
<_habnabit>
that's the knapsack problem !!
<rgrinberg>
also I cannot give him the same songs every time...
<rgrinberg>
so I should give 3 or more different playlists to choose from
chipmonk010 has joined #ocaml
<rgrinberg>
also, it can't be too slow since it's part of a web app
<_habnabit>
anyway you should look at ocaml solutions to the knapsack problem
<_habnabit>
there's algorithmic solutions that aren't just repeated random subsampling
<rgrinberg>
I did before but i was told that it was deterministic which wouldn't be good for me
<_habnabit>
it isn't necessarily
<rgrinberg>
ok I'll take a look at it again hopefully with better results..
<rgrinberg>
thanks for the help
<_habnabit>
if you need help with making it random, you could ask about that here
<_habnabit>
anyway time to bike home
chipmonk010 has quit [Quit: leaving]
chipmonk010 has joined #ocaml
chipmonk010 has quit [Client Quit]
chipmonk010 has joined #ocaml
asmanur_ has joined #ocaml
asmanur has quit [Ping timeout: 265 seconds]
tbrady has quit [Quit: tbrady]
tbrady has joined #ocaml
tbrady has quit [Quit: tbrady]
ankit9 has joined #ocaml
Xizor has joined #ocaml
Progster has quit [Ping timeout: 248 seconds]
ankit9 has quit [Ping timeout: 252 seconds]
sepp2k has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
robthebob has quit [Read error: Operation timed out]
ski has joined #ocaml
ski has quit [Ping timeout: 255 seconds]
Xizor has quit [Ping timeout: 260 seconds]
robthebob has joined #ocaml
pango is now known as pangoafk
ulfdoz has quit [Ping timeout: 252 seconds]
robthebob has quit [Ping timeout: 265 seconds]
ftrvxmtrx has quit [Quit: Leaving]
sampego has joined #ocaml
gnuvince has quit [Ping timeout: 252 seconds]
ankit9 has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
<mehdid>
I can't reproduce it but maybe I did something special that I can't seem to remember :/
mort___ has quit [Quit: Leaving.]
ocp has joined #ocaml
tumdum has quit [Remote host closed the connection]
joewilliams has quit [Write error: Broken pipe]
bobry has quit [Remote host closed the connection]
lopex has quit [Write error: Connection reset by peer]
tumdum has joined #ocaml
tumdum has quit [Changing host]
tumdum has joined #ocaml
tumdum has quit [Changing host]
tumdum has joined #ocaml
ivan\ has quit [Ping timeout: 246 seconds]
chambart has quit [Ping timeout: 252 seconds]
ivan\ has joined #ocaml
sepp2k has quit [Remote host closed the connection]
Progster has joined #ocaml
eni has joined #ocaml
lopex has joined #ocaml
robthebob has joined #ocaml
<flux>
hmm, I thought that was fixed eons ago..
<flux>
in the emacs code that is
_andre has joined #ocaml
mort___ has joined #ocaml
<mehdid>
I thought so… but the "found version" is marked as 3.12.0 and upstream did ack the issue.
<mehdid>
So I was a bit surprised too…
<mehdid>
and ocaml's caml-types.el (3.12.0) does check for .annot files under _build
ankit9 has quit [Quit: Leaving]
ocp has quit [Quit: Leaving.]
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
thomasga has joined #ocaml
thomasga has quit [Ping timeout: 244 seconds]
gnuvince has quit [Ping timeout: 249 seconds]
thomasga has joined #ocaml
chambart has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
saml has joined #ocaml
chambart has joined #ocaml
thomasga has quit [Quit: Leaving.]
rixed has quit [Ping timeout: 245 seconds]
avsm has quit [Quit: Leaving.]
rixed has joined #ocaml
sergio1 has joined #ocaml
eni has quit [Ping timeout: 246 seconds]
Snark has joined #ocaml
gnuvince has joined #ocaml
robthebob has quit [Ping timeout: 244 seconds]
K_F has quit [Ping timeout: 240 seconds]
K_F has joined #ocaml
fantasticsid has joined #ocaml
<Drakken>
Would there be any kind of performance problem with defining all the functions in a module as one huge mutual recursion, even if it's not necessary?
<adrien>
performance wouldn't be my main concern
<adrien>
readability would
<Drakken>
all you have to do is put a "rec" after the first "let" and replace the other lets with "and".
<adrien>
rather than "readibility": "understandability"
<adrien>
as for performance, the compilation time will probably increase noticeably
<Drakken>
that makes sense
<hcarty>
Drakken: For what it's worth, I agree with adrien. 'and' has certain implications that will make it more difficult for a human to reason about the code at a glance.
<hcarty>
The primary implication being that your code be referencing a lot more than it could with a simple 'let' :-)
<Drakken>
The implication is a matter of convention. That can be changed.
<hcarty>
Drakken: It's not convention. It changes the meaning of the code.
<hcarty>
The convention would need to change in the language definition
<Drakken>
Nothing changes as long as functions aren't redefined.
<hcarty>
Drakken: Out of curiosity, what are you looking to gain by making everything let-rec'd?
<Drakken>
It lets you define functions in top-down order.
<hcarty>
Value redefinition is pretty common in OCaml
<Drakken>
but that brings us back to understandability issues.
<hcarty>
Drakken: You could delve into the world of -ppx (OCaml 4.x) or camlp4 if you want to avoid compilation time or execution time losses.
<Drakken>
hcarty I'm not worried about anything right now. I just thought I would throw that question out and see what ppl think :)
<hcarty>
Drakken: I am personally torn on the readability of "let rec f x = g x + 1 and g x = x + 2" vs "let g x = x + 2 let f x = g x + 1"
thomasga has joined #ocaml
<flux>
I think it's beneficial for the reader to just see the module order and read each module from top to bottom and never see anything he needs to look from a file he hasn't read yet.
ski has joined #ocaml
<flux>
however, I agree that sometimes it can be a bit painful to write..
<flux>
and if you have those pains and you work aruond the trouble it may cause, the resulting code might not be that nice to read after all..
<hcarty>
flux: I agree I think. Knowing that code always goes top-to-bottom is helpful.
<hcarty>
s/I think/
Cyanure has joined #ocaml
Ninju has left #ocaml []
robthebob has joined #ocaml
avsm has joined #ocaml
beckerb has quit [Ping timeout: 248 seconds]
ocp has joined #ocaml
<adrien>
woot, updates to hevea coming \o/
fschwidom has joined #ocaml
svenl has quit [Ping timeout: 246 seconds]
fschwidom has quit [Remote host closed the connection]
Kakadu has quit [Quit: Page closed]
thomasga has quit [Read error: Connection reset by peer]
eni has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Ping timeout: 244 seconds]
thomasga1 has joined #ocaml
avsm has quit [Quit: Leaving.]
<Ptival>
lol
<Ptival>
adrien: the HTML5 stuff? :)
cago has quit [Quit: Leaving.]
mika1 has quit [Quit: Leaving.]
bobry has joined #ocaml
Cyanure has quit [Remote host closed the connection]
avsm has joined #ocaml
fantasticsid has quit [Remote host closed the connection]
saml has quit [Quit: Leaving]
avsm has quit [Quit: Leaving.]
sampego has quit [Quit: Page closed]
eikke has quit [Ping timeout: 250 seconds]
sergio1 has quit [Ping timeout: 250 seconds]
joewilliams has joined #ocaml
silver has quit [Read error: Connection reset by peer]
<hcarty>
A significantly more complex competitor from what I can see
eikke has quit [Ping timeout: 265 seconds]
smondet has joined #ocaml
asdfhjkl has joined #ocaml
Snark has quit [Quit: Quitte]
asdfhjkl has left #ocaml []
ocp has joined #ocaml
mcstar1 has joined #ocaml
ivan\_ has joined #ocaml
bzzbzz_ has joined #ocaml
ivan\ has quit [*.net *.split]
mcstar has quit [*.net *.split]
f[x] has quit [*.net *.split]
bzzbzz has quit [*.net *.split]
rwmjones has quit [*.net *.split]
ivan\_ is now known as ivan\
gnuvince has quit [Ping timeout: 248 seconds]
f[x] has joined #ocaml
rwmjones has joined #ocaml
<thelema_>
hcarty: yes, quite complex.
mcstar1 has quit [Quit: mcstar1]
gnuvince has joined #ocaml
cdidd has quit [Read error: Connection reset by peer]
_andre has quit [Quit: leaving]
Znudzon_ has joined #ocaml
eni has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
sepp2k has joined #ocaml
ocp has quit [Quit: Leaving.]
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
Submarine has quit [Ping timeout: 248 seconds]
Znudzon_ has quit [Read error: Operation timed out]
gnuvince has quit [Ping timeout: 240 seconds]
testcocoon has quit [Quit: Coyote finally caught me]
<dsheets>
module type FOO = Package.FOO doesn't alias and allow to use (module Foo : FOO) in place of (module Foo : Package.FOO)? Is there anyway to shorten first-class module types?
ftrvxmtrx has quit [Ping timeout: 248 seconds]
testcocoon has joined #ocaml
<_habnabit>
dsheets, "doesn't alias" ?
<dsheets>
_habnabit: I get an error that says "Error: This expression has type (module FOO) but an expression was expected of type (module Package.FOO)" and at the top of my module I have "module type FOO = Package.FOO"
<dsheets>
_habnabit: am I missing something obvious?
<_habnabit>
ah. no idea, sorry.
Xizor has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Client Quit]
Znudzon_ has joined #ocaml
ftrvxmtrx has joined #ocaml
<thelema_>
_habnabit: yes, you can't do that - modules are nominally typed.
<dsheets>
thelema_: ok.
benozol has joined #ocaml
Anarchos has joined #ocaml
benozol has quit [Quit: Konversation terminated!]
beckerb has joined #ocaml
<Ninju>
Hi, I'm having trouble distributing a binary we need to statically link with SDL (or dynamically linking the libraries in a folder inside the app would also be fine). Does anyone know what I need to put in the Makefile (using OCamlMakefile)? I've been playing around with it all day and can't figure it out.
Znudzon_ has quit [Ping timeout: 240 seconds]
<adrien>
Ninju: be more specific about your issue
* adrien
-> bed
<Ninju>
I'm trying to distribute a build to a client who does not have a development system and so I'm trying to send a binary
<Ninju>
its a graphical app (we're using the ocaml sdl bindings)
<adrien>
you'll always have to send more than one file
<Ninju>
well i mean, what do you suggest?
<Ninju>
right now we just need to send them something they can run because its already overdue
<adrien>
you'll have to send the C .so file along with the ocaml program
<adrien>
the bindings, in native code mode, will be linked statically so you won't need another file
<adrien>
and then, LD_LIBRARY_PATH or similar will let you make it findable
<Ninju>
don't suppose you know how to compile to native with OCamlMakefile do you?
<adrien>
what do you mean?
<Ninju>
all: native-code did it, thanks though
BiDOrD_ has quit [Read error: Operation timed out]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]