flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
<wmeyer> ousado: functors and modules are very powerful concept, and usually they don't bite as type classes in some cases :-)
<wmeyer> (but I do love type classes once they are robust in Coq)
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<ousado> :)
pkrnj has joined #ocaml
<ousado> wmeyer: thanks
<wmeyer> ousado: I wouldn't be worried too much about not being able to parametrise the type, in practice it's really a high level abstraction that's not strictly required.
<wmeyer> but you do have a tool
<wmeyer> :-)
<ousado> yes, I think you're right there
<wmeyer> ousado: no wory, have fun
<wmeyer> damn it, I have to write code! :-D
<ousado> hehe
<wmeyer> actually I want to share a project with somebody, that would be perfect, but have no idea what I'll be writing this weekend, probably working for my daytime job
<ousado> wmeyer: what do you have in mind?
<ousado> you could take a look at the haxe compiler :D
<wmeyer> i could but not at the moment
<MarcWeber> wmeyer: You could also write a composable make system for ocaml :)
<wmeyer> I think pippijn would beat me down :-)
* wmeyer is going to bed. Good night!
<ousado> wmeyer: good night!
oriba has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
emmanuelux has quit [Remote host closed the connection]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 268 seconds]
ulfdoz_ is now known as ulfdoz
<amiller_> why can't i write this in ocaml:
<amiller_> let f_on_int_and_string (f : 'a -> unit) (x : int) (y : string) = (f x; f y);;
<amiller_> i tried sneaking a forall 'a in there
<amiller_> let fxy (f : 'a . 'a -> unit) ... but that doesn't parse
introom has joined #ocaml
<pippijn> wmeyer: beat you down?
<pippijn> wmeyer: I hope your next project you start with someone doesn't end like ours
<amiller_> i can't do "type idtype = 'a . 'a -> 'a"
<amiller_> but i can do "type idtype = {id_f : 'a . 'a -> 'a}" for some reason
<amiller_> bizarre
<dsheets> amiller_, what will your universal function do?
<amiller_> i think you know :p
<dsheets> "nothing"?
<dsheets> the easiest thing to do with every type is nothing
<amiller_> a good one is fun x -> assert false
<dsheets> why do you need to pass a value with a specific type, then?
<dsheets> i like fun () -> assert false
<pippijn> what do you use that for?
<amiller_> the 'a . 'a -> 'a was a simpler example than the one i'm using
<dsheets> asserting false as a side effect
<amiller_> what i actually am using is more of the kind ('a . 'a authtype -> 'a authtype)
<amiller_> so it should use the info about my authtype constructor but nothing about its parameter
<dsheets> this sounds like just regular polymorphism
madroach has quit [Ping timeout: 248 seconds]
travisbrady has joined #ocaml
<amiller_> apply_to_int_and_string (f : 'a . 'a authtype -> 'a authtype) (x : int authtype) (y : string authtype) = (f x, f y)
<amiller_> that doesn't work in ocaml because the "'a ." can't be there, and without the "'a ." it also doesn't work because f has to be monomorphic
madroach has joined #ocaml
csakatoku has joined #ocaml
gnuvince has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
q66 has quit [Quit: Leaving]
oriba has quit [Quit: oriba]
Drup has quit [Quit: Leaving.]
osnr has quit [Quit: Leaving.]
gnuvince has quit [Remote host closed the connection]
gnuvince has joined #ocaml
ttamttam has joined #ocaml
darkf has joined #ocaml
ttamttam has left #ocaml []
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Quit: Leaving.]
mye has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Client Quit]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Client Quit]
osnr has joined #ocaml
osnr has quit [Client Quit]
Neros has quit [Ping timeout: 256 seconds]
ygrek has joined #ocaml
<pippijn> whitequark: extlib has utf-8 and utf-32, but no utf-16
dsheets has quit [Ping timeout: 264 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
travisbrady has quit [Quit: travisbrady]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
mye_ has joined #ocaml
mye has quit [Ping timeout: 264 seconds]
mye_ is now known as mye
osnr has quit [Quit: Leaving.]
chris2 has quit [Ping timeout: 245 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
lopex has joined #ocaml
bobry has joined #ocaml
IbnFirnas has joined #ocaml
davekong has joined #ocaml
osnr has quit [Quit: Leaving.]
walter has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
walter has quit [Client Quit]
pootler has quit [Ping timeout: 268 seconds]
pootler__ has quit [Ping timeout: 264 seconds]
pootler_ has quit [Ping timeout: 264 seconds]
pootler has joined #ocaml
pootler_ has joined #ocaml
pootler__ has joined #ocaml
ggherdov has joined #ocaml
Snark has joined #ocaml
jyeo has joined #ocaml
Yoric has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 268 seconds]
ygrek has quit [Ping timeout: 268 seconds]
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
Yoric has quit [Ping timeout: 252 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 248 seconds]
Yoric has joined #ocaml
csakatoku has joined #ocaml
osa1_ has joined #ocaml
csakatoku has quit [Ping timeout: 248 seconds]
csakatoku has joined #ocaml
UncleVasya has joined #ocaml
wmeyer has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 268 seconds]
chris2 has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
csakatoku has quit [Remote host closed the connection]
osa1_ has quit [Ping timeout: 268 seconds]
ggole has joined #ocaml
Nahra_ has quit [Quit: leaving]
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
Kakadu has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 264 seconds]
<whitequark> pippijn: yeah
<whitequark> so I have this problem with ocamlbuild: ocamlbuild launches menhir with --infer, and so it needs to actually process the source
<whitequark> however if I attempt to use extlib inside the parser, it explodes, because ocamlbuild doesn't pass any -package flags to the ocamlc invocation which it gives to menhir
<whitequark> how do I solve this?
thomasga has joined #ocaml
Kakadu has quit []
q66 has joined #ocaml
osnr has joined #ocaml
osa1 has joined #ocaml
osnr has quit [Ping timeout: 248 seconds]
ygrek has joined #ocaml
Yoric has joined #ocaml
rly has joined #ocaml
tane has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
introom has quit [Remote host closed the connection]
weie_ has quit [Read error: Connection reset by peer]
weie has joined #ocaml
osnr has joined #ocaml
osnr has quit [Ping timeout: 268 seconds]
<flux> is there a Set I can insert/remove values from so that it can contain the same value multiple times?
<orbitz> A Map
<flux> and then I get to keep track of the insertion count, yes
<flux> (if I remove a multiple-inserted element from a map, it removes them all)
<orbitz> Well you'd wrap it in any API, of course
<flux> yes, I know how to implement it, but I was wishing it would've been done for me :)
<flux> hmm, yes
<companion_cube> I should write a multiset myself, actually ^^
<orbitz> Ugh, i hate it when compiling something all of a sudden stops working with noindication as to why since I didn't cahnge the make file at all
ontologiae has joined #ocaml
csakatoku has joined #ocaml
ontologiae has quit [Ping timeout: 248 seconds]
<pippijn> whitequark: I have no idea
<pippijn> whitequark: I didn't solve that
<pippijn> whitequark: I moved all code that uses packages out of the parser
<pippijn> So it does appear that the function to call menhir in ocamlbuild lacks an argument. I'll make a report in mantis for that.
<pippijn> whitequark: I found this, too
<pippijn> I looked at the ocamlbuild sources, trying to find an answer
<pippijn> but without luck
Drup has joined #ocaml
<flux> hah, I started writing it with MultiPMap, but it doesn't have min_binding
<companion_cube> a multiset ?
<companion_cube> hmmm, I'm going to write one then ^^
<flux> I'll just hang on here ;-)
<whitequark> pippijn: look at the link I posted
<whitequark> I did the mlypack trick and it just works
<pippijn> ok, nice
ttamttam1 has joined #ocaml
zpe has joined #ocaml
<companion_cube> (and the .ml)
ollehar has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
ygrek has quit [Ping timeout: 268 seconds]
eikke has joined #ocaml
ttamttam1 has quit [Quit: ttamttam1]
<flux> companion_cube, exactly! although I implemented a very small subset of that, but maybe I'll switch ;)
<companion_cube> I did not really test, especially the union/intersection, but well, it's pretty straightforward
zpe has joined #ocaml
eikke has quit [Ping timeout: 256 seconds]
Yoric has quit [Ping timeout: 252 seconds]
dsheets has joined #ocaml
introom has joined #ocaml
osnr has joined #ocaml
mye has quit [Quit: mye]
ollehar1 has joined #ocaml
ollehar has quit [Ping timeout: 248 seconds]
osnr has quit [Ping timeout: 276 seconds]
eikke has joined #ocaml
Yoric has joined #ocaml
Neros has joined #ocaml
gautamc has quit [Ping timeout: 268 seconds]
eikke has quit [Ping timeout: 268 seconds]
zpe has quit [Remote host closed the connection]
csakatoku has quit [Remote host closed the connection]
sgnb` is now known as sgnb
Yoric has quit [Ping timeout: 252 seconds]
mye has joined #ocaml
gautamc has joined #ocaml
demonimin has quit [Ping timeout: 252 seconds]
tobiasBora has joined #ocaml
demonimin has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
jayprich has joined #ocaml
weie has quit [Read error: Connection reset by peer]
osnr has quit [Ping timeout: 276 seconds]
weie has joined #ocaml
Neros has quit [Ping timeout: 264 seconds]
cross has joined #ocaml
Neros has joined #ocaml
tani has joined #ocaml
tane has quit [Ping timeout: 268 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 264 seconds]
tobiasBora has quit [Quit: Konversation terminated!]
UncleVasya has quit [Read error: Connection reset by peer]
UncleVasya has joined #ocaml
ygrek has joined #ocaml
mcclurmc has joined #ocaml
mye has quit [Quit: mye]
dsheets has quit [Ping timeout: 264 seconds]
introom has quit [Remote host closed the connection]
<rly> Is there something I can do against curl empty response when I use opam? Is opam hosted in some Internet waste land or something?
watermind has joined #ocaml
csakatoku has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 276 seconds]
csakatoku has quit [Ping timeout: 256 seconds]
fraggle_ has joined #ocaml
csakatoku has joined #ocaml
tobiasBora has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
mcclurmc has quit [Ping timeout: 276 seconds]
fraggle_ has quit [Remote host closed the connection]
eikke has joined #ocaml
eikke has quit [Ping timeout: 248 seconds]
UncleVasya has quit [Remote host closed the connection]
csakatoku has quit [Remote host closed the connection]
wmeyer has joined #ocaml
jayprich has quit [Ping timeout: 264 seconds]
<ousado> when I define a type within a functor, like value_t here: https://gist.github.com/ousado/71ac2a20843ee197cbf2
ashleyis has joined #ocaml
<ousado> what are the rules for the visibility of the fields of such records?
<jpdeplaix> ousado: it's v.TestFI.v
<ousado> jpdeplaix: oh..
<ousado> wow
jayprich has joined #ocaml
<ousado> that's somewhat surprising
malo has joined #ocaml
<ousado> I had another case where this seemed to work
<ousado> but that was in a local open
<ousado> of the functor
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
<ousado> jpdeplaix: aha, yes. thanks.
<jpdeplaix> yes. But it's normal since M.v.v is not what we want
<jpdeplaix> ousado: you're welcome :)
ben_zen has joined #ocaml
<jpdeplaix> ousado: you can also do this with a local open TestFI.(v.v)
<jpdeplaix> (I think)
<ousado> yes, that was the main source of my confusion
<ousado> it seemed to work in one case and not the other
<ousado> but one was in a local open
<ousado> unfortunately I can't use local opens in this code, though
<ousado> since the haxe developers are stuck with ocaml 3.11
csakatoku has joined #ocaml
csakatoku has quit [Remote host closed the connection]
<whitequark> uh. conversion from ADTs to JS structures in js_of_ocaml is likely the ugliest code I ever wrote
<whitequark> Js.array Array.of_list (List.map js_of_loc hilights)
<nicoo> whitequark: "Hey ! What did you expect ?"
malo_ has joined #ocaml
Simn has joined #ocaml
malo_ has quit [Client Quit]
malo has quit [Ping timeout: 268 seconds]
Yoric has joined #ocaml
snearch has joined #ocaml
fraggle_ has joined #ocaml
ggole has quit []
mfp has quit [Read error: Connection reset by peer]
<amiller_> is it the case that i cannot marshal serialize anything larger than 1GB?
ollehar has joined #ocaml
ollehar1 has quit [Ping timeout: 248 seconds]
<wmeyer> pippijn: indeed. I'd like to have time for this, but currently have no real time.
<wmeyer> pippijn: beat me down, you know despite we were doing quite well with the previous project, I think your knowledge about the build system is now far more advanced than mine.
osa1 has quit [Quit: Konversation terminated!]
mfp has joined #ocaml
mrvn has joined #ocaml
mcclurmc has joined #ocaml
<mrvn> Is there a framework that helps with writing ocaml structures to a socket and reading them back? And something that helps with maintaining compatibility over time? Something to handle out features and help with translating between different versions?
<ygrek> extprot
<wmeyer> hi ygrek
<ygrek> why framework?
<ygrek> wmeyer, hi!
<wmeyer> :-)
<ygrek> just a serialization format
<ygrek> my choice is extprot, there are also atdgen and bin-prot, but they are more limited wrt compatibility iirc
<wmeyer> a small chime in: bi-directional DSL for describing serialisation would be the best you could go. Both in binary and text. Worth to look at type-conv and the Boomerang language. Maybe someday I am going to write one.
<nicoo> Protobuf is nice, also (though binary only)
<companion_cube> Bencode is cool for text
<companion_cube> (it's really basic thoughà
<ygrek> protobuf has nothing wrt compatibility, the same for bencode
<ygrek> ok, not sure about protobuf %)
<companion_cube> right
<nicoo> ygrek: protobuf has facilities for extending a format while staying {back;for}wards-compatible
<nicoo> If that's what you meant
<nicoo> (If you mean cross-platfom compat, it does have it too)
<mrvn> ygrek: I want to write type foo = Bla of int | Blub of string | Barf of float @{ver >= 1.2} or something
ollehar has quit [Ping timeout: 264 seconds]
<mrvn> The hardest part is how to tell the framework what older clients can do and how to translate between older and newer clients.
snearch has quit [Quit: Verlassend]
<nicoo> Sounds doable with extension_points and poly variants (so as to have type foo1.0, foo1.2, ... with appropriate relationships)
Yoric has quit [Ping timeout: 252 seconds]
<mrvn> nicoo: yes
<wmeyer> mrvn: usually it just means that the protocol need to carry the additional information needed retract the changes between versions. Protobuf does it, but not fully
csakatoku has joined #ocaml
<mrvn> wmeyer: ignoring unknown entries is one thing. But sometimes you can't just ignore stuff but have to transform the data into some other type to get at least partial meaning across.
<nicoo> wmeyer: Actually, IIRC, this info is only in the protocol description. no such metadata is sent over the wire.
<nicoo> And what do you mean by "not fully" ?
<wmeyer> not only ignoring entires you have to have a bi-directional transform between them. If enum changes order you have to capture that.
<wmeyer> restricting that is good
<wmeyer> what kind of changes (removing or adding entries is one restriction for instance)
<wmeyer> are possible
Watcher7|off is now known as Watcher7
csakatoku has quit [Ping timeout: 276 seconds]
<mrvn> Does extprot have support for async IO? Is there something that I can feed chunks of data received and it calls a callback for every completed message or something that I feed a X bytes and it then tells me the total message length?
iZsh has quit [Quit: Coyote finally caught me]
<wmeyer> nicoo: you can detect the version of the protocol, and send needed meta data, you have to do it just once per protocol
zpe has joined #ocaml
Neros has quit [Ping timeout: 268 seconds]
iZsh has joined #ocaml
iZsh has quit [Excess Flood]
iZsh has joined #ocaml
osa1 has joined #ocaml
<wmeyer> mrvn: it must have I think. I'd guess one of the two solutions you have pointed (even driven IO, and classical poll) would work, which one is implemented (maybe both) I am not sure.
<wmeyer> the other one which can be implemented on top any of these (although poll seems to be more flexible), is of course Lwt or Async interface for asynchonous code
<mrvn> extprot doesn't seem to have anything for providing translators between different versions. Only seems to support extending with stuff that can be ignored if unknown and with default value if missing.
<mrvn> :(
<wmeyer> it's not so obvious how to do this :-)
<mrvn> yeah. That's why I want a framework that tells me how. :)
<wmeyer> write one mrvn!
<wmeyer> the theorey of Darcs patches might be in help
<wmeyer> to establish the implementation of the meta protocol that handles the version changes
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
Zerker has joined #ocaml
<mrvn> Maybe I should implement the freeciv framework in ocaml. It has something to annotate structure members with feature flags and handles those features out on connect. And it keeps track of what client and server knows and sends only the bits of a structure that changed on update.
<nicoo> Sound nice.
<mrvn> but also complex. I don't quite grog all of it yet.
<mrvn> They don't have a nice framework with docs and examples. Just the implementation in freeciv.
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
demonimin_ has joined #ocaml
demonimin has quit [Ping timeout: 252 seconds]
<ygrek> mrvn, nothing for async but it is possible to do on the higher level
<ygrek> nicoo, didn't know that protobuf can do forward-compatibility
Zerker has quit [Quit: Colloquy for iPad - Timeout (10 minutes)]
<mrvn> ygrek: yeah, seems like I need to try read ... with IO.No_more_inpuit -> wait for more
<ygrek> I just do framing and return a complete message for parsing with extprot when it is ready
demonimin_ is now known as demonimin
<mrvn> ygrek: kind of stupid since extprot lists having the length of the message in the wire protocol as one of its features already.
<nicoo> mrvn, ygrek : Just found about piqi.org ; doesn't have versioning, though.
<ygrek> yes, but I prefer not to mix things
testcocoon has quit [Quit: Coyote finally caught me]
<ygrek> the framing is common code that is used for all kinds of payload
<ygrek> gtg
<mrvn> nicoo: there are lots of serialize/deserialize frameworks. But the versioning and compatibility stuff is the hard part. That's what's missing.
<nicoo> mrvn: Yup, I know. But piqi sound nicer than most.
<mrvn> ygrek: How do you handle multiple different messages with extprot? Do you make a sum type over all possible messages and then a large switch statement in the reader?
ygrek has quit [Ping timeout: 264 seconds]
testcocoon has joined #ocaml
johnkk has joined #ocaml
<johnkk> How do I convert any data type into the string which the REPL prints for that object? This is the code I have along with the output expected: http://pastie.org/8116083
<johnkk> In that example, I want the string 'expr = Or (Var "a", And (Var "b", Var "c"))'
ben_zen has quit [Ping timeout: 276 seconds]
transfinite has quit [Quit: transfinite]
malo has joined #ocaml
csakatoku has joined #ocaml
zpe has quit [Remote host closed the connection]
yacks has quit [Ping timeout: 268 seconds]
csakatoku has quit [Ping timeout: 248 seconds]
Yoric has joined #ocaml
zorun has quit [Ping timeout: 256 seconds]
zorun has joined #ocaml
UncleVasya has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
pkrnj has joined #ocaml
tchell_ is now known as tchell
yacks has joined #ocaml
Uvs has joined #ocaml
UncleVasya has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
transfinite has joined #ocaml
darkf has quit [Quit: Leaving]
ski has joined #ocaml
johnkk has quit [Quit: Page closed]
mcclurmc has quit [Read error: Connection reset by peer]
csakatoku has joined #ocaml
gnuvince has quit [Ping timeout: 256 seconds]
csakatoku has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
q66 has quit [Remote host closed the connection]
q66 has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
Snark has quit [Ping timeout: 264 seconds]
fraggle_ has quit [Remote host closed the connection]
ashleyis_ has joined #ocaml
ashleyis has quit [Ping timeout: 252 seconds]
<mrvn> Anyone familiar with oasis? E: Malformed log file '/home/mrvn/src/debian/ocaml-4.00/ocaml-expect/ocaml-expect-0.0.2/setup.log' at line 1
wmeyer has quit [Ping timeout: 264 seconds]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
avsm has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
<nicoo> Would someone know if there is a unicode library which makes accent removal simple ?
* nicoo has yet to figure how to do that with Camomille
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
<nicoo> Seems /wg #code
<nicoo> Oops
<whitequark> nicoo: I think you need NFKD and then filtering by character classes
<nicoo> whitequark: That's the part of the doc I was looking at, but Camomille's OCamlDoc isn't very helpful :o
Arthur__ has joined #ocaml
Arthur_ has quit [Read error: Connection reset by peer]
cdidd has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
csakatoku has joined #ocaml
weie_ has joined #ocaml
weie has quit [Ping timeout: 264 seconds]
cdidd has quit [Quit: Leaving]
csakatoku has quit [Remote host closed the connection]
jayprich has quit [Ping timeout: 268 seconds]
watermind has quit [Quit: Konversation terminated!]
cdidd has joined #ocaml
Watcher7 is now known as Watcher7|off
* nicoo hugs companion_cube
<companion_cube> \o
ulfdoz has quit [Ping timeout: 276 seconds]
walter has joined #ocaml
<whitequark> hm, can you suggest a data structure? I have a set of consecutive ranges and each one has associated string
<whitequark> e.g. 0-5:a 6-80:b 81-90:c
<whitequark> and given a number, I need to quickly look up the corresponding string
wmeyer has joined #ocaml
<whitequark> some kind of tree, I guess
<wmeyer> is it so humid in France too?
<wmeyer> here, the weather is brillaint, but a bit too hot
<nicoo> companion_cube: Seems random, but I was too lazy to write a multiSet implementation, and a friend pointed me to ocaml-containers/multiSet :3
walter has quit [Client Quit]
<orbitz> whitequark: interval tree perhaps?
<companion_cube> nicoo: we've talked about it just today, you're lucky!
<whitequark> orbitz: hm, the wiki article on interval tree says that for non-overlapping interval, I'm totally fine with a binary tree
<Drup> interval tree is not necessary if it's known that the range are consecutive.
<whitequark> essentially, I want that to efficiently store location info in AST
<whitequark> a single location ("cursor") is represented by a single int, which indexes a concatenated view of all existing source files
<orbitz> Just write it so yo ucan swap out the structure at any point and implement it with a list :)
<whitequark> orbitz: obviously
<whitequark> I already know that a naive approach here sucks, though :)
<orbitz> Is your problem that your program is done and the naive approach is slowing it down or that your program is not done and you're optimizingsomething before you can even do what you want to do?
<whitequark> orbitz: I wrote a prototype and linear search in a list was a bottleneck
<orbitz> okay great
<whitequark> (in some workloads I care about.)
<orbitz> Does it sound like an interval tree will do what you want
<orbitz> ?
<whitequark> yes, but it also looks like an overkill, since my ranges do not overlap
<Drup> whitequark: if the goal is to know the string associated to an int, just do a binary search tree with leaf in the string
<Drup> (and node indexed by int, obviously)
<whitequark> Drup: well, I have the same string associated to an arbitrarily big range of consecutive ints
<Drup> whitequark: yes, and you can encode that using int on the internal nodes
<whitequark> I see. I should read up on data structures.
<whitequark> thanks
<Drup> it's good if you want fast access, I'm not sure it's really good if you want fast insertion/deletion
<whitequark> I don't delete at all
<whitequark> and I only add new nodes at the "end"
<Drup> (it's still better than list)
<whitequark> uh... if I just snap them on naively, I'll end up with a completely unbalanced tree
<Drup> yes :)
<orbitz> Do you know the entire set prior to adding them?
<Drup> orbitz: I was precisely going to ask that :D
<whitequark> orbitz: let's say no
jbrown has joined #ocaml
<orbitz> well, that's annoying
walter has joined #ocaml
<orbitz> do you need the tree created prior to adding?
<orbitz> (do yo ureadfrom it at any point during the creation)
Yoric has quit [Ping timeout: 252 seconds]
<whitequark> I think I can delay its creation until I actually need it, and by that point I'll have most of the ranges already known
<whitequark> well, how to make a balanced tree in this case is obvious :)
<Drup> indeed
<whitequark> in fact, if I need to add more ranges afterwards, I may just as well throw it out completely and rebuild
walter has quit [Client Quit]
<whitequark> chances that at the end, it will be faster than keeping it up
<whitequark> I'll also use the same structure for looking up line numbers by position...
<wmeyer> ping adrien
<mrvn> I wonder if sexplib could be implemented with GADTs instead of camlp4
thomasga has quit [Quit: Leaving.]
pkrnj has joined #ocaml
yacks has quit [Ping timeout: 248 seconds]
<nicoo> companion_cube: You have a pull request ! (Adding the trivial 'contains' function to multiSet)
<companion_cube> there is a mem function
<companion_cube> oh, I see
<nicoo> Thanks :)
<mathieui> nicoo: tri-cy-vial*
ollehar has joined #ocaml
Simn has quit [Quit: Leaving]
<whitequark> ugh. ocamllex generated about 2200 LOC of junk
<whitequark> what is wrong with it
* mrvn gazes into his magic-8-ball
<mrvn> error in line 23
<whitequark> mrvn: lol, that was a rhetorical question
Uvs has quit [Remote host closed the connection]
<whitequark> "why is its output so fucking ugly"
<mrvn> generated code usualy is
<whitequark> though I think I know why... each keyword is a separate rule
<mrvn> Here is my first attempt to use GADTs for a type save data dumper: http://paste.debian.net/14765/
<companion_cube> mrvn: hey, I have something like this: https://github.com/c-cube/ocaml-containers/blob/master/bij.mli
<mrvn> companion_cube: you should make yout triplet as Pair of Pair
<companion_cube> mrvn: you can use both, it's just simpler to have triplets when needed
<mrvn> | Triple : 'a t * 'b t * 'c t -> ('a * ('b * 'c)) t
<mrvn> Is the Switch and Branch* for records?
emmanuelux has joined #ocaml
<companion_cube> it's for algebraic datatypes
<companion_cube> because the encoded type depends on which constructor is used
<mrvn> Ok. So no support for records then?
<whitequark> aren't records product types essentially
tobiasBora has quit [Quit: Konversation terminated!]
<mrvn> except for labels and mutability
<whitequark> right, mutability.
<whitequark> mrvn: labels (imo) don't matter, since that is just syntactic sugar
<mrvn> labels only matter for pretty printing
<whitequark> you can do without them on the lowest level, eg erlang
<mrvn> I stuffed the record into a recursive type. Would be nicer to have a list or array for it.
<mrvn> (accessor * type) array
<companion_cube> mrvn: well, products are just tuples, here
<mrvn> Problem there is that for each index the accessor and type have a different type.
<mrvn> e.g. ((fun r -> r.x), Int) and ((fun r -> r.f), Float)
<mrvn> Maybe something like type _ entry = Entry : a * 'b * 'c -> 'c entry and then 'c entry array
<companion_cube> the potential difficulty is to handle deserialization, because then you need to create the whole record at once
<mrvn> easier with recursive definition too. You then just need a function taking all fields and you feed it the values one by one recursively and you end up with the record.
<mrvn> With list/array you need to encode the length in the type
<mrvn> companion_cube: Have you looked at sexplib and how it does this?
<companion_cube> sexplib does it by generating code, I believe
<mrvn> camlp4 module
<mrvn> Might not be too difficult to adapt sexplib to output GADTs instead of the code and then use GADT based code for the conversions and pretty printing.
ollehar has quit [Ping timeout: 276 seconds]
* mrvn curses at whoever thought it a good idea to change the type of Pa_type_conv.add_sig_generator
snearch has joined #ocaml