gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 255 seconds]
ulfdoz_ is now known as ulfdoz
zorun has quit [Ping timeout: 245 seconds]
mjonsson has quit [Quit: Leaving]
sebz has joined #ocaml
lopex has quit []
mjonsson has joined #ocaml
jamii has quit [Ping timeout: 248 seconds]
mjonsson has quit [Remote host closed the connection]
emmanuelux has quit [Ping timeout: 240 seconds]
Tianon has quit [Ping timeout: 240 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
<jimi_hendrix> i assume the typical way to iterate through a list is to pattern match head :: tail and then recurse with tail?
sebz has quit [Quit: Computer has gone to sleep.]
<_habnabit> there's also List.iter, and List.map, and so on.
<jimi_hendrix> ok
<jimi_hendrix> also, what is the recommended introduction to ocaml? the manual seems to not go into much depth in some areas
sebz has joined #ocaml
<jimi_hendrix> (it only mentions tuples without showing their syntax, afaik)
arubin has quit [Quit: arubin]
larhat has joined #ocaml
zorun has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
hto has joined #ocaml
ulfdoz has quit [Ping timeout: 244 seconds]
ikaros has joined #ocaml
dirkD has joined #ocaml
slam` has joined #ocaml
<flux> jimi_hendrix, Introduction to Objective Caml ebook (free) by Jason Hickey seems decent
<flux> jimi_hendrix, there is also the syntax part of the manual, but that's quite difficult reading..
dirkD has quit [Ping timeout: 258 seconds]
slam` has left #ocaml []
ikaros has quit [Quit: Ex-Chat]
hto has quit [Quit: Lost terminal]
ygrek has joined #ocaml
dnolen has joined #ocaml
dnolen has quit [Quit: dnolen]
ttamttam has joined #ocaml
Skolem has joined #ocaml
Skolem has left #ocaml []
khaaan has joined #ocaml
khaaan is now known as smarthome
smarthome is now known as Skolem
zorun has quit [Read error: Connection reset by peer]
ankit9 has joined #ocaml
bobry has quit [Quit: Leaving.]
sebz_ has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
sebz_ has quit [Quit: Computer has gone to sleep.]
ankit9 has quit [Quit: Leaving]
avsm has joined #ocaml
avsm has quit [Client Quit]
edwin has joined #ocaml
<emias> ,
f[x] has joined #ocaml
<flux> indeed, ,.
Julien_T has joined #ocaml
lopex has joined #ocaml
Cyanure has joined #ocaml
lopex_ has joined #ocaml
lopex has quit [Ping timeout: 252 seconds]
ankit9 has joined #ocaml
sebz has joined #ocaml
explodus has quit [Ping timeout: 260 seconds]
Julien_T has quit [Read error: Operation timed out]
avsm has joined #ocaml
explodus has joined #ocaml
avsm has quit [Quit: Leaving.]
sebz has quit [Quit: Computer has gone to sleep.]
Kakadu has joined #ocaml
Julien_T has joined #ocaml
ygrek has joined #ocaml
lopex_ is now known as lopex
ygrek has quit [Ping timeout: 248 seconds]
<gildor> f[x]: fixed
<f[x]> thx
alxbl has quit [Ping timeout: 248 seconds]
f[x] has quit [Ping timeout: 248 seconds]
sebz_ has joined #ocaml
alxbl has joined #ocaml
f[x] has joined #ocaml
husten has joined #ocaml
husten is now known as nordoff
nordoff has quit [Remote host closed the connection]
nordoff has joined #ocaml
ygrek has joined #ocaml
_andre has joined #ocaml
ankit9 has quit [Ping timeout: 248 seconds]
nordoff_ has joined #ocaml
nordoff has quit [Quit: Page closed]
Skolem has quit [Quit: Skolem]
f[x] has quit [Quit: Leaving]
f[x] has joined #ocaml
ankit9 has joined #ocaml
thomasga has joined #ocaml
mehdid has quit [Ping timeout: 260 seconds]
mehdid has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
oriba has joined #ocaml
ikaros has joined #ocaml
sebz_ has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
ankit9 has quit [Remote host closed the connection]
ttamttam has quit [Read error: Operation timed out]
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
larhat1 has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
larhat1 has quit [Read error: Connection reset by peer]
Cyanure has quit [Remote host closed the connection]
sebz has joined #ocaml
robert[] has joined #ocaml
<robert[]> hello
<robert[]> I've just wondered about Ocaml for GUI programs on GNU/Linux
<thelema> It's possible - many people use lablgtk2
<robert[]> do you think it is a great idea
<adrien> "great"?
<robert[]> Let me put it this way
<robert[]> I have a lot of bad luck with computers :)
<robert[]> I would probably best use C++ Or pyhthon for the least chance of problems
<robert[]> but it is a lot nicer to program in Ocaml
<robert[]> so I couldn't decide what should I use
<adrien> imho, ocaml/lablgtk beats C++/Qt hands down
<robert[]> it's just on here http://www.gtk.org/language-bindings.php
<robert[]> it's a few version away
<robert[]> maybe doesn't matter
<adrien> if you're missing some API, ask me and I'll add it
<adrien> well, my goal is to catch up on some things but I'll prioritize it
<adrien> (I recently became a commiter of lablgtk2)
<robert[]> oh cool
<rwmjones> robert[]: I've written a few largish programs using lablgtk2, and it's fine for that
<rwmjones> eg:
<robert[]> thanks very much!!
<rwmjones> guestfs-browser
<adrien> but chances are you won't be missing anything
<robert[]> I just want to make a simple board game
<robert[]> I think ocaml is really nice to use
<robert[]> so I will try my best
<adrien> and read and grep the "examples" folder in lablgtk2's sources
<robert[]> by the way, do you have a good Prolog or similar in ocaml?
<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.
<robert[]> this is fine? :)
<adrien> yes
<adrien> hmmm
<adrien> why not take the releases?
<robert[]> hmm
<robert[]> great
<adrien> which OS/distro are you on?
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
<robert[]> method intersects (ray:ray) (dist:float)
<robert[]> this is a conflict
<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.
ulfdoz has quit [Ping timeout: 260 seconds]
dancannon has joined #ocaml
<dancannon> Hi, How could I get this code to work? https://gist.github.com/1276406
<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> ok
<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!]
lamawithonel has quit [Ping timeout: 256 seconds]
rwmjones is now known as rwmjones_afk
devinus has left #ocaml []
Amorphous has quit [Ping timeout: 248 seconds]
Amorphous has joined #ocaml
<everyonemines> devinus: godi
emmanuelux has quit [Ping timeout: 244 seconds]
schme has quit [Ping timeout: 260 seconds]
schme has joined #ocaml
schme has quit [Changing host]
schme has joined #ocaml
struktured has joined #ocaml
Associat0r has quit [Quit: Associat0r]
robert[] has quit [Quit: leaving]
flapjackery has quit [Quit: Textual IRC Client: http://www.textualapp.com/]