<robert[]>
this is great thanks I will look at these examples
ttamttam has joined #ocaml
<adrien>
but for lablgtk2, read the tutorial carefully, especially the first chapters, and the API of lablgtk2 closely follows the one of the C library
<adrien>
(and for drawing and receiving events, you'll want to look at #misc and #event methods iirc)
<adrien>
(this is for later on)
sebz has quit [Quit: Computer has gone to sleep.]
Associat0r has joined #ocaml
Associat0r has quit [Changing host]
Associat0r has joined #ocaml
lopex has quit []
ankit9 has joined #ocaml
ankit9 has quit [Remote host closed the connection]
nordoff_ has quit [Quit: Page closed]
<robert[]>
sorry but do I want lablgtk or lablgtk2? :S
<thelema>
2
<robert[]>
thanks
<robert[]>
I get problems with the web browser
Associat0r has quit [Quit: Associat0r]
<thelema>
robert[]: compiling the examples?
<robert[]>
it says stuff about ocamlcore being unsecure
<robert[]>
false security cerfificate
<thelema>
yes, gildor tried fixing that, but it's still funny
<thelema>
that's a known problem with ocamlcore at the moment.
wormphlegm has quit [Read error: Connection reset by peer]
wormphlegm has joined #ocaml
emmanuelux has joined #ocaml
alxbl has quit [Changing host]
alxbl has joined #ocaml
hto has joined #ocaml
robert[] has quit [Quit: Lost terminal]
emmanuelux has quit [Ping timeout: 244 seconds]
ttamttam has quit [Ping timeout: 276 seconds]
robert[] has joined #ocaml
<jimi_hendrix>
can someone please tell me why I am getting an error with my intersects method here? the error is in a comment at the bottom of the paste. http://pastebin.com/Gj0MHVXA
<jimi_hendrix>
i have tried various things to fix the typing error, but none have worked
<thelema>
jimi_hendrix: what's the line number of the error?
ankit9 has joined #ocaml
<robert[]>
method virtual intersects : ray -> float * ray_result
<thelema>
ok, there's an incompatibility between L43 and L49
<jimi_hendrix>
ah
<jimi_hendrix>
thanks
lopex has joined #ocaml
<jimi_hendrix>
that was it robert[]
<thelema>
jimi_hendrix: btw, you have a typo on L4
joewilliams_away is now known as joewilliams
ygrek has joined #ocaml
<jimi_hendrix>
thelema, fixed
ttamttam has joined #ocaml
ulfdoz has joined #ocaml
oriba has quit [Quit: oriba]
vivanov has joined #ocaml
vivanov has quit [Client Quit]
larhat has quit [Quit: Leaving.]
Julien_T has quit [Ping timeout: 256 seconds]
bobry has joined #ocaml
sebz has joined #ocaml
sebz has quit [Client Quit]
Julien_T has joined #ocaml
zorun has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
emmanuelux has joined #ocaml
thomasga has quit [Quit: Leaving.]
ztfw has joined #ocaml
everyonemines has joined #ocaml
ylc has joined #ocaml
ylc has left #ocaml []
lpereira has joined #ocaml
Skolem has joined #ocaml
Anarchos has joined #ocaml
junsuijin has joined #ocaml
flapjackery has joined #ocaml
flapjackery has quit [Client Quit]
flapjackery has joined #ocaml
ttamttam has quit [Remote host closed the connection]
lopexx has joined #ocaml
oriba has joined #ocaml
lopexx has quit [Client Quit]
lopex has quit [Ping timeout: 240 seconds]
lopex has joined #ocaml
abdallah has joined #ocaml
_andre has quit [Quit: leaving]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
<abdallah>
I am using rectangular 'a matrix, should I use the simple 'a array array or linearize it to 'a array?
<robert[]>
I think the best way to work is such that it's impossible to tell the difference
<Anarchos>
abdallah depends on what you want to do with the type !
<robert[]>
I mean programming in such a way that the definition (being 'a array array or 'a array) cannot be found (and therefore it could be changed etc..)
<robert[]>
I don't know if I made sense...
<abdallah>
Yeah, sure. It's already encapsulated in its own module, but I'm wondering for the implementation of this module.
<abdallah>
The element type is a three valued enum and the size of the matrix can be assumed no to go over 10x10 (probably not over 6x6 but I am not sure).
<abdallah>
So I suppose in the end, I'll have to use a bitboard but I feel like it's way less readable.
<robert[]>
checkZero ls ret should be checkZero tl ret
<robert[]>
otherwise the recursion will never terminate
<dancannon>
Ah
<dancannon>
Ooops
<dancannon>
Sorry about that, I have been working for a while
<abdallah>
Thanks for your answers.
<dancannon>
I thought I had the syntax wrong. THanks
dancannon has quit [Quit: ChatZilla 0.9.87 [Firefox 6.0.2/20110902133214]]
Kakadu has quit [Quit: Konversation terminated!]
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 240 seconds]
<thelema>
abdallah: abstract your operations to make them readable. i.e. `get_bit board i j`
<thelema>
abdallah: also, arrays of arrays are implemented with the first array holding pointers to the second array. If you want/need to avoid the indirection, you'll need to do the multiply-addressing yourself.
<thelema>
abdallah: most likely, you'll be fine with a `enum array array`, as it'll fit within L1 cache easily
<abdallah>
thelema: So if the matrix is small, the indirection is not much more costly than (i - 1) * m + (j - 1) ?
<thelema>
if you use 0-based array indexes, you can avoid the -1's
<thelema>
I'm not sure the cost of a L1-cache hit on your platform
<thelema>
according to this, L1 = ~4 cycles, so it'll be about the same as the math
<jimi_hendrix>
another silly beginner question: i am trying to write a function without side effects but i cannot figure out a good way to do it. here is my psuedo-code for the function: http://pastebin.com/5kKEmuNX
rgrinberg has joined #ocaml
<thelema>
jimi_hendrix: Use List.fold_left
<abdallah>
Ok. What is an approximate size of the L1-cache on a desktop computer ?
<jimi_hendrix>
thelema, thanks for the tip
<thelema>
abdallah: 64KB data + 64KB instructions
<thelema>
per core
<abdallah>
Ok, thanks a lot.
<thelema>
jimi_hendrix: or if you're using batteries, you can use Enum.arg_min
<jimi_hendrix>
thelema, whats that?
<thelema>
jimi_hendrix: you might consider using `float option` for your return type of p.intersects
<jimi_hendrix>
alright
<thelema>
jimi_hendrix: batteries is an extended stdlib. Enum is its sequence type, and arg_min takes a function and an enum and returns the element of that enum that gives minimum value on that function
<jimi_hendrix>
thelema, i think i will go with the left fold for the experience
<thelema>
jimi_hendrix: yes, better for learning
<rferranti>
that's an unfortunate name, isn't it?
<jimi_hendrix>
thelema, and then the function i pass to the fold will take two arguments, calls intersects and both of them, and returns the one with the lesser hit distance?
<thelema>
jimi_hendrix: you could do that. You probably don't want to compute the distance repeatedly, so you could keep that with the closest object
<rgrinberg>
is it usually expensive to call "of_enum"? for various collections?
<jimi_hendrix>
thelema, what do you mean by that
<rgrinberg>
like say a BatSet
<thelema>
List.fold_left (fun (best_obj,best_dist as acc) obj -> match obj#intersects ray with Some d when d < best_dist -> (obj, d) | _ -> acc) ...
<thelema>
rgrinberg: no more expensive than constructing the set some other way.
<rgrinberg>
and turning stuff into an enum?
testcocoon has quit [Quit: Coyote finally caught me]
Cyanure has joined #ocaml
<thelema>
rgrinberg: done lazily - depends on how much of the enum you consume
<rgrinberg>
my general problem is that I would like to write functions that don't always depend on the data structure but on what kind of operations it supports. in f# I'd just always call Seq.map/filter or w/e and that would work on arrays, lists, etc. In haskell they have typeclasses. what to do in ocaml?
<thelema>
There's definitely an overhead to enumerations, but it's just a constant factor over, say, an array
<thelema>
rgrinberg: use functors in ocaml for that.
<jimi_hendrix>
thelema, ah
<jimi_hendrix>
thelema, is the fun keyword the same as the function keyword?
<thelema>
jimi_hendrix: not quite. "function" corresponds roughly to "fun x -> match x with"
<jimi_hendrix>
ah
<rgrinberg>
thelema: ok ill go read about them, see if i make some progress.
<Anarchos>
jimi_hendrix fun keyword accepts multiple arguments : let f = fun x y ->y
<jimi_hendrix>
Anarchos, ok
<everyonemines>
Is there an overhead to passing pairs between functions, or matching against (x,y) ? I mean, does that add a level of pointer dereferencing?
<thelema>
everyonemines: sometimes, but the ocaml compiler is quite good at getting rid of it when the pair isn't used as a single value.
<jimi_hendrix>
thelema, anyway, thanks for all the help
<thelema>
jimi_hendrix: n/p.
<jimi_hendrix>
thelema, also, what would i pass to the folding function for best_obj part of the tuple? the best_distance part would obviously be the maximum distance.
Cyanure has quit [Quit: Quitte]
edwin has quit [Quit: Leaving.]
<everyonemines>
thelema: So just avoid using "foo as (x,y)" and it gets optimized out?
lpereira has quit [Quit: Leaving.]
Associat0r has joined #ocaml
Associat0r has quit [Changing host]
Associat0r has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
devinus has joined #ocaml
<devinus>
does ocaml have something akin to rvm for ruby or pythonbrew for python?
oriba_ has quit [Quit: oriba_]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]