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]
<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)
<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)
<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]