schme has quit [Read error: 104 (Connection reset by peer)]
schme has joined #ocaml
jlouis has quit [Remote closed the connection]
znutar has joined #ocaml
yminsky has joined #ocaml
Torment has joined #ocaml
Ugarte has quit [Remote closed the connection]
Ugarte has joined #ocaml
LordMetroid has quit ["Leaving"]
schme has quit [Remote closed the connection]
middayc_ has left #ocaml []
gim has quit [Read error: 110 (Connection timed out)]
bla has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
shortcircuit has quit [Read error: 110 (Connection timed out)]
bla has joined #ocaml
shortcircuit has joined #ocaml
Jedai has quit [Connection timed out]
schme has joined #ocaml
schme has quit [Remote closed the connection]
schme has joined #ocaml
chacun has joined #ocaml
catch22 has quit [Read error: 104 (Connection reset by peer)]
|Catch22| has joined #ocaml
darinm has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
Ramzi has quit [Read error: 110 (Connection timed out)]
alexyk has joined #ocaml
<thelema>
l
|Catch22| has quit [Read error: 104 (Connection reset by peer)]
|Catch22| has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
yangsx has joined #ocaml
robozni has quit [Read error: 104 (Connection reset by peer)]
robozni has joined #ocaml
darinm has quit []
Smerdyakov has quit [Read error: 110 (Connection timed out)]
fuzzdk has joined #ocaml
|Catch22| has quit ["To the best of my knowledge, I guess that I'm fresh"]
bluestorm has joined #ocaml
kig_ has joined #ocaml
kig has quit [Read error: 104 (Connection reset by peer)]
<TychoBrahe>
demat deoc'h
rodge has quit [Remote closed the connection]
jonafan_ has joined #ocaml
kig_ has quit [Read error: 110 (Connection timed out)]
filp has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
fuzzdk has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
alexyk has quit []
alexyk has joined #ocaml
alexyk_ has joined #ocaml
OChameau has joined #ocaml
Smerdyakov has joined #ocaml
alexyk has quit [Read error: 110 (Connection timed out)]
LordMetroid has joined #ocaml
Snark has joined #ocaml
ozzloy has joined #ocaml
fuzzdk has joined #ocaml
fuzzdk has quit [Remote closed the connection]
chacun has quit []
yangsx has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
kig_ has joined #ocaml
zeno_ has joined #ocaml
zeno_ has quit [Remote closed the connection]
zeno_ has joined #ocaml
alexyk_ has quit []
zeno_ has left #ocaml []
RobertFischer has joined #ocaml
m3ga has joined #ocaml
Snark has quit ["Ex-Chat"]
<yziquel>
Hello. When using the toplevel, doing #use "topfind";; and then #require "netclient";; I sometimes, but not always, get the error "No such package: cryptgps - Required by `rpc-auth-dh'". Anyone knows what it means?
sporkmonger has quit []
seafood_ has joined #ocaml
sporkmonger has joined #ocaml
coucou747 has joined #ocaml
kig_ has left #ocaml []
<flux>
yziquel, somehow your installation of netclient is messed up?
<flux>
yziquel, does ocamlfind list | grep cryptgps display the package?
LordMetroid has quit ["Leaving"]
m3ga has quit ["disappearing into the sunset"]
seafood_ has quit [Read error: 113 (No route to host)]
<flux>
hm, I suppose when you use Sys.catch_break, you can't really tell which thread will receive the signal?
<flux>
so I just better catch it myself and put it to a message queue..
mikeX has joined #ocaml
rodge has joined #ocaml
mikeX_ has quit [Read error: 110 (Connection timed out)]
kornerr has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
pango_ has quit [Remote closed the connection]
delamarche has joined #ocaml
<delamarche>
so i had a job interview yesterday, and we were playing with some code
<delamarche>
and i had to implement a BST in C++
<delamarche>
so I did it, and we were talking
<delamarche>
(this was on paper)
<delamarche>
and then I was like, 'you wanna see something cool'?
<delamarche>
and I implemented a BST in OCaml in like 15 lines straight out of okasaki's book :D
<delamarche>
it was hella fun
<delamarche>
that's my story
pango_ has joined #ocaml
<orbitz>
afternoon
<bluestorm>
delamarche: BST ?
<mbishop>
binary search tree, I assume
<bluestorm>
ah, right
<delamarche>
yessum
<delamarche>
I didn't even notice that I used an acronym for that
<delamarche>
scary
<bluestorm>
Balanced S... Tree would have been even more impressive :-'
<delamarche>
I've done red/black trees in ocaml
<bluestorm>
ergh
<delamarche>
AVL trees threw me a bit because I couldn't figure out how to compute the height in O(1) when checking for rebalancing
<delamarche>
I'm still thinking about it before looking it up on the web
<orbitz>
the curent balance can be a propert yof every node
<orbitz>
and you compute it again as you add
<delamarche>
Yeah that's what i was trying to do
<delamarche>
i kept fudging it
<delamarche>
The thing I love about implementing data structures in OCaml is that it's really obvious where the complexity is
<delamarche>
at first when I saw a huge match with | BLARGH statement that did the rebalancing, I was thinking to myself 'how is this a better approach'?
<delamarche>
but what that's really doing is forcing you to realize that this algorithm is complex, pay attention fool
<delamarche>
and it keeps the complex stuff in a small window that can be comprehended, eventually
<delamarche>
whereas in something like C++, pointer hell means that you can't distinguish the algorithm from the details that easily
<delamarche>
IMO
<bluestorm>
i guess i shoud try to practice that kind of things more
<bluestorm>
implementations of red/black tree just frighten me :p
<delamarche>
i'm trying to figure out if it 'makes sense' to implement a suffix array in ocaml
jonafan_ is now known as jonafan
<jonafan>
red black trees aren't too complicated... except for deleting nodes which i've never understood
<bluestorm>
the only balanced trees that i would dare to implement are the 2-3 trees
<delamarche>
yeah, n-ary trees are cake :D
<jonafan>
i don't think you can do deleting nodes without having parent pointers
<jonafan>
which i think messes up the whole immutable data structure aspect pretty badly
<delamarche>
any bst delete is tough without parent pointers
<delamarche>
which is usually why they don't remove nodes from trees in functional data structure tutorials, I think :D
<jonafan>
regular bsts aren't too hard
<mbishop>
yeah deleting is the hard part
<delamarche>
no because you can do the swap from teh node being removed in a BST
<jonafan>
yeah, i wrote a red black tree when i was learning ocaml, and i just marked nodes as deleted and kept track of how many nodes were deleted and how many there were total
<delamarche>
but seriously, how often do you remove elements from a set or map, anyways? :D
<jonafan>
so i could rebuild the whole thing if over half of it was garbage
<delamarche>
that's a good easy-way-out approach actually, I like it
<delamarche>
oh yeah i want to do a bloom filter in ocaml too
<delamarche>
although I think I've seen one before
<jonafan>
buuut why use your own red black tree when there's the Map module
<jonafan>
even if it is a crazy functor thingy
<delamarche>
for fun
<delamarche>
no other reason really
<delamarche>
to be honest I don't know how map is implemented
<delamarche>
i have yet to look under that particular hood
<jonafan>
i think it's an avl tree
<petchema>
yep, with slightly relaxed rebalancing, iirc
Linktim has joined #ocaml
Demitar has joined #ocaml
<delamarche>
well, I guess I know where to look for a reference implementation of AVL trees then
<delamarche>
awesome
* qwr
. o O ( libraries tend contain some weird performance-tuned code... )
Demitar has quit [Read error: 110 (Connection timed out)]
<yziquel>
flux: Thanks for your answer. I've installed it now, and everything works. However, it looks like a missing dependency in the debian packages.
Yoric[DT] has joined #ocaml
schme has quit [Remote closed the connection]
schme has joined #ocaml
postalchris has quit [Remote closed the connection]
schme has quit [Read error: 104 (Connection reset by peer)]
schme has joined #ocaml
|Catch22| has quit [Read error: 104 (Connection reset by peer)]
|Catch22| has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
|Catch22| has quit [Read error: 104 (Connection reset by peer)]
|Catch22| has joined #ocaml
OChameau has quit ["Leaving"]
delamarche has quit []
ikaros_ has quit ["segfault"]
evn_ has joined #ocaml
|Catch22| has quit [Read error: 113 (No route to host)]
|Catch22| has joined #ocaml
<bluestorm>
he Yoric[DT], interesting issue
<bluestorm>
pa_monad developpers provide a tuareg patch
<bluestorm>
would you, more generally, be interested in distributing some standard developpement tools, eg. tuareg + a vim mode ?
evn_ has left #ocaml []
<flux>
a patch for generally supporting monadic programming even without pa_monad, >>= etc ;)
postalchris has joined #ocaml
<bluestorm>
hm flux
<bluestorm>
how is ">>=" as a binary operator not supported by tuareg right now ?
postalchris has quit [Remote closed the connection]
postalchris has joined #ocaml
<Yoric[DT]>
bluestorm: I personally would.
<Yoric[DT]>
Assuming I found time, which is far from sure.
<bluestorm>
:p
<bluestorm>
have you asked for the git project yet ?
<Yoric[DT]>
By the way, I believe type-conv should be distributed on the camlp4 side, don't you think ?
<Yoric[DT]>
No, not yet.
<bluestorm>
yes, distributing type-conv on camlp4 side totally makes sens
<bluestorm>
i'll include it then
<bluestorm>
actually, i was even thinking of providing a "Camlp4 utilities library", and type-conv has a bit of that
<Yoric[DT]>
Sounds like a good idea.
Amorphous has joined #ocaml
ikaros has joined #ocaml
Morphous_ has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]>
thelema: ping
<flux>
bluestorm, I was thinking it would indent it differently from other expressions..
* Yoric[DT]
uses a different syntax extension
<Yoric[DT]>
assume x = e in f
<Yoric[DT]>
A bit longer to write but imho a bit more readable.
Amorphous has quit [Connection timed out]
rwmjones_ has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
rwmjones_ has quit [Client Quit]
rwmjones_ has joined #ocaml
hcarty has quit [Read error: 110 (Connection timed out)]
* rwmjones_
needs a structure for efficiently handling mapping ranges ...
<rwmjones_>
domain is integers (probably from 0 up to a few 100 million)
<rwmjones_>
range will be an 'a
Demitar has quit [Read error: 110 (Connection timed out)]
<rwmjones_>
ideas?
<Yoric[DT]>
you mean int -> 'a ?
<rwmjones_>
lots of contiguous regions
<rwmjones_>
well, int (* bounded [0..100_000_000] *) -> 'a
<rwmjones_>
ok so in concrete terms what I want to do is this:
<rwmjones_>
I have a hard disk
<rwmjones_>
block size 1K or whatever
<rwmjones_>
blocks are numbered 0 .. some fixed large limit
<rwmjones_>
I want to keep track of what filesystem lives in ranges of blocks, eg.
<rwmjones_>
partition /dev/hda1 is /boot and lives in blocks 5000 - 200000
<Yoric[DT]>
You want to replace Reiser now that he's out of the range ? :)
<rwmjones_>
/dev/hda2 lives in blocks 200001 to 400000
<Yoric[DT]>
s/the//
<rwmjones_>
ha ha no
<rwmjones_>
the actual number of ranges will be only a few hundred probably
<rwmjones_>
the catch is in the way it's constructed though ... I need to be able to insert randomly & efficiently
postalchris has joined #ocaml
<Yoric[DT]>
More than removing ?
* Yoric[DT]
guesses AVLs would be fine.
<rwmjones_>
never need to remove anything I don't think
<pango_>
I think that's what linux kernel uses to store address mappings
* rwmjones_
is pondering what needs to be done
Demitar has joined #ocaml
<rwmjones_>
yes, it uses AVLs (when the virt maps are > than some size, I think below that it uses a linked list)
<rwmjones_>
yeah, it's a very similar situation
|Catch22| has quit [Read error: 104 (Connection reset by peer)]
palomer has joined #ocaml
schme has quit [Remote closed the connection]
schme has joined #ocaml
Snark has quit ["Ex-Chat"]
|Catch22| has joined #ocaml
alexyk has joined #ocaml
Linktim has quit [Remote closed the connection]
jwhiteman has joined #ocaml
jwhiteman has left #ocaml []
evn has quit []
filp has joined #ocaml
hcarty has joined #ocaml
<hcarty>
Does anyone have any experience with or pointers to examples of the runtime performance of functors vs classes in OCaml?
<bluestorm>
hcarty: you could generate example code quite easily, using a function wich specialize on floats (eg. (<) )
rogo has joined #ocaml
<hcarty>
I'll give it a shot... I have used OCaml classes before, but not functors so this is partly an excuse to learn how to use them effectively and to have a direct comparison with OCaml OO
<hcarty>
Jason Hickey's chapter on functors seems to make the basics clear though
<bluestorm>
ah, and you'll find example on the defunctorize home page
<bluestorm>
although they ran on a quite old version of ocaml, so maybe the benchmarks are not accurate anymore
<hcarty>
I remember reading something from Xavier Leroy on the mailing list indicating that the penalty for using functors is/was on the order of 3%
<hcarty>
But I've also read that class method calls are (sometimes) cached, elminating their runtime penalty
<flux>
hcarty, should depend on the code, no?
<bluestorm>
hcarty: the problem is with low-level optimization
<bluestorm>
« So, defunctorizing the previous example works well with the operator + but not with the operator /. Note however that when n = 2, caml transforms the operator / into a shift operation (which is much more efficient than a division) if we defunctorize. »
<hcarty>
flux: I would think so. That's why I am reluctant to trust microbenchmarks on this.
<bluestorm>
do you really care about a ~3% performance penalty ?
<hcarty>
bluestorm: Yes, and in this case I'm working with histogram array arrays so there may not be that much of a penalty
<bluestorm>
(i don't, but maybe you have high requirements)
<hcarty>
bluestorm: No re:3%
<hcarty>
I just git-branch'd to test functors... I expect and hope that any differences will be lost in the noise
<hcarty>
I just wanted to check for others' experiences. The subject seems to come up every once in a while on the lists and no clear answers come out. Which probably means there is no clear answer.
asmanur has joined #ocaml
<orbitz>
hello
<orbitz>
quesiton
<orbitz>
type 'a list = Nil | :: of 'a * 'a list;;, if i do 1 :: Nill it come sout as: - : int list = :: (1, Nil)
<orbitz>
is :: defining an operator there or osmething? and why is the :: infront
alexyk has quit []
<bluestorm>
hum
<bluestorm>
orbitz: :: is a constructor
<bluestorm>
like Tree or Nil
<Smerdyakov>
I don't think the definition you gave is legal OCaml.
<bluestorm>
but it's a syntaxic exception
<bluestorm>
Smerdyakov: it appears to be
<bluestorm>
orbitz: :: is the only constructor that can be used in infix position
<Smerdyakov>
Oh.
<bluestorm>
but you should not use it to construct your own types
<bluestorm>
i'm not even sure it's reported in the manual (ie. considered implementation-independent)
<orbitz>
of course, just an edge case someoen aske dme about
sporkmonger has quit [Read error: 110 (Connection timed out)]
<bluestorm>
if you want to mess things up you can even use
<bluestorm>
type 'a list = () | :: of 'a * 'a list
<bluestorm>
(you must have noticed that [] doesn't work)
<orbitz>
ohh sexy:)
Yoric[DT] has quit ["Ex-Chat"]
<orbitz>
is that still in ocaml for any good reason?
<orbitz>
what do you think of typeclasses? It seem slike a nice idea if you want to be able to overload operators but from what i've read they seem to incure a big cost
alexyk has joined #ocaml
|Catch22| has quit [Read error: 113 (No route to host)]
<hcarty>
bluestorm: Well, for the snippet on the ocamldefun page, functors and classes seem to incur a similar run-time cost, and the scaling for basic (+) and (/) seems to be similar to what is shown in that table
<bluestorm>
hm, you were specifically asking for comparison between functors and objets ?
<bluestorm>
this is in some way strange, because i wouldn't use functors and objects for the same purpose
<hcarty>
I'm not sure which would be better for what I am doing
<bluestorm>
(this book is very interesting overall, but when i came across it for the first time i surely did not have the required formal background to understand some parts of it)
<hcarty>
I have 'a grid_t (grid_t is a record with 'a array array and missing : 'a, among others) and I would like to create different types of grids, which allow different operations to be performed on them
<hcarty>
So a histogram grid_t, float grid_t, int grid_t, etc.
<bluestorm>
do you need subtyping ?
<hcarty>
Functors + include seems to be the proper module-way, while classes + inherit seems to be the proper OO way
<bluestorm>
what i don't understand is why you need functors actually
<bluestorm>
wouldn't plain modules + include do the job ?
<hcarty>
Perhaps? Can I restrict the 'a in 'a grid_t somehow in that case?
<hcarty>
I may be making this more complicated than it needs to be
<bluestorm>
hmm
<hcarty>
The type inference may make that a non-issue
<bluestorm>
camlp4 question : do you consider important that camlp4 extensions use the proper functor registering procedure, instead of extending PreCast ?
<bluestorm>
i think it is important and that extensions i would integrate should do that, but i just realized that actually none of them respect that rule for now
<hcarty>
bluestorm: What is the difference? Does the functor registration make it easier to stack extensions?
<bluestorm>
the problem is that i'm not 100% sure about that :]
<bluestorm>
hcarty: i think that functor registration make it possible to use those extensions with a custom lexer/parser
<bluestorm>
that is, they provide a way to override the stack of a specific Syntax instead of the "default" one wich is in PreCast
<bluestorm>
i should probably dive deeper into the camlp4 sources to have a clear idea of that, but i think it's the idea
<bluestorm>
(if i understand correctly, the registration method is a quite hairy way to emulate first class modules, in order to defer the EXTEND .. END commands application on the grammar)
rwmjones_ has quit [Remote closed the connection]
rogo has quit [Remote closed the connection]
fasd has joined #ocaml
pango_ has quit [Remote closed the connection]
Modius has joined #ocaml
pango_ has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]