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