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
BiDOrD has quit [Quit: No Ping reply in 180 seconds.]
Ontologiae has quit [Ping timeout: 246 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
boscop has quit [Ping timeout: 246 seconds]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ulfdoz_ is now known as ulfdoz
philtor has quit [Ping timeout: 255 seconds]
BiDOrD has joined #ocaml
tauntaun has quit [Quit: Ex-Chat]
enthymeme has joined #ocaml
avsm has quit [Quit: Leaving.]
surikator has joined #ocaml
Associat0r has quit [Quit: Associat0r]
ymasory has joined #ocaml
surikator has quit [Quit: Scientific discovery is just maximal compression of random strings. Nothing more, nothing less.]
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
vivanov has quit [Ping timeout: 260 seconds]
vivanov has joined #ocaml
dnolen has quit [Quit: dnolen]
Cyanure has joined #ocaml
lopex has quit []
Tianon has quit [Ping timeout: 264 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
sepp2k has joined #ocaml
vivanov has quit [Ping timeout: 250 seconds]
<lewis1711> I'm reading the section on pattern matching in "developing applications in ocaml". Each function they use as an example takes one argument (whether it be a single value, tuple, list or whatever). can it work for two?
<lewis1711> ah the manual has some examples
philtor has joined #ocaml
vivanov has joined #ocaml
pension has joined #ocaml
lewis1711 has left #ocaml []
philtor has quit [Ping timeout: 264 seconds]
Ontologiae has joined #ocaml
Ontologiae has quit [Ping timeout: 250 seconds]
lewis1711 has joined #ocaml
Cyanure has quit [Ping timeout: 248 seconds]
ygrek has joined #ocaml
eye-scuzzy has quit [Read error: Operation timed out]
eye-scuzzy has joined #ocaml
mcclurmc_ has joined #ocaml
ikaros has joined #ocaml
Yoric has joined #ocaml
edwin has joined #ocaml
Oejet1 has joined #ocaml
boscop has joined #ocaml
mcclurmc_ has quit [Ping timeout: 255 seconds]
sepp2k has quit [Ping timeout: 252 seconds]
sepp2k has joined #ocaml
Oejet1 has quit [Ping timeout: 276 seconds]
<rproust> can someone help me on http://pastebin.pulsealliance.com/?show=8277
<rproust> I have a typing error on objects
Snark has joined #ocaml
<rproust> It works if I unfold the "inherit" statement in "weird_elem", but it forces code duplication (and my use case has more code than just the three methods of this example)
<rproust> ok, I reduced my problem even further: http://pastebin.pulsealliance.com/?show=8278
<rproust> I don't get the reason for this type restriction, I think I'll end up duplicating code or something
ankit9 has quit [Read error: Connection reset by peer]
edwin has quit [Remote host closed the connection]
Oejet has joined #ocaml
edwin has joined #ocaml
Oejet has quit [Ping timeout: 276 seconds]
ankit9 has joined #ocaml
lewis1711 has quit [Quit: Leaving.]
DimitryKakadu has joined #ocaml
edwin has quit [Remote host closed the connection]
edwin has joined #ocaml
tauntaun has joined #ocaml
mcclurmc_ has joined #ocaml
ygrek has quit [Remote host closed the connection]
dnolen has joined #ocaml
<DimitryKakadu> hallo. Which ideas can you recommend to implement language translation html to wiki?
<DimitryKakadu> maybe ocamlyacc is not the best way...
<adrien> html to wiki? in this direction? ocamlnet might have something
<DimitryKakadu> adrien: grep says that ocamlnet have not
<DimitryKakadu> More general question: have to implement wysiwyg editor for wiki (using js_of_ocaml)?
<adrien> DimitryKakadu: "nethtml"
<adrien> in netstring
ygrek has joined #ocaml
mcclurmc_ has quit [Ping timeout: 255 seconds]
<flux> rproust, you don't seem to be using recursive types. so replace the 'and' with 'class type' ?
Cyanure has joined #ocaml
<rproust> flux: in my use case, I need it to be recursive
<flux> rproust, can you have a minimal test case on how you would use recursion?
<rproust> DimitryKakadu: Dario has done something of the sort
BiDOrD_ has joined #ocaml
<flux> rproust, well, I just added method container : container into c and try to work with that :)
BiDOrD has quit [Ping timeout: 246 seconds]
<flux> but I'm not having much luck with that :)
<rproust> I tried several variations and couldn't bring it to work. Ths thing is, I don't even get the reason for this limitation
<flux> rproust, you should try mailing the caml-list
<rproust> flux: will do
ftrvxmtrx has quit [Quit: Leaving]
<DimitryKakadu> rproust: Dario is a user in this chat?
ftrvxmtrx has joined #ocaml
<DimitryKakadu> rproust: Is Dario a user in this channel?
<rproust> DimitryKakadu: Dario is an ocsigen/eliom user
<rproust> Dario Teixeira
pierre_m has joined #ocaml
<pierre_m> hi all
<DimitryKakadu> rproust: thanks
edwin has quit [Remote host closed the connection]
<rproust> DimitryKakadu: you should get the lambdoc svn repo and look at trunk/lambdoc/*-manual/index.html
edwin has joined #ocaml
<rproust> DimitryKakadu: svn checkout svn://svn.forge.ocamlcore.org/svn/lambdoc/trunk
<pierre_m> I have some strange issue with ocaml-sqlite3
<pierre_m> printing out inserts statements in a file and then doing `sqlite3 database < the file` is way faster than doing basically the same thing from ocaml
<pierre_m> (using a transaction seems to have no effect)
<pierre_m> anyone have a clue ?
sepp2k has quit [Quit: Leaving.]
BiDOrD_ has quit [Ping timeout: 250 seconds]
<mfp> pierre_m: could you codepaste some code?
<pierre_m> sure
<pierre_m> mfp: here it is : http://ocaml.nopaste.dk/p3013
<pierre_m> (with htb containing my gigs of data)
<pierre_m> and sqlcheck is just a function that match the Sqlite3.Rc.t with OK,DONE or raise an error
<mfp> pierre_m: puzzling indeed, I can't see any reason for that to happen :-/
<pierre_m> :/
<flux> pierre_m, you should try strace to see if it does something stupid system-call-wise
<mfp> how much slower is ocaml-sqlite3 than sqlite3?
<pierre_m> I don't have any precise figure
<mfp> i.e. is it doing an fsync per insert, or are you observing some (strange) overhead?
DimitryKakadu has quit [Ping timeout: 246 seconds]
kakadu has joined #ocaml
<pierre_m> but the difference is _huge_
<mfp> pierre_m: what about preparing the statement after BEGIN TRANSACTION?
<pierre_m> I havn't tried that
Fullma has quit [Quit: Fullma]
<pierre_m> oh
lopex has joined #ocaml
<pierre_m> when I do it in a ":memory:" database, the difference is not that huge (vs print Inserts into /dev/null )
<mfp> pierre_m: inserting with ocaml-sqlite3 is 3X faster than sqlite3 foo.db < bar.sql for me (using a transaction in both cases)
<pierre_m> but as soon as I try to actually write something into the db or into a file
<pierre_m> I have 100x speed difference on a small dataset
<pierre_m> oops
<pierre_m> 10x
<pierre_m> maybe something is wrong in the way I had sqlite3 compiled ?
<mfp> do you observe the same speed diff with the code I pasted? (commenting out the Printf.printf and the sqlcheck calls alternatively)
<mfp> here I get 0.29 vs 1.124s to insert 100000 rows
<pierre_m> printf : 0.27009, sql : 31.98829
<pierre_m> :(
BiDOrD has joined #ocaml
<mfp> looks like it's fsync()'ing, strace should tell
<mfp> maybe some weird PRAGMA value?
<mrvn> fsync() speed widely varries depending on your fs.
<mfp> mrvn: but it should only be doing ~ a couple per transaction
<mrvn> I would think one
<pierre_m> that was on my ubuntu box, debian on a eee pc gives 0.85 and 5.98
<pierre_m> I've never used strace
<pierre_m> -c ?
<mfp> mrvn: in WAL mode, 2 fsyncs per checkpoint (before and once completed), otherwise probably more depending on the PRAGMA synchronous value
edwin has quit [Ping timeout: 252 seconds]
edwin1 has joined #ocaml
<gildor> mfp: ping ?
<mfp> pierre_m: you can just grep for the fsync calls for the OCaml program and sqlite3, and see if there are many more in the former
<mfp> gildor: pong
<gildor> mfp: I have a strange issue with sqlexpr and select_one
<gildor> mfp: don't leave, I am trying to reproduce it
edwin has joined #ocaml
mcclurmc_ has joined #ocaml
<mfp> is it with Sqlexpr_sqlite_lwt?
<gildor> yes
<mfp> could be a bug in the thread pool, not specific to select_one
<mfp> but I'd prefer it to be in select_one, as it should be much easier to reproduce and fix :)
<gildor> well with sqlexpr 0.2.3
<gildor> I know that this is not the latest version
<pierre_m> fdatasync() ?
edwin1 has quit [Ping timeout: 250 seconds]
BiDOrD_ has joined #ocaml
<mfp> gildor: ok, can't be a tricky issue with the thread pool then
* gildor extracting the code from oasis-db
<mfp> pierre_m: that should be it
<mfp> either fsync or fdatasync
BiDOrD has quit [Ping timeout: 250 seconds]
<pierre_m> ok
edwin has quit [Ping timeout: 250 seconds]
joewilliams_away is now known as joewilliams
<mfp> 0ba73d13e2fe Sqlexpr_sqlite: fix type of select_one, wrap conversion exns in monad.
<mfp> can you upgrade to a more recent version? 0.3.0 should have the fix
Fullma has joined #ocaml
<gildor> does 0.3 need lwt 2.2 ?
BiDOrD_ has quit [Read error: Operation timed out]
<mfp> hmm according to gitk, no raise_lwt was added between 0.2.3 and 0.3.0
<mfp> so 0.3 should not require Lwt 2.2
edwin has joined #ocaml
BiDOrD has joined #ocaml
<gildor> mfp: BTW, there is no 0.4.0 tag in github
<pierre_m> mfp : fdatasync x4 and no fsync, but it doesn't take too much time
<gildor> and no 0.3.0 tar.gz in the OCaml forge
<mfp> gildor: yes, I can't find the 0.3.0 tarball either :-|
<pierre_m> the difference seems to come from _llseek
<pierre_m> I don't know what it is
<mfp> gildor: IIRC I released 0.4.0 shortly after 0.3.0, and decided uploading the 0.3.0 tarball was not worth it
<pierre_m> but in the sqlite version it take 40% of the time, 1532 calls with 3 errors
edwin has quit [Remote host closed the connection]
<mfp> gildor: I'll grep for raise_lwt in the 0.4.0 tarball to make sure
<gildor> mfp: maybe I will just patch 0.4.0 to remove raise_lwt
<pierre_m> while the print version spend its life in write()
<pierre_m> 11 call to _llseek with 2 errors
<mfp> gildor: no luck, 0.4.0 was released after I added raise_lwt
<mfp> gildor: just doing s/raise_lwt/Lwt.fail/g should do
<gildor> mfp: EADSLBUSY, I must wait a little bit
<mfp> hmmm this reminds me I should release 0.4.1, there was an important bug in transaction()
edwin has joined #ocaml
<mfp> pierre_m: what are you comparing? should be sqlite3 foo.db < foo.sql vs. ocaml program w/o the printfs (just making sure)
<pierre_m> two ocaml programs
<pierre_m> let me try sqlite3
<mfp> gildor: released 0.4.1; should work with Lwt pre-2.2 if you replace the 4 occurrences of raise_lwt with Lwt.fail
<mfp> there's a minor change in the functor interface -> you can instantiate with Sqlexpr_sqlite.Make(Sqlexpr_concurrency.Lwt)
BiDOrD has quit [Read error: Operation timed out]
BiDOrD has joined #ocaml
<gildor> mfp: Unbound value Lwt.new_key
<mfp> ugh didn't remember that was 2.2 only :-|
<gildor> mfp: nevermind, if the pastebin example works with 0.4.1, the bug is solved, that is fine with me
<gildor> mfp: for now, I have a workaround for this bug (and a TODO to remind me to upgrade)
<pierre_m> with sqlite3 foo.db < foo.sql, the number of _llseek calls is similar but it seems way faster (5% of the time, and it return in a couple of seconds)
<gildor> mfp: and the ocaml 3.12 in debian is about to begin, so I will soon be able to upgrade lwt and sqlexpr
<pierre_m> (and no error on _llseek)
<pierre_m> (same number of timely unsignificant fdatasync)
joewilliams is now known as joewilliams_away
avsm has joined #ocaml
joewilliams_away is now known as joewilliams
Fullma has quit [Remote host closed the connection]
Cyanure has quit [Ping timeout: 240 seconds]
Cyanure has joined #ocaml
ymasory has quit [Ping timeout: 255 seconds]
Fullma has joined #ocaml
<orbitz> writing Ocaml gets much easier when you don't write it like Python
<pierre_m> XD
<pierre_m> on the other hand, all the "let" I write in my python code throw some errors
ymasory has joined #ocaml
<orbitz> hah
ymasory has quit [Ping timeout: 255 seconds]
<adrien> I also try to write "let" in C code ='(
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
<mrvn> I always mix = and == when I switch between C and ocaml.
<mrvn> adrien: #define let #define in :)
<adrien> mrvn: heheh =)
<mrvn> #define in ; even
<pierre_m> hehe ==)
<adrien> I tend to use "let a = 3" instead of "int a = 3" ='(
<adrien> worse I did was 2 years ago: I used <- for a C array
<adrien> I hadn't done C in a long time (and I hadn't done much back then) and I spent almost two hours trying to understand why it failed and gcc told me "this comparison has no effect"
<mrvn> int x[10]; x.(0) = 1;
<adrien> "a[0] <- 3" is: "is a[0] smaller than -3" ='(
<mrvn> adrien: lol
<mrvn> does it say "comparison"? I though the error was "statement with no effect"
<adrien> right, it was "statement"
<adrien> good point is that I saw a friend have that same warning two days ago and I knew it had to be taken seriously ;-)
<pierre_m> hehe
<mrvn> try finding the error if you write if (a = 3) { ... }
<mrvn> The acompaning warning has to be taken serious too
<adrien> I think gcc spots it now, but I tend to write '3 = a' (which I do in ocaml code too actually)
<mrvn> it has been spotting it for ages. You have to write if ((a = 3)) to shut it up
<adrien> but with gcc warning you, if your code is mostly warning-less, there's no real advantage to "3=a"
<mrvn> adrien: more often you have if (mem = malloc(123)) or so.
<mrvn> for real cases
<adrien> I don't really like making workin inside condition clauses but it's something that is definitely done widely
<mrvn> I don't like "if (mem)" either. Implicit conversion to bool hurts my sense of type inference.
<adrien> I tend to used explicit casts much more in C now
<mrvn> That's like using Obj.magic
<adrien> maybe a bit, yeah ;-)
<mrvn> Does 3.12 now allow creating an ('a :> #base) list value of non objects?
<adrien> and, completely unrelated: if someone wants a nice FPS-style game engine to bind, Xonotix (formerly nexuiz) is pretty advanced and open-source unlike Unreal, Unity and some others
<adrien> (this was mentionned a few weeks ago iirc)
<adrien> no idea
<mrvn> e.g. type 'a base = { print : 'a -> unit; data : 'a; } let ibase = { print = print_int; data = 1; } let sbase = { print = print_string; data = "hello"; } let l = [ ibase; sbase ] let () = List.iter (fun x -> x.print x.data) l
<adrien> 3.12.0: "Error: This expression has type string base but an expression was expected of type int base"
<mrvn> One cas savely do: type 'a base = { print : 'a -> unit; data : 'a; } let ibase = { print = print_int; data = 1; } let sbase = { print = print_string; data = "hello"; } let l : unit base list = [ Obj.magic ibase; Obj.magic sbase ] let () = List.iter (fun x -> x.print x.data) l
<mrvn> adrien: I expect you need some more syntactic suggar to create the list
<mrvn> or the base type
<mrvn> The type of l should be something like 'a. 'a list
<adrien> probably, I simply copy-pasted your code and only read it after having the error ;-)
<mrvn> does "type t = 'a. 'a list" work?
<adrien> syntax error on the '.'
* pierre_m is about to leave
<pierre_m> mfp: thanks for the help
<pierre_m> I think I'll just install ocaml with godi on my ubuntu
<pierre_m> and for the present code I can go without sqlite anyway
<adrien> godi is really nice, it only needs to use ocamlopt-compiled binaries for the tools instead of ocamlc-compiled ones
pierre_m has left #ocaml []
tauntaun has quit [Quit: Ex-Chat]
Associat0r has joined #ocaml
alexyk has joined #ocaml
philtor has joined #ocaml
avsm has quit [Quit: Leaving.]
EM03 has quit [Read error: Connection reset by peer]
joewilliams is now known as joewilliams_away
<rproust> anyone know what "Error: This fixed type has no row variable
<rproust> means?
Fullma has quit [Ping timeout: 255 seconds]
alexyk has quit [Quit: alexyk]
vivanov has quit [Ping timeout: 246 seconds]
Oejet has joined #ocaml
Snark has quit [Ping timeout: 248 seconds]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
<adrien> I need a semaphore implementation: ocamlnet has one but I don't want to have to pull all ocamlnet only to get bindings to posix' semaphores
<flux> well, why not?
<flux> I guess you could look at its license and consider if you can just copy part of into your project - or else, reimplement the C binding again :)
<adrien> lablgtk-react needs a semaphore implementation (or mutexes that are unblocked in the same order they were blocked) and I'd prefer to have it tonight :P
<adrien> otoh, when you're already using lablgtk, ocamlnet won't seem that big :P
<flux> use ocamlnet now. if the dependency turns out to be a problem, you can always fix it later.
<adrien> yeah, that was the idea but someone is actually currently trying to use lablgtk-react, would have been nicer not to have to tell him he has to use ocamlnet ;-)
<adrien> but I guess that can be sorted in a few days if that's an issue (well, depending on other work...)
<flux> I guess they are special circumstances anyway, as typically having ocamlnet as a depedency would not be a problem..
thieusoai has quit [Read error: Connection reset by peer]
alexyk has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 246 seconds]
kakadu has quit [Remote host closed the connection]
avsm has joined #ocaml
edwin has quit [Remote host closed the connection]
alexyk has joined #ocaml
tauntaun has joined #ocaml
alexyk has quit [Quit: alexyk]
alexyk has joined #ocaml
Oejet has quit [Ping timeout: 276 seconds]
Amorphous has quit [Read error: Operation timed out]
Amorphous has joined #ocaml