flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.01.0 http://bit.ly/1851A3R | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
ollehar has joined #ocaml
boogie has quit [Remote host closed the connection]
cesar_ has joined #ocaml
cesar_ is now known as Guest617
wolfnn has quit [Ping timeout: 252 seconds]
Neros has quit [Ping timeout: 272 seconds]
jbrown has quit [Ping timeout: 252 seconds]
Guest617 has quit [Remote host closed the connection]
jbrown has joined #ocaml
ollehar has quit [Read error: Operation timed out]
dsheets_ has quit [Ping timeout: 245 seconds]
|jbrown| has joined #ocaml
jbrown has quit [Read error: Connection reset by peer]
Drup has quit [Quit: Leaving.]
cesar_ has joined #ocaml
cesar_ is now known as Guest66205
talzeus has joined #ocaml
boogie has joined #ocaml
brainacid has joined #ocaml
<brainacid> hi room
q66 has quit [Quit: Leaving]
boogie has quit [Remote host closed the connection]
Guest66205 has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
ollehar has joined #ocaml
peterbb has quit [Ping timeout: 272 seconds]
brainacid has quit [Quit: Leaving]
f[x] has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
|jbrown| has joined #ocaml
ollehar has quit [Ping timeout: 245 seconds]
talzeus has quit [Remote host closed the connection]
talzeus has joined #ocaml
talzeus has quit [Ping timeout: 245 seconds]
f[x] has quit [Ping timeout: 245 seconds]
jle` has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest29173
erlnoob has joined #ocaml
f[x] has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
boogie has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
boogie has quit [Remote host closed the connection]
|jbrown| has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
|jbrown| has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
jbrown has joined #ocaml
jbrown has quit [Read error: Connection reset by peer]
jbrown has joined #ocaml
weie has joined #ocaml
xaimus has quit [Quit: leaving]
ggole has joined #ocaml
xaimus has joined #ocaml
f[x] has quit [Remote host closed the connection]
f[x] has joined #ocaml
wagle has quit [Ping timeout: 248 seconds]
jbrown has quit [Read error: Connection reset by peer]
|jbrown| has joined #ocaml
Yoric has joined #ocaml
gour has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
Guest29173 has quit [Remote host closed the connection]
|jbrown| has quit [Read error: Connection reset by peer]
|jbrown| has joined #ocaml
wwilly has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
|jbrown| has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
|jbrown| has joined #ocaml
Shaladdle_ has joined #ocaml
Shaladdle_ has left #ocaml []
Yoric has joined #ocaml
Snark has joined #ocaml
gour has quit [Quit: WeeChat 0.4.1]
gour has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
wolfnn has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
|jbrown| has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
Arsenik has joined #ocaml
Arsenik has quit [Read error: Connection reset by peer]
Arsenik has joined #ocaml
ulfdoz has joined #ocaml
Simn has joined #ocaml
Kakadu has joined #ocaml
PM has quit [Ping timeout: 246 seconds]
Yoric has joined #ocaml
jbrown__ has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
PM has joined #ocaml
<whitequark> pippijn: hi
arquebus has joined #ocaml
Anarchos has joined #ocaml
f[x] has quit [Ping timeout: 252 seconds]
erlnoob has left #ocaml []
arquebus has quit [Quit: Konversation terminated!]
zpe has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
zpe has quit [Ping timeout: 246 seconds]
Kakadu has quit [Ping timeout: 272 seconds]
wxcafe has joined #ocaml
<wxcafe> hey
<wxcafe> i'm having trouble with a function i'm trying to write (for a game of life thing)
<wxcafe> the function is like so : http://pastie.org/8398682
<wxcafe> and the interpreter tells me that h is of type int list list at line 10
<wxcafe> that's what i don't get
mfp has joined #ocaml
<adrien> wxcafe: first, a couple remarks about style: I'd probably define "treat_list" outside of "aux" and your lines 9 and 10 are quite condensed so that makes them difficult to read
<adrien> which type were you expecting for 'h'?
<wxcafe> int list
<adrien> and we can't evaluate your code because some of the functions you use aren't in the paste
<wxcafe> adrien: i'll work on that, it's my first work in ocaml
<wxcafe> oh, right, sorry
dsheets_ has joined #ocaml
<wxcafe> here you go : http://pastie.org/8398689
ulfdoz has quit [Ping timeout: 252 seconds]
<wxcafe> (yes, it's an assignment, or i wouldn't have done the "is_alive" function, and yes i know it's useless, i'm just required to do it...)
<adrien> "rules" is indented in a really weird way; I'd put what's after the "->" on a new line and then: if ... then\n...\nelse\n...
<adrien> and as many people do, you're using too many parens; they're only useful when there can be ambiguity
weie has quit [Quit: Leaving...]
<wxcafe> alright, i'll clean the code
<wxcafe> but i really don't understand why "h" is interpreted as an int list list..
dsheets_ has quit [Ping timeout: 245 seconds]
<adrien> getting there :P
<wxcafe> sorry :)
q66 has joined #ocaml
shinnya has joined #ocaml
<adrien> wxcafe: try to move the "treat_list" function out of the "aux" one; I believe that it will make you find your issue
<adrien> (because you'll have to pass more variables as parameters to "treat_list" instead of grabbing them from the environment)
<adrien> wxcafe: also, we tend to use this indentation:
<adrien> let f = function
<adrien> | [] -> ...
<adrien> (not indenting the clauses makes them difficult to see)
<wxcafe> right, sorry
<wxcafe> alright, i'm doing this now, and i'll come back to you
<wxcafe> thanks for your input :)
<adrien> np :)
<wxcafe> hey, looks like it works now
<wxcafe> the thing is, i don't know what was wrong :/
ollehar has joined #ocaml
<wxcafe> oh, oh, oh, i get it!
<wxcafe> alright, i get it :)
<wxcafe> thanks for the help!
wxcafe has left #ocaml []
Anarchos has quit [Quit: Vision[0.9.7-H-280704]: i've been blurred!]
Yoric has joined #ocaml
lamawithonel_ has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
<whitequark> what actually is in the cmx files? machine code? I don't get it
<whitequark> oh, ocamlobjinfo clears this.
<whitequark> also, do I understand it correctly that ocamlfind disregards whichever linking capabilities ocamlopt has and does it all by itself?
<whitequark> trying to link stuff with ocamlfind ocamlopt -verbose seems to imply that, as it calls gcc for linking
<whitequark> also, the set of options is totally different from ocamlopt's.
ulfdoz has joined #ocaml
ollehar has quit [Ping timeout: 245 seconds]
wolfnn has quit [Ping timeout: 240 seconds]
shinnya has quit [Ping timeout: 272 seconds]
wolfnn has joined #ocaml
Drup has joined #ocaml
wwilly has quit [Remote host closed the connection]
darkf has quit [Quit: Leaving]
Yoric has quit [Ping timeout: 252 seconds]
peterbb has joined #ocaml
dsheets_ has joined #ocaml
zxqdms has quit [Quit: leaving]
talzeus has joined #ocaml
Yoric has joined #ocaml
ollehar has joined #ocaml
tani has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
Yoric has quit [Ping timeout: 260 seconds]
ollehar has joined #ocaml
ollehar has quit [Ping timeout: 272 seconds]
shinnya has joined #ocaml
ollehar has joined #ocaml
Nahra has quit [Quit: leaving]
Nahra has joined #ocaml
Arsenik has quit [Remote host closed the connection]
ta`e has joined #ocaml
f[x] has joined #ocaml
bnegreve has joined #ocaml
yezariaely1 has joined #ocaml
tani has quit [Ping timeout: 272 seconds]
yezariaely is now known as Guest76588
yezariaely1 is now known as yezariaely
ollehar has quit [Ping timeout: 265 seconds]
ulfdoz has quit [Ping timeout: 252 seconds]
ygrek_ has joined #ocaml
|jbrown| has joined #ocaml
jbrown__ has quit [Read error: Connection reset by peer]
f[x] has quit [Ping timeout: 246 seconds]
ulfdoz has joined #ocaml
wxcafe has joined #ocaml
<wxcafe> hey, it's me again
<wxcafe> i'm having trouble again!
<wxcafe> but this time, it's a different type of problem
<wxcafe> it's a recursion problem, actually
<wxcafe> it's the same program as before, and here's my code :
<wxcafe> so all the functions work except for next_generation
<wxcafe> and it's throwing a "Invalid_argument "List.nth"" error at me
<wxcafe> after the first treat_list has finished
<adrien> your "nth" functions kills babies ='(
<adrien> but I guess you don't know yet how to handle exceptions
<wxcafe> what's wrong with it?
<adrien> it hides errors
<wxcafe> you mean, the fact that i'm not returning "invalid_arg"?
<wxcafe> yeah, i know, but it's easier that way for the get_cell...
<adrien> the right way would be to wrap calls to List.nth with exception handling: try List.nth list n with Invalid_argument "List.nth" -> empty
<wxcafe> ok, you're right, we haven't yet seen how to do that ye
<wxcafe> yet*
<wxcafe> hmm
<adrien> (or you could be lazy and only use 'with Invalid_argument _' or be even more lazy and use 'with _')
<wxcafe> (my english is kinda broken)
<adrien> it's fine
<wxcafe> well there were two yet in the last sentence
<wxcafe> anyway
<adrien> well, anyway, do you know what makes List.nth raise this exception?
<wxcafe> I know it's after it's done with the first list in the matrix
<wxcafe> but I don't know *what* makes it raise an exception
<wxcafe> as far as I can see, it should go on to the next list in the matrix
ygrek_ has quit [Ping timeout: 256 seconds]
<wxcafe> (woops, i left the debugging instructions in the paste)
<adrien> val nth : 'a list -> int -> 'a
<adrien> Return the n -th element of the given list. The first element (head of
<adrien> the list) is at position 0. Raise Failure nth if the list is too
<adrien> short. Raise Invalid_argument List.nth if n is negative.
<adrien> :)
<wxcafe> yeah, i've seen that, but i don't see how b can be negative here
weie has joined #ocaml
<wxcafe> i mean, i'm doing b+1 and it was 0, so it should just be 1
<adrien> search for "-1" in your code?
<wxcafe> (well obviously it shouldn't, but i can't see why)
<wxcafe> the one in nth?
<wxcafe> (I still don't get it, sorry)
<Drup> wxcafe: you can add some clever (assert foo > 0) in some part of your code to try to track it down
<Drup> if the assert is false, it will crash and tell you which assert was false.
<adrien> I believe than when you look for neighbours, you cross the bounds of your matrix
<wxcafe> adrien: then it should at least print "1,0" before raising Invalid_argument
<wxcafe> Drup: I'm looking into it
<adrien> wxcafe: you don't get a backtrace along with the exception?
<adrien> also, I/O is buffered so unless you flush it, you shouldn't rely on that
<wxcafe> i'm not compiling, i'm using the interpreter...
<adrien> wxcafe: btw, there are some debugging facilities in the toplevel (tracing functions and a few other things)
<adrien> the interpreter can give you backtraces too
<adrien> try running: OCAMLRUNPARAM="b" ocaml
<adrien> I never use that but that should work
<wxcafe> hmm, no, i get :
<wxcafe> 0,0 1,0 2,0 3,0 4,0
<wxcafe> natural stop 0next_generation raises Invalid_argument "List.nth"
<wxcafe> Exception: Invalid_argument "List.nth".
<wxcafe> that's it.
<adrien> there's #trace as described at http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual023.html but it doesn't give a full backtrace ='(
<wxcafe> that's what i'm using
<wxcafe> that's what's giving me the "next_generation raises Invalid_argument "List.nth"
<adrien> you could add all functions but it's a bit annoying
<adrien> replace your "print_" functions with "prerr_"; it'll use stderr which is flushed at once
<adrien> should help a bit
jbrown__ has joined #ocaml
|jbrown| has quit [Read error: Connection reset by peer]
<wxcafe> i'm getting exactly the same thing
<wxcafe> 0,0 0,1 0,2 0,3 0,4 and then natural stop 0, and then it crashes
<wxcafe> well it tells me that n is negative
<mrvn> or add %!
<adrien> do you have an example for how I could run your code?
<wxcafe> i'm using a randomly-generated matrix
<adrien> mrvn: he's not using Printf but print_string/endline/int; I guess Printf will be for later
<wxcafe> the last one looks like this : [[0; 1; 1; 1; 1]; [0; 1; 1; 1; 0]; [0; 0; 1; 0; 0]; [0; 0; 0; 1; 1];
<wxcafe> [0; 0; 1; 1; 0]]
<wxcafe> (sorry)
<wxcafe> and then just run next_generation <matrix>
<adrien> ok
<adrien> I'm getting 'failure "nth"', not 'invalid_argument "nth"'
Anarchos has joined #ocaml
<wxcafe> well i'm getting invalid_argument List.nth
<wxcafe> which isn't the same as failure nth
<wxcafe> wait
<wxcafe> i'm using ocaml 3.12
<adrien> no change since 3.10 in that function
<wxcafe> hmm
<adrien> when I #trace get_cell;; I get that it's called with (5,1) [the_matrix]
<wxcafe> oooh
<wxcafe> right
<wxcafe> (5,1) then (5,0) then (5,-1)
<adrien> well, 5,1 is already off bounds
<adrien> since indexes start at 0
talzeus has quit [Remote host closed the connection]
<wxcafe> yeah, but since i use my nth wich returns 0 when it's off bounds, it works till 5,-1
<wxcafe> alright, gtg, but now i think i know how to fix this
<wxcafe> at least, i have a huge clue
<wxcafe> thanks, i should've thought about tracing all the functions
<adrien> well, I was really expecting the toplevel to give good backtraces
<Drup> there is a pragma to do trace, though
<Drup> ok, I'm just passing by and repeating what has already been said, don't mind me.
<adrien> #trace_all would be nice :)
Anarchos has quit [Quit: Vision[0.9.7-H-280704]: i've been blurred!]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
ygrek has joined #ocaml
jbrown__ has quit [Read error: Connection reset by peer]
jbrown__ has joined #ocaml
<bnegreve> hi
<bnegreve> I am using the read_key function from the graphics module
<bnegreve> I'd like to add a timeout in case there wasn't any key pressed
<bnegreve> is there a way to do this?
<Drup> bnegreve: it doesn't seems so, but graphics is a very limited library, you may want to use something else
jbrown__ has quit [Read error: Connection reset by peer]
<adrien> well I think it's doable
<adrien> you need to check first that Graphics.key_pressed () is true
jbrown__ has joined #ocaml
<adrien> then you can read and you'll get the first key pressed in the queue (key presses are queued)
<adrien> but wait_next_event is a better way to do it
<bnegreve> Drup what else?
<adrien> there's also loop_at_exit which could help but it's since 4.01 only
<Drup> adrien: Lwt.preemptive + timeout :]
<adrien> bnegreve: if you want to draw, Graphics is fine; if you want to do a graphical user interface, it's not the right module
<adrien> Drup: you disgust me :P
<adrien> Drup: but on some OSes, you can only do some operations from the main thread
<Drup> adrien: it's clean, efficient, and you can do stuff while it's waiting, I don't see why it's disgusting :)
<Drup> (but it was a kind of joke, don't worry)
<bnegreve> adrien: but that would be active waiting, right?
<Drup> bnegreve: no, you can call wait with the Unix module
<adrien> depends
<adrien> If [Poll] is given in the event list, return immediately with the current status.
hinayana has joined #ocaml
hinayana has quit [Read error: Connection reset by peer]
<bnegreve> Hum, the problem is that I want to react immediately on key press, so I don't think it's possible without hacking into graphics
<bnegreve> I might go for lwt in the end :)
<Drup> Huh, it was a joke, don't really do that x)
<Drup> what are you doing ? just some hacking or a real graphical application ?
<bnegreve> just some hacking
<Drup> ok, then do whatever you want :D
<bnegreve> basically I need to wait for a key event or a timeout
<Drup> but for a real application, don't use graphics
<adrien> well, the "nice" way would be to get events on a file descriptor and select() on it
<adrien> but
hinayana has joined #ocaml
<bnegreve> I thought about doing that, but I don't know the file descriptor
<bnegreve> on which I have to wait
<adrien> I'm not sure there's one available ;p
<bnegreve> yeah, I don't think it's exposed :(
<bnegreve> Ok, so if I drop graphics what can I use?
<bnegreve> I just need some basic drawing features ...
dsheets_ has quit [Ping timeout: 245 seconds]
<adrien> gtk's Gdk module if you want raster graphics; cairo if you want vector graphics
<bnegreve> ok I'll have a look
<bnegreve> thanks
hinayana has quit [Read error: Connection reset by peer]
hinayana has joined #ocaml
lamawithonel_ has joined #ocaml
ohama has quit [Ping timeout: 268 seconds]
ohama has joined #ocaml
weie has quit [Quit: Leaving...]
Anarchos has joined #ocaml
<Drup> cairo can't do input, you will want gtk to do that, but it's not hard to interface both
ygrek has quit [Ping timeout: 240 seconds]
xavierm02 has joined #ocaml
<xavierm02> hey
<xavierm02> I tend to like having my implementation in Module.ml and my interface in Module.mli but for a few things, I want to generate additionnal "things" for my module. For example, if my module represents a field, I'll define add, mul etc. and then I have a functor that takes that module and gives me back a module with many "shortcut" methods. The problem is that if I do "module Module = Functor(struct ... end)", then my result module is accessible from outside
<xavierm02> oh wait
<xavierm02> never mind. I just had to use "include" instead of "module Module ="
<xavierm02> >_<
<adrien> glad to help :)
yezariaely has quit [Quit: Leaving.]
ygrek has joined #ocaml
<whitequark> is there a way to specify -linkall, except for just one module ?
isBEKaml has joined #ocaml
isBEKaml has left #ocaml []
Drup has quit [Ping timeout: 252 seconds]
Drup has joined #ocaml
Drup1 has joined #ocaml
Drup has quit [Client Quit]
Drup1 is now known as Drup
<adrien> in ocamlbuild?
gnuvince has joined #ocaml
gnuvince has quit [Changing host]
gnuvince has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
ta`e has quit [Quit: Verlassend]
Yoric has joined #ocaml
tane has joined #ocaml
ggole has quit []
hinayana has quit [Quit: Quitte]
watermind has joined #ocaml
wwilly has joined #ocaml
skchrko has quit [Quit: Leaving]
moro_home has joined #ocaml
darkf has joined #ocaml
dsheets_ has joined #ocaml
cthuluh has quit [Quit: leaving]
cthuluh has joined #ocaml
steshaw has joined #ocaml
manud-away is now known as manud
wwilly has quit [Remote host closed the connection]
xavierm02 has quit [Ping timeout: 272 seconds]
wagle has joined #ocaml
xavierm02 has joined #ocaml
gour has quit [Quit: WeeChat 0.4.1]
xavierm02 has quit [Ping timeout: 240 seconds]
Snark has quit [Quit: *]
boogie has joined #ocaml
pdewacht has quit [Ping timeout: 240 seconds]
Breadmonster has joined #ocaml
xavierm02 has joined #ocaml
ollehar has joined #ocaml
steshaw has quit [Ping timeout: 272 seconds]
ollehar has quit [Quit: ollehar]
Breadmonster has quit [Ping timeout: 256 seconds]
xavierm02 has quit [Remote host closed the connection]
_tca has joined #ocaml
pdewacht has joined #ocaml
BiDOrD has quit [Remote host closed the connection]
BiDOrD has joined #ocaml
bnegreve has quit [Quit: Leaving]
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 246 seconds]
jbrown__ has quit [Read error: Connection reset by peer]
jbrown__ has joined #ocaml
ulfdoz has quit [Ping timeout: 272 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-280704]: i've been blurred!]
steshaw has joined #ocaml
wolfnn has quit [Read error: Operation timed out]
tane has quit [Quit: Verlassend]
Yoric has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
mfp has quit [Ping timeout: 246 seconds]
wxcafe has left #ocaml []