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
ftrvxmtrx has quit [Ping timeout: 240 seconds]
<kaustuv> In particular, ocaml-3.10.2/ocamlbuild/ocaml_specific.ml shows that the tag was called "dtypes" back then.
<thelema> that's fine - 3.10 won't choke on an unknown tag, it just will ignore the 'annot'
<kaustuv> I guess the question I have is why is armel stuck in 2009?
ftrvxmtrx has joined #ocaml
<mrvn> too much to do, not enough doing
boscop has quit [Ping timeout: 240 seconds]
cyanure has quit [Remote host closed the connection]
ftrvxmtrx has quit [Ping timeout: 240 seconds]
onigiri__ has joined #ocaml
onigiri__ has left #ocaml []
valross has joined #ocaml
walrus__ has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
arubin has joined #ocaml
valross has quit [Quit: Ex-Chat]
bzzbzz has quit [Read error: Connection reset by peer]
sepp2k has quit [Quit: Leaving.]
valross has joined #ocaml
valross has quit [Remote host closed the connection]
charlesno has joined #ocaml
elehack has joined #ocaml
ulfdoz_ has joined #ocaml
tony_ has quit [Ping timeout: 240 seconds]
ulfdoz has quit [Ping timeout: 276 seconds]
ulfdoz_ is now known as ulfdoz
charlesno has quit [Quit: Leaving]
lopex has quit []
<thelema> File "libs/estring/pa_estring.ml", line 399, characters 2-38:
<thelema> Unbound value AstFilters.register_topphrase_filter
<thelema> yes, 2009 is annoying.
arubin has quit [Quit: arubin]
Amorphous has quit [Ping timeout: 272 seconds]
khia0 has joined #ocaml
khia0 has left #ocaml []
Amorphous has joined #ocaml
elehack has quit [Quit: Farewell, programs.]
Rick__ is now known as Rickasaurus
bzzbzz has joined #ocaml
khia0 has joined #ocaml
khia0 has left #ocaml []
kmicinski has quit [Quit: leaving]
kaustuv has quit [Read error: Operation timed out]
eye-scuzzy has quit [Ping timeout: 245 seconds]
eye-scuzzy has joined #ocaml
joewilliams is now known as joewilliams_away
ulfdoz has quit [Read error: Operation timed out]
myu2 has quit [Remote host closed the connection]
ikaros has joined #ocaml
Yoric has joined #ocaml
munga has joined #ocaml
zzz_ has quit [Remote host closed the connection]
sepp2k has joined #ocaml
zzz_ has joined #ocaml
Yoric has quit [Quit: Yoric]
<f[x]> not armel per se, but that particular installation was specifically chosen debian stable (to have a diverse build environment, e.g. mldonkey should support ocaml >= 3.10)
myu2 has joined #ocaml
Rickasaurus has quit [Read error: Connection reset by peer]
myu2 has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
munga has quit [Quit: Ex-Chat]
munga has joined #ocaml
edwin has joined #ocaml
kaustuv has joined #ocaml
ttamttam has joined #ocaml
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
onigiri__ has joined #ocaml
onigiri__ has left #ocaml []
Yoric has joined #ocaml
_andre has joined #ocaml
myu2 has joined #ocaml
ftrvxmtrx has joined #ocaml
myu2 has quit [Ping timeout: 255 seconds]
myu2 has joined #ocaml
munga has quit [Quit: Ex-Chat]
munga has joined #ocaml
sepp2k has quit [Quit: Leaving.]
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
cyanure has joined #ocaml
tony_ has joined #ocaml
myu2 has quit [Remote host closed the connection]
ttamttam has quit [Ping timeout: 250 seconds]
eye-scuzzy has quit [Quit: leaving]
easy4 has joined #ocaml
munga has quit [Ping timeout: 240 seconds]
tony_ has quit [Ping timeout: 240 seconds]
lopex has joined #ocaml
spicey has joined #ocaml
myu2 has joined #ocaml
<spicey> If i have a type, e.g type foo = {mutable x:int} and let a = {x=5}, can I easily make a _copy_ of it, or do I need to write a function copying the fields manually (fun a -> { x = a.x; ... } or something like that)?
<mfp> spicey: if there's more than one field, you can use { a with xx = a.xx } in order to create a shallow copy
<mfp> if you don't want to write all the fields manually
myu2 has quit [Remote host closed the connection]
<spicey> great, thanks!
hto has quit [Read error: Connection reset by peer]
<f[x]> you can have a "generic" copy function for simple types as Marshal.to_string (Marshal.from_string x) :)
hto has joined #ocaml
<spicey> Good to know, though serializing and deserializing seems to be an overkill for a simple copy
<f[x]> yep, especially taking into account that some mutation in a copy is usually needed instead of exact copy
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
<iris1> Dear experts, I have a question. I have a problem with ocaml. I tried to read the manual but I have the sense that I am missing something so basic that even the manuals assume everyone knows it. I am trying to use cubic splines from the Gnu Scientific Library.
<iris1> I managed to install gsl itself, and also ocamlgsl. (I am using OS X Snow Leopard.)
<iris1> I was able to write a simple test script and it works. The script is http://pastebin.com/aN13CLGj, and when I do "ocamlbuild demo_interp.native", it creates a binary that runs (and outputs the correct result 2.44). So my installation must be okay in some sense.
<iris1> The problem starts when I try to make gsl available at the top level. I tried two different things, (1) create a .cmo and load it into a toplevel; (2) make a new toplevel with gsl baked in. I did not succeed with either.
<iris1> For the .cmo method, when "ocamlbuild demo_interp.cmo" succeeds, but when I #load it into a plain toplevel, it says "Error: Reference to undefined global `Gsl_error'". (My myocamlbuild.ml is http://pastebin.com/94gwa831, my _tags is http://pastebin.com/rYPchZQK)
<iris1> For the new top, I created an empty file xxx.mltop and ran "ocamlbuild xxx.top". This generated xxx.top, but when I start it and type "Gsl_error.init ();;", it says Error: Unbound value Gsl_error.init.
<iris1> I don't know if this is related to anything, but I also noticed that the ocamlgsl installation does not produce any .cmo files. Is this usual? The listing of my /usr/local/lib/ocaml/site-lib/gsl is at http://pastebin.com/XF99QbM0
<iris1> Does anyone have any suggestions for me? Thank you very much in advance!
<f[x]> toplevel needs cmi files
<f[x]> so set the search path accordingly
eye-scuzzy has joined #ocaml
<f[x]> or better use .ocamlinit script : smth like '#use "topfind";;\n #require "gsl";;'
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
<iris1> f[x]: Thank you!!! The topfind / gsl thing totally works for me.
<iris1> to make sure I understand your previous suggestion: what search path did you have in mind?
<f[x]> ocaml -I or #directory "...";;
<iris1> I see. Thank you very much for your help, once again!
ttamttam has joined #ocaml
<mfp> f[x]: unlike { x with ... }, Marshal would do a deep copy, though
<mfp> which might be just what you need if the record has got mutable fields, however
<f[x]> btw, mfp, http://paste.in.ua/1738/
<gildor> mfp: hi
<gildor> mfp: playing with ocaml-sqlexpr
<gildor> mfp: I have a couple of remarks
<gildor> mfp: talk about it here, before BTS submission
<gildor> mfp: it is mandatory to have a module called Sqlexpr ?
munga has joined #ocaml
jm has joined #ocaml
<gildor> mfp: another question, how can you handle schema upgrade ?
<gildor> (general question for DB, in fact, but I am trying to understand the sql_check/sqlinit statements)
avsm has joined #ocaml
sepp2k has joined #ocaml
Snark has joined #ocaml
<mfp> gildor: the generated code refers to a Sqlexpr module, so, yes, you have to define it (you can alias it to e.g. S and use that for convenience)
<mfp> as for schema upgrade
<mfp> what I usually do is define a migrations table, and have a list of migrations defined in the code
<mfp> then at launch time you apply the migrations missing in the table in sequence
<mfp> sql_check is just a convenient way to extract all the SQL statements and run a basic ("prepare doesn't fail") run-time test which will catch all syntax errors and most semantic ones (reference to missing tables, columns etc)
<mfp> f[x]: thanks, applied and pushed
<mfp> gildor: re. the schema/migration stuff > for PG'OCaml, I have a hackish system that generates OCaml code with the migrations from a description in such a way that they are are applied/undone/re-applied to a temp table at compile time (thus verifying that they are sound, at least as far as the SQL is concerned), and some more OCaml code that applies missing migrations at launch time.
<mfp> the "migration description" is actually a Ruby script which is just evaluated and looks like migration(:base_schema) do up do sql <<-EOF ... SQL here EOF end down do sql <<-EOF ... SQL that undoes the migration ... end end
<mfp> then we want camlp4 to see at compile time PGSQL(dbh) "execute" "... SQL code given in 'up' ..." followed by PGSQL(dbh) "execute" "... down ..." and then again PGSQL(dbh) "execute" "... up ..."
<mfp> for all the migrations in sequence: this way, they migrations themselves are checked statically
<mfp> finally, I use camlp4.macro to INCLUDE "migrations.ml" in all the files with PGSQL statements, so that they can be checked against the schema resulting from the migrations
<mfp> hope it's not too confusing
<gildor> mfp: everything is a little bit confusing, but I am not an expert at DB management
<gildor> mfp: let see if I can do something sound
<mfp> gildor: I'll try to write a simple example for the above
smerz has joined #ocaml
<gildor> mfp: BTW, maybe you can include the README directly into the ocamldoc
<mfp> will have to take a look at the ocamldoc manual, never done anything fancy with it
Yoric has quit [Quit: Yoric]
jm has quit [Quit: Konversation terminated!]
jm has joined #ocaml
boscop has joined #ocaml
alexyk has joined #ocaml
<gildor> mfp: you can have a look at ounit, I included a complete README into it
<gildor> (ocamlnet also does this)
<alexyk> are Enums in batteries more efficient than lists? I.e., if I need to filter a hash, is H.keys |> E.filter ... as efficient or better than H.filter, or H.enum ... L.of_enum |> L.filter? I think in terms of seqs and create a bunch of enums for intermediate piping, and see lots of memory used...
alexyk has quit [Quit: alexyk]
joewilliams_away is now known as joewilliams
munga has quit [Ping timeout: 240 seconds]
tony_ has joined #ocaml
* thelema waits for alexyk to return
ccasin has joined #ocaml
alexyk has joined #ocaml
<alexyk> so any ideas on enums performance?
<thelema> alexyk: enum is kinda like deforestation
<thelema> if you're doing a lot of mapping and filtering on lists, you can generate a lot of intermediate data structures
<alexyk> thelema: so enums saves that?
<thelema> with enums, elements are computed as needed, so usually when you convert out of the enum, or consume it the final time is all the computation triggered
<thelema> this gives good data locality, although not as good code locality
<alexyk> thelema: doesn't it lead to a bunch of lazy enums sitting in memory?
<thelema> no, enums are consumed as they get read.
<thelema> this means that they can't be read twice (unless you clone before reading)
<thelema> but it also means that it's really hard to leak memory with them
<alexyk> thelema: so here's what I do. I have a giant graph, and under each node, there hangs a hash table computed with enums. For each node, such hashes are recomputed. Only in the next cycles, the node data is actually used. WIll it leave a bunch of pending computations?
<thelema> until you read the enums, they'll keep closures for all the code needed to compute their elements
<alexyk> my node data is computed from other hashes, like H.map user val -> H.keys h |> E.map fun k -> k, f k |> E.filter ... Array.of_enum ...
<thelema> of course you can store |> List.of_enum instead, but I bet that'll be larger
<alexyk> I.e., from a hash, I create another hash with an array under each, which is created via enums
<alexyk> but those should be consumed
<alexyk> the arrays are not accessed until later; will they force enums to compute when the arrays themselves are comiputed?
<thelema> yes, when you do Array.of_enum, all the enums go away (well, there's an empty enum left, but it's trivial size)
<thelema> and it's free to be GC'ed based on your pipe
<alexyk> so you'd recommend using enum as intermediary freely?
<thelema> yes, Array.of_enum forces the enum
<alexyk> like Clojure seq, used for everything?
<alexyk> ok
<thelema> yes, I'd recommend using Enum as an intermediary, just be aware that you can't read from it twice, so convert it to something else if you need that
<alexyk> that's OK, I use them in a pipeline scenario with lists or arrays in the end
<alexyk> so when you do H.enum, how much overhead is it memory-wise? Is it a small iterator on top of the hash?
<thelema> https://github.com/ocaml-batteries-team/batteries-included/wiki/ListTypes <- start of explaining batteries' list types
<thelema> H.enum is just a small iterator. be aware that since hashtables are mutable, if you change the hashtable before you actually get the keys, you'll get the new list of keys
lopex has quit []
<alexyk> good :)
jm has quit [Ping timeout: 240 seconds]
ymasory has joined #ocaml
sepp2k has quit [Ping timeout: 260 seconds]
<kaustuv> I would prefer a version of batteries with LazyLists instead of Enums as transport. (Not suggesting it as a change for 2.0, obviously.)
sepp2k has joined #ocaml
<thelema> kaustuv: I think we can support both for all data structures
<kaustuv> thelema: I added a pull request about deleting temp files created during testing, in case you didn't get a notification from github
<thelema> kaustuv: committed yesterday, forgot to push
<thelema> kaustuv: if you get a sec, I'd apperciate if you could say more about lazy lists on the batteries wiki
<kaustuv> OK, but it will have to be at a future spacetime coordinate as I have a train to catch
kaustuv has quit [Quit: choo choo]
edwin has left #ocaml []
avsm has quit [Quit: Leaving.]
alexyk has quit [Quit: alexyk]
jm has joined #ocaml
lopex has joined #ocaml
<hcarty> thelema: Would Seq or LazyList be the proper analog to Enum if one were added in addition to Enum?
<thelema> hcarty: to be honest, I'm not so sure about the difference between Seq and Lazylist
<thelema> I'd probably favor LazyList as we have camlp4 to pattern match it
<thelema> something about Seq being not consumable
ftrvxmtrx has quit [Quit: Leaving]
ttamttam has quit [Remote host closed the connection]
ymasory has quit [Quit: Leaving]
yezariaely has joined #ocaml
ymasory has joined #ocaml
ymasory has quit [Read error: Connection reset by peer]
ymasory has joined #ocaml
yezariaely has left #ocaml []
kaustuv has joined #ocaml
tony_ has quit [Quit: Ex-Chat]
ftrvxmtrx has joined #ocaml
alexyk has joined #ocaml
jm has quit [Remote host closed the connection]
myu2 has joined #ocaml
<orbitz> mfp: you around?
<mfp> pong
<orbitz> ocamlmq ever have any bugs relate dto receipts not being delivered?
<mfp> hmm don't remember such a bug
<orbitz> ok
<mfp> what version are you using though?
<orbitz> An older version, one i forked from you
<mfp> oh then make sure you get the last commit
<orbitz> Ok
<orbitz> This big is really odd, I'm almost certain it's something on my side
<mfp> this one > https://github.com/mfp/ocamlmq/commit/d4d31d8c0c17697d67c986950efa01ed10613c6a the bug was introduced in the sqlite-based branch
<mfp> it effectively set the prefetch limit to 1, regardless of what the client specified
<orbitz> No I think that is working sufficeintly fo rme although I'll check
<orbitz> I forked pre-that
<mfp> no pb then
<orbitz> I think I forked in October
<orbitz> Is 'acking' /topic messages a nono?
ymasory has quit [Ping timeout: 246 seconds]
<mfp> topic messages are not persistent, so ACKing is meaningless
<mfp> with the semantics I implemented, that is
<orbitz> Yeah
<mfp> it'd be possible to have persistent topic messages, but then you'd need a mailbox per client, and you'd have to authenticate the subscription/client
<orbitz> Yeah that is no fun
<orbitz> I'ma ctually usign topic specifically to avoid persistence
<orbitz> perhaps my idiom is wrong, but what I do is i send a message to compoentn A thoruhg teh MQ and i say "i'll be listening on topic X for your answer"
<orbitz> so that way if i timeout before component A responds, its dead message won't be stored forever
<mfp> IIRC STOMP 1.1 introduced such a pattern
ymasory has joined #ocaml
<mfp> not there, must have seen that in some neighboring thread then
<orbitz> I do an unsubscribe iwht a receipt, it it appears like i'm not getting the receipt in all cases
<mfp> maybe an exception being raised before the server sends the receipt?
<orbitz> but i'm not 100% sure it's in ocamlmq, i'm still trackign down, th unforunate thign is i nee dto hit my code kidn of hard to see it so I have a lot of data to sift throuhg
munga has joined #ocaml
alexyk has quit [Quit: alexyk]
_andre has quit [Quit: leaving]
ulfdoz has joined #ocaml
arubin has joined #ocaml
munga has quit [Ping timeout: 260 seconds]
ymasory has quit [Ping timeout: 260 seconds]
tony_ has joined #ocaml
ymasory has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
ymasory has quit [Ping timeout: 250 seconds]
alexyk has joined #ocaml
cyanure has quit [Quit: Quitte]
tony_ has quit [Ping timeout: 240 seconds]
alexyk has quit [Quit: alexyk]
ymasory has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
easy4 has quit [Quit: easy4]
avsm has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Client Quit]
Snark has quit [Quit: Ex-Chat]
eaburns has joined #ocaml
<orbitz> what is teh ^^ operator?
<orbitz> concat for formats?
<mrvn> strings
<mrvn> # "Hello " ^ "World";;
<mrvn> - : string = "Hello World"
<mrvn> h, sorry. You actually ment ^^, that wasn
<mrvn> 't a typo. yes. formats: ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6
<orbitz> Right now I have
<orbitz> let show fmt = eprintf (fmt ^^ "\n%!")
<orbitz> but i want to modify fmt to have teh time infront, can i modify fmt?
alexyk has joined #ocaml
alexyk has quit [Quit: alexyk]
<mrvn> I don't think you can.
<mrvn> The format thing is somewhat of a hack in the compiler to have printf style format strings. Not verry flexible.
Yoric has joined #ocaml
<orbitz> i suppose i coudl sprintf it first
<orbitz> maybe
<orbitz> oh well, i found a way around it
<orbitz> i'm just sending the output throuhg an awk script i made to preend the ucrretn system time haha
<thelema> hah, that works.
<mrvn> you can prepend the time to fmt if that is all you want.
<thelema> let show fmt = eprintf "%.2f:" (Sys.time ()); eprintf (fmt ^^ "\n%!")
<mrvn> eprintf ("%.2f:" ^^ fmt ^^ "\n%!") (Sys.time ())?
<thelema> I dunno if that works, I know my version works.
<thelema> Has anyone tried ocamleditor? https://forge.ocamlcore.org/forum/forum.php?forum_id=771
<spicey> ocamleditor - what xml library does it need? build.ml complains about unbound module Xml
<thelema> xml-light
<thelema> you should read the README - compiling requires a copy of the ocaml source tree
<spicey> yep, built nicely
rks has left #ocaml []
<spicey> Hmm, don't see much point in it - though my ocaml bits are small enough so that vim and a simple makefile + ocamlmakefile make me very comfortable
<spicey> If there is an awesomeness in that editor, it is very well hidden
<eaburns> Hi. I am looking to write a parser for a lisp-ish language. I am looking into menhir and camlp4. Does anyone have any recommendations either way?
<thelema> eaburns: if it's really that lispish, you'll spend more time deciding between those two than you would writing the parser by hand
<eaburns> I was thinking of that, but I want good error messages and, in my experience, tracking token locations in a hand-written parser is a huge pain
<thelema> error locations are a function of your lexer
<thelema> s/error/token/
<eaburns> I guess that the issue is that I never use a real lexer when I usually slop out a hand written parser
<eaburns> is it easy to use ocamllex with a recursive descent parser?
* eaburns reads
<eaburns> thanks
mnabil has joined #ocaml
<eaburns> it doesn't seem to go into detail about the ocamllex and the recursive descent parser
<eaburns> but he does claim that the stream based parsing should only be used for the simplest of things
<thelema> lisp-like languages are simpler than even the calculator example shown.
<eaburns> agreed, but I am hoping to parse more than "lists" and "atoms"
<eaburns> the only real lisp-ish thing here is that everything is wrapped up in parens, other than that each list has some special meaning
<orbitz> mfp: HAH! I found another symptom. On one of the clients my messages don't appear to be begin acked
tony_ has joined #ocaml
* eaburns has to take off
<eaburns> thelema: thanks for giving me something to think about
<thelema> eaburns: no problem
<orbitz> mfp: am I wrong in thinking ack: auto isn't supported?
<mfp> orbitz: indeed, it always works like ack: client
<mfp> ack: auto should be trivial to implement though
elehack has joined #ocaml
ccasin has quit [Quit: Leaving]
seafood has joined #ocaml
<mfp> orbitz: if you have a pressing need, all you have to do is to add a auto_ack field to the subscription record (initialized in cmd_subscribed), and then in send_to_recipient, where you have match msg.msg_ack_timeout with ... (around L212 in my code), prepend a branch like _ when subs.auto_ack -> return ()
seafood has quit [Read error: Connection reset by peer]
<mfp> would commit but it's late :-/
* mfp gtg
seafood has joined #ocaml
munga has joined #ocaml
spicey has quit [Ping timeout: 260 seconds]
ulfdoz has quit [Ping timeout: 276 seconds]
seafood has quit [Quit: seafood]
ymasory has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
munga has quit [Ping timeout: 240 seconds]
agarwal1975 has joined #ocaml
<orbitz> mfp: thanks no, i can use ack: client no problem I just wanted to confirm what I was seeing. Thanks for the info
Yoric has quit [Quit: Yoric]
elehack has quit [Quit: Headed out, possibly to home]
ikaros has quit [Quit: Leave the magic to Houdini]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
<orbitz> mfp: found bug, it was me being a dangus
<kaustuv> http://en.wiktionary.org/wiki/dangus -- you are a "sky" or a "heaven"?
alexyk has joined #ocaml
<orbitz> kaustuv: Neither, more like dong
arubin has quit []
<kaustuv> You are a unit of the currency of Vietnam?
<orbitz> kaustuv: depends on which part of vietnam
alexyk has quit [Quit: alexyk]
smerz has quit [Quit: Ex-Chat]