gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
adlsaks has quit [Ping timeout: 264 seconds]
Amorphous has quit [Ping timeout: 246 seconds]
sepp2k has joined #ocaml
emmanuelux has joined #ocaml
Amorphous has joined #ocaml
valross has quit [Remote host closed the connection]
boscop has quit [Ping timeout: 240 seconds]
ptrf has joined #ocaml
fraggle_ is now known as fraggle_laptop
fraggle_laptop is now known as fraggle
fraggle is now known as fraggle_
fraggle_ is now known as fraggle_droid
fraggle_droid is now known as fraggle_
fraggle_ is now known as fraggle_droid
fraggle_droid is now known as fraggle_
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
ulfdoz_ is now known as ulfdoz
smerz has quit [Remote host closed the connection]
oriba has quit [Quit: Verlassend]
sepp2k has quit [Ping timeout: 252 seconds]
sepp2k has joined #ocaml
ymasory has joined #ocaml
ymasory has quit [Remote host closed the connection]
ymasory has joined #ocaml
ymasory has quit [Read error: Connection reset by peer]
ymasory has joined #ocaml
ymasory has quit [Read error: Connection reset by peer]
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
hashtrie has joined #ocaml
lewis1711 has joined #ocaml
npouillard has quit [Ping timeout: 264 seconds]
npouillard has joined #ocaml
dnolen has joined #ocaml
ymasory has joined #ocaml
lewis1711 has left #ocaml []
philtor has joined #ocaml
arubin_ has joined #ocaml
arubin_ is now known as arubin
joewilliams_away is now known as joewilliams
enthymeme has joined #ocaml
philtor has quit [Ping timeout: 248 seconds]
lopex has quit []
Modius has quit [Quit: "Object-oriented design" is an oxymoron]
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
hashtrie has quit [Remote host closed the connection]
enthymeme has quit [Read error: No route to host]
enthymeme has joined #ocaml
joewilliams is now known as joewilliams_away
npouillard has quit [Ping timeout: 260 seconds]
Modius has joined #ocaml
dnolen has quit [Quit: dnolen]
eye-scuzzy has quit [Read error: Operation timed out]
eye-scuzzy has joined #ocaml
npouillard has joined #ocaml
ymasory has quit [Quit: Leaving]
ikaros has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
hcarty has quit [Ping timeout: 250 seconds]
Yoric has joined #ocaml
pheredhel has quit [Ping timeout: 255 seconds]
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
pheredhel` has joined #ocaml
emmanuelux has quit [Read error: Operation timed out]
ikaros has quit [Quit: Leave the magic to Houdini]
Cyanure has joined #ocaml
myu2 has joined #ocaml
ankit9 has joined #ocaml
Associat0r has joined #ocaml
arubin has quit [Quit: arubin]
Snark has joined #ocaml
hcarty has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
hcarty has quit [Ping timeout: 246 seconds]
hcarty has joined #ocaml
lewis1711 has joined #ocaml
edwin has joined #ocaml
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
vivanov has joined #ocaml
larhat has joined #ocaml
vivanov has quit [Quit: leaving]
lewis1711 has left #ocaml []
adlsaks has joined #ocaml
philtor has joined #ocaml
adlsaks has quit [Ping timeout: 276 seconds]
adlsaks has joined #ocaml
mcclurmc has joined #ocaml
philtor has quit [Ping timeout: 246 seconds]
philtor has joined #ocaml
_andre has joined #ocaml
adlsaks has quit [Ping timeout: 250 seconds]
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
boscop has joined #ocaml
eye-scuzzy has quit [Ping timeout: 248 seconds]
mattam has joined #ocaml
eye-scuzzy has joined #ocaml
DimitryKakadu has joined #ocaml
dnolen has joined #ocaml
dnolen has quit [Excess Flood]
dnolen has joined #ocaml
myu2 has quit [Remote host closed the connection]
lopex has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
dnolen has quit [Quit: dnolen]
ankit9 has quit [Quit: Leaving]
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
lamawithonel has joined #ocaml
ikaros has joined #ocaml
oriba has joined #ocaml
hcarty has quit [Quit: leaving]
hcarty has joined #ocaml
emmanuelux has joined #ocaml
myu2 has joined #ocaml
joelr has joined #ocaml
<joelr> good day
<joelr> how do you use camlp4 as a pretty printer?
<rproust> joelr: with an existing syntax extension?
<joelr> rproust: piqi
<hcarty> joelr: There are a few pre-defined pretty printers
<joelr> produces un-pretty ocaml code
<hcarty> joelr: They aren't the neatest :-)
<joelr> dumps it into .ml files which i want to pretty print to understand them
<hcarty> The printers can be tweaked, but I don't understand enough of the camlp4 code to say how.
<joelr> i think it's just 'camlp4of ... '
<joelr> let me see if i can figure it out
<rproust> joelr: it's something like that
<hcarty> joelr: You can play around with "camlp4of Camlp4Printer.cmo ..." and "camlp4o Camlp4OCamlPrinter.cmo"
<rproust> camlp4o --help
<hcarty> There is also Camlp4OCamlRevisedPrinter.cmo for printing in the revised syntax
<rproust> joelr: example with deriving: camlp4o $(ocamlfind query deriving-ocsigen)/pa_deriving.cma test_deriving.ml
<hcarty> The revised printer does seem to do a much better job of giving the code a readable layout.
<rproust> generic form "camlp4o yoursyntaxextension.cma yourfile.ml"
<joelr> ok, thanks!
<rproust> anyone starting to tweak camlp4 syntax extensions/pretty printers should read all the posts of http://ambassadortothecomputers.blogspot.com/search/label/camlp4
<joelr> indeed
bohanlon has joined #ocaml
oriba has quit [Quit: Verlassend]
<rproust> and btw, pretty-printers are not suppose to output pretty source code, but merely source code. The other printer for camlp4 is an AST dump!
<rproust> you can prettyfy the outputed code with "gg=G" in vim, <don't know> in emacs
ikaros has quit [Quit: Leave the magic to Houdini]
<hcarty> rproust: I think the printer can do some beautification. There is a big difference between the revised syntax output and the standard syntax output.
MUILTFN has joined #ocaml
joewilliams_away is now known as joewilliams
jonafan_ is now known as jonafan
<thelema> looking for data structure advice: want to push (item,points) pairs sequentially and get out the top n items by points
<thelema> Sorted doubly-linked-list seems workable but maybe slow, although n = 100, will push 1E6 pairs in
<thelema> Is there anything better?
<jld> Some kind of heap? Or am I missing somehting about the requirements?
<thelema> well, I don't really want to keep the 999,900 non-top pairs
<jld> Ah.
<thelema> specifically, I want to fold across 1E6 pairs and end up with the top 100 items
<thelema> I'm thinking a map, keyed by points and inserting if better than the worst and dropping the worst on insert (after the map has 100 entries)
<jld> That's the best thing I've thought of.
<thelema> thanks
Yoric has quit [Quit: Yoric]
<mrvn> Make a heap and invert the score. Heap.insert x; if Heap.size > 100 then pop
<mrvn> At the end pop the 100 elements into a list (which also reverse them back to right order)
<mrvn> Or just plain keep a sorted list of the top 100 and insert. That's O(100 n)
<mrvn> Most elements will be less than the first element in the list too (smallest first).
<mrvn> Keeping the so far 100th element cached and comparing any new element against that before inserting should give a nice speedup if you use some other structure than a list.
<thelema> mrvn: good ideas. So far I've implemented the map version with the cached min_value
larhat has quit [Quit: Leaving.]
<mrvn> thelema: first draft:
<mrvn> Can you run that against your 1E6 samples?
<thelema> current implementation: http://paste.debian.net/112240/
brendan has quit [Quit: leaving]
<mrvn> have you timed it with and without line 4?
<thelema> not yet. I'm currently extending the implementation to use many of these
<thelema> basically I'm categorizing input data (standard mahcine learning), and need to report the n most certain results
<thelema> in each category
brendan has joined #ocaml
avsm has joined #ocaml
Smerdyakov has joined #ocaml
<thelema> with line 4: 4.43s, without: 4.25s -- apparently not so important
<thelema> that said, this is benchmarking the whole fold across all the data, which does more than top_n
<thelema> mrvn: this is only on 125K datapoints, and I'm still keeping the min_k value...
sepp2k has quit [Quit: Leaving.]
<thelema> huh, oddly the time goes up when I don't maintain min_k
ulfdoz has joined #ocaml
avsm has quit [Quit: Leaving.]
schme has joined #ocaml
schme has quit [Changing host]
schme has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
<mrvn> thelema: Does Map have special code to insert a new min element?
<thelema> mrvn: no
<joelr> is there a way to write a function that works on all records that have at least field foo? the records will be in different modules but the field name and type will always be the same
<mrvn> joelr: yes and no. What you do is you git it an accessor function.
<thelema> joelr: not possible, because the fieldname can't be guaranteed to be in the same offset in the record
<joelr> darn
<thelema> you can cheat and use Obj to get data directly out of a certain position from the record, but that's double-plus bad.
<mrvn> joelr: do_somthing_with_record (fun x -> x.foo) records
<joelr> mrvn: that do_something fun would need to work on many records of -different- types
<joelr> thelema: there's a benefit to objects, apparently
<mrvn> joelr: and for each type you give it a different closure
<thelema> joelr: each type gets its own x -> x.foo closure to access the right position in x
<joelr> as i was able to rely on the presence of a method with a given signature
<joelr> i see
<thelema> yes, objects are structurally typed, records are nominally typed
<mrvn> Could one use a functor to eliminate the closure?
<joelr> and since the closure has the same type it should always work
<thelema> mrvn: I don't think that would help in terms of performance. It might help in terms of code cleanliness, but functors aren't so light
boscop_ has joined #ocaml
<mrvn> thelema: sure. but I wonder how one would even write the functor. you can't express "type t = record with field foo"
<thelema> mrvn: type r val get_foo : r -> int
<mrvn> thelema: that isn't eliminating the closure. That just gives it a name.
<thelema> true. Then no, you can't eliminate the closure using a functor.
<mrvn> would be nice if records had prefix coercion.
boscop has quit [Ping timeout: 246 seconds]
Yoric has joined #ocaml
<joelr> darn
<rproust> there was a "polymorphic record" syntax extension available at some point
<rproust> idk if it has been ported to 3.12
<joelr> i guess i'll have to gather into a module all the different functions that work on my records and then specialize that on the record type and assign the various functions
<mrvn> or stick with objects
<joelr> can't stick with objects :-(
<joelr> switched from thrift to piqi
<joelr> the former uses objects and the latter uses records
<thelema> joelr: any reason you can't use ext-prot?
<joelr> thelema: well... compatibility with java and such. piqi is protocol buffers.
<joelr> what's so good about extprot? that was my preference but i have to get the team to agree
<joelr> thelema: are you the guy behind extprot?
<thelema> I've never used them. Jane street is behind extprot
<thelema> iirc
<joelr> ah!
<joelr> mfp: ^
<thelema> or not... mfp
<joelr> i see that mfp has forked extprot, maybe he knows
<thelema> I guess jane street only uses sexplib
<joelr> thelema: how would extprot help me?
<thelema> ah, jane street uses bin_prot. anyway...
<joelr> bin_prot? where's that
<thelema> joelr: I don't know, but I imagine something built in the ocaml world will have less of these impedence mismatches that you're running into
<thelema> bin_prot is here: http://ocaml.janestreet.com/?q=node/13
<joelr> i wish there was a description
<thelema> browse the source code here: http://docs.camlcity.org/docs/godilib/3.10/bin_prot
ygrek has joined #ocaml
<joelr> thelema: thanks a lot!
Snark has quit [Quit: Ex-Chat]
<mfp> joelr: gtg in a bit, but some info about extprot (I wrote it) > extprot's raison d'être is allowing backward/forward-compatible protocol extensions
fraggle_ has quit [Ping timeout: 276 seconds]
<mfp> it is designed to allow a posteriori changes to the binary protocol without having to discard all the previous data
<mfp> which Marshal or bin_prot don't help with
smerz has joined #ocaml
<thelema> mfp: do you know enough about zeromq or piqi to compare?
<mfp> I don't know much about piqi; it was released after I'd written extprot, and didn't find any reason to switch to it
<mfp> not sure it supports algebraic types
<mfp> as for zeromq, well, it doesn't care about the messages it transports, does it?
<mfp> (so it's completely orthogonal to the serialization format)
<joelr> mfp: thanks
<mfp> the main reason not to use extprot is that there are only OCaml and Python (not written by me) de/encoders
<mfp> "generic" (w/o static type guarantees) decoders are easy to write though; I wrote one for Ruby in ~100 LoC or so IIRC
<hcarty> joelr: If you are using OCaml 3.12, you could pass modules around as a half-way point between objects and records
<joelr> hcarty: first-class modules?
<hcarty> joelr: Wrap each record type in a module with accessor functions
<hcarty> joelr: Yes
<hcarty> You could then unwrap the module and call the accessor functions on the common fields. Any differing fields wouldn't matter at that point.
<mrvn> woul that get inlined or use hidden closures?
<mrvn> +d
<mfp> joelr: last thing before I go, universal decoder in Ruby @ https://github.com/mfp/extprot/blob/master/ruby/lib/extprot.rb
<hcarty> mrvn: I'm not sure. kaustuv did some first class module tests around 3.12.0's release, and I think they do carry some overhead in a case like this.
* mfp goes
<joelr> mfp: thanks
<mrvn> if I had to implement this I would create a record of all the functions of the module and pass that around.
<hcarty> mrvn: From what I remember reading, I think that's roughly equivalent to what first class modules do internally
<mrvn> The difference to objects is then that objects use a hash to lookup methods while first class modules can use a fixed offset.
fraggle_ has joined #ocaml
<mrvn> can you coerce first class modules?
<orbitz> What are the language reasons for the compiler know if value v is a record type M.t that v.r is obvioulsy v.M.r?
<orbitz> what problem does it introduce to assume that?
<mrvn> orbitz: The compiler doesn't know.
<thelema> orbitz: it works the other way around - v.M.r implies that v is of type M.t
<hcarty> mrvn: I'm not sure if it counts as coercion, but I think you apply more restrictive but still matching signatures
<mrvn> and usualy you don't know that v is a M.t before you infer that from v.M.r
<mrvn> hcarty: so with include and coercion you have inheritance like objects.
<orbitz> ah ok
<hcarty> mrvn: ex. let module M = (val m : M_sig) in ...
<orbitz> fair enough
<hcarty> mrvn: I believe so. There was a mailing list post along these lines recently
<mrvn> orbitz: Worse if you have sub records: v.M.r.M.Sub.x
<orbitz> mrvn: it quickly becomes painul
<mrvn> v.M.r already gives the full type so the M.Sub. is a bit useless
<orbitz> althouhg, if i know v is M.t shouldn't that tell me the rest since that record sohudl have ac omplete type deifiniton?
<orbitz> mrvn: you stole the words form my mouht :)
ymasory has joined #ocaml
<mrvn> I guess v.M.r.x would make it a bit random where you need the full path and where not.
<mrvn> Think of it this way: v is a pointer, M.r and M.Sub.x are offsets and you are accessing *(v + M.r + M.sub.x)
<mrvn> The compiler then checks that the '+' is using valid types for pointer and offsets.
fabjan has quit [Ping timeout: 264 seconds]
<mrvn> hcarty: It's too late to grock that now. Will have to look at that in the morning.
fabjan has joined #ocaml
<hcarty> Does Batteries have an infix form of Option.map? An option equivalent to ( |> )
yezariaely has joined #ocaml
<thelema> hcarty: not yet - you're welcome to create Option.Infix and put your proposed operator there
<hcarty> thelema: Ok. I'm trying to come up with a suitable operator name...
<thelema> Although it wouldn't be an Infix operator... Maybe Option.Op
<thelema> Op seems better than Infix
<hcarty> ( |? ) or ( |?> ) seem like the obvious choices. I've used ( |? ) as an infix form of Option.default.
<hcarty> thelema: Should the be done consistently through Batteries then?
<hcarty> I think there are a few Infix modules floating around
<thelema> hcarty: if // wasn't taken, I'd like to mirror perl
<thelema> I think just map and set
<hcarty> thelema: What is // currently?
<thelema> n/m, map, set, imap, hashtbl, pmap, multipmap
<thelema> hcarty: // is Enum.filter
yezariaely has left #ocaml []
mcclurmc_home has joined #ocaml
_andre has quit [Quit: leaving]
ygrek has quit [Ping timeout: 246 seconds]
philtor has quit [Ping timeout: 240 seconds]
ikaros has joined #ocaml
ulfdoz has quit [Ping timeout: 276 seconds]
DimitryKakadu has quit [Remote host closed the connection]
Cyanure has quit [Remote host closed the connection]
<joelr> gildor: ping
<joelr> how do you make ocamlbuild pay attention to (* pp camlp4o pa_labelscope.cmo pa_openin.cmo *) at the top of an ocaml file?
<joelr> i guess it's the same as asking how do i tell oasis to pass -pp to ocamlbuild
mcclurmc_home has quit [Ping timeout: 240 seconds]
Yoric has quit [Quit: Yoric]
MUILTFN has quit [Ping timeout: 248 seconds]
edwin has quit [Remote host closed the connection]
MUILTFN has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
adlsaks has joined #ocaml
MUILTFN has quit [Ping timeout: 264 seconds]
Associat0r has quit [Quit: Associat0r]
<gildor> joelr: hi
<joelr> gildor: hello
<gildor> joelr: are pa_labelscope.cmo and pa_openin.cmo findlib accessible ?
<joelr> i sent an email to the list, hoping that others will benefit from your reply
<joelr> yes, they are findlib-accessible
<joelr> ocamlfind-able :D
<gildor> what are the the name of the associated package ?
<joelr> piqi
<gildor> piqi.syntax ?
<gildor> where are they accessible on Internet (to see the META file)
<gildor> ?
<gildor> joelr: ^^^
<joelr> hmm
<joelr> sec
<joelr> gildor: archive(syntax,toploop) = "pa_labelscope.cmo pa_openin.cmo"
<joelr> archive(syntax,preprocessor) = "pa_labelscope.cmo pa_openin.cmo"
<joelr> is this what you are looking for?
<gildor> yes but name piqi.camlp4
<joelr> or is it this? name = "piqi.camlp4"
<joelr> requires = "camlp4"
<gildor> that what I was looking for
<joelr> yes
<alpounet> gildor, ocaml hasn't been selected for GSoC ? :/
<gildor> add "myfile.ml": syntax_camlp4o, pkg_piqi.camlp4 after # OASIS_STOP in _tags
<gildor> alpounet: nope, we are waiting for the official announce, but you are right
ftrvxmtrx has quit [Ping timeout: 248 seconds]
<gildor> joelr: if you already BuildDepends: piqi, that is all
<joelr> gildor: ah! thanks
<gildor> alpounet: I mean the official announce from Christophe and I about that
<alpounet> oh, ok
<joelr> gildor: would you mind replying to my caml-list post with the info you just gave me?
<alpounet> too bad
<alpounet> did they givea reason ?
<gildor> alpounet: we are not the only one to have been out of GSoC
<gildor> no reason so far
<alpounet> ok
<alpounet> that'd be interesting to know why it was rejected, in order to improve it (if possible) for the upcoming years
<joelr> gildor: i would much appreciate it!
<gildor> joelr: no pb, I will answer on the list
<joelr> thanks
smerz has quit [Quit: Ex-Chat]
adlsaks has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
joelr has quit [Quit: joelr]
<gildor> mfp: is this normal I get a stack overflow with Sqlexpr
<gildor> (just doing normal operation)
<gildor> humm, maybe you already told us something about that
<gildor> mfp: hummm, probably related to the lack of "COMMIT"
<gildor> thelema: ping
Amorphous has quit [Ping timeout: 276 seconds]
<gildor> thelema: when you have time, have a look http://oasis.ocamlcore.org/dev/admin/odb
ftrvxmtrx has quit [Quit: Leaving]
<thelema> gildor: pong
ftrvxmtrx has joined #ocaml
<thelema> gildor: I see.
Amorphous has joined #ocaml
<thelema> hcarty: you too
<gildor> thelema: you can set version to testing
<gildor> thelema: once testing is ok, you can promote it to stable
<gildor> thelema: you can also have a look at http://oasis.ocamlcore.org/dev/my_account
<gildor> thelema: the version changes are logged
<gildor> thelema: I can put them in a RSS feed, if needed
<gildor> thelema: I still need to rename pkg/info to findlib name and include tools
<thelema> using findlib name is important - your current dep solver needs this too
<gildor> thelema: not a big deal, just a matter of changing the field I print
<gildor> thelema: and getting the root node of findlib provides
<gildor> thelema: everything already present in package page in fact (Dependencies and Provides)
<thelema> "create package" doesn't work yet?
<gildor> thelema: you need to upload a package to create a package's version
<gildor> package = all version of a package
<gildor> all version of a tarball
<gildor> e.g. oasis/0.2.0
Yoric has joined #ocaml
<thelema> on the "my account" page, there's a link "create package", which doesn't work for me
<thelema> should it work?
<gildor> thelema: one day it will work
<gildor> thelema: but this is mainly to create package with uscan (i.e. probably not what you want)
<gildor> thelema: a package with no version won't appear in odb
philtor has joined #ocaml
<thelema> okay, say I want to send camomile to the server so people can install it as a dep when they install dependencies
<thelema> can I do this?
<gildor> for now, you can upload camomile, but there is not yet a way to create _oasis online
<gildor> working on it
<thelema> don't need a full oasis, of course.
<gildor> but since camomile, doesn't have dependencies, you can just upload it
<thelema> how to upload it?
<gildor> the default oasis will be a basic _oasis using Custom, with "./configure", "make", "make install"
<thelema> good.
<gildor> "Upload" link at the top
<thelema> ah, didn't think to look there.
<gildor> you'll have to describe build-dependencies and what the findlib package the package's version provides
<thelema> grr, the public download of camomile is a .bz2
<gildor> thelema: beware that you are on the dev server, I cannot guarantee that I'll be able to migrate dev data to the prod server
<gildor> thelema: oasis-db can handle .bz2 as well
<thelema> odb can't yet
<thelema> gildor: sure, I won't put *too* much work into this
<thelema> but I should test this and make things work, no?
dsheets has left #ocaml []
<thelema> Request Entity Too Large
<thelema> Error 413
<gildor> humm, upload limit is maybe low
<gildor> what is the size of the .bz2 ?
<thelema> can't upload 3.1MB camomile archive
<gildor> yes, quite big
<thelema> it's probably the biggest ocaml library because of all the character translation tables
<gildor> thelema: I have raised the limit to 4MB
<thelema> ok, re-uploading