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
Associat0r has quit [Quit: Associat0r]
lopex has quit []
seafood has quit [Quit: seafood]
jimmyrcom1 has joined #ocaml
jimmyrcom has quit [Ping timeout: 246 seconds]
joewilliams is now known as joewilliams_away
BiDOrD_ has quit [Ping timeout: 252 seconds]
BiDOrD has joined #ocaml
jimmyrcom1 has quit [Ping timeout: 264 seconds]
ulfdoz has joined #ocaml
adrien_ is now known as adrien
bobry has quit [Quit: Leaving.]
sebz has joined #ocaml
ankit9 has joined #ocaml
junsuijin has quit [Quit: Leaving.]
ulfdoz has quit [Read error: Operation timed out]
arubin has quit [Quit: arubin]
dnolen has quit [Quit: dnolen]
ttamttam has joined #ocaml
edwin has joined #ocaml
f[x] has quit [Ping timeout: 264 seconds]
bobry has joined #ocaml
f[x] has joined #ocaml
ikaros has joined #ocaml
larhat has joined #ocaml
betta_y_omega has quit [Ping timeout: 260 seconds]
betta_y_omega has joined #ocaml
avsm has joined #ocaml
lopex has joined #ocaml
jimmyrcom has joined #ocaml
betta_y_omega has quit [Ping timeout: 245 seconds]
betta_y_omega has joined #ocaml
milosn_ has quit [Ping timeout: 258 seconds]
_andre has joined #ocaml
milosn has joined #ocaml
_andre has quit [Quit: leaving]
ttamttam has quit [Quit: ttamttam]
Snark_ has joined #ocaml
Snark_ is now known as Snark
avsm has quit [Quit: Leaving.]
Associat0r has joined #ocaml
Associat0r has quit [Changing host]
Associat0r has joined #ocaml
Associat0r has quit [Quit: Associat0r]
ttamttam has joined #ocaml
dnolen has joined #ocaml
<flux> it's a real shame that the qt for ocaml projects have apparently died :/
<flux> I guess it's just too huge task
<adrien> lablgtk is not high-maintenance, and they stated they had a good start (and more)
avsm has joined #ocaml
<raphael-p> flux: kakadu's repository seems active: https://github.com/Kakadu/lablqt/commits/master
<flux> raphael-p, ooh, some light at the end of the tunnel :)
<flux> it's a very recent project, no?
<flux> I hope that doesn't mean just that it hasn't died, yet..
<adrien> as far as I'm concerned, I feel like killing Qt each time I have to deal with its layouts
<flux> well, I'd like to write apps for Meego one day, and apparently it's pretty much Qt only business
<flux> actually maybe not, the netbook version is clutter-based
<flux> but the handset is qt, at least for the next available incarnation of it (N9)
<adrien> do they also have an englightenment-based one? :P
<adrien> and I finally understood what clutter was: makes animations (give a start state, an end state and it makes an animation automatically), but it does not have a collection of widgets (if you want a listview...)
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 240 seconds]
DimitryKakadu has joined #ocaml
<DimitryKakadu> hi men
<DimitryKakadu> have somebody mentioned https://github.com/Kakadu/lablqt/ here ?
<flux> adrien, in other words, who needes functionality, when you can have bling?
<flux> raphael-p did do that, and I clicked :)
<adrien> flux: well, it's _meant_ for presentation but I'm pretty sure it's already being abused ;-)
_andre has joined #ocaml
* mfp rubs hands together
<DimitryKakadu> flux: I have hard time today: I'm thinking is it possible to develop lablqt in my way and I can't coding at all.
iratsu has quit [Ping timeout: 245 seconds]
<mfp> read 1000 keys, read 7937 columns in 0.03622s (sys 0.01600s)
<mfp> read 219151 columns/second :-))
<DimitryKakadu> Do you know any typical way to solve conflict?
<flux> dimitrykakadu, I can sympthatize that writing a type safe binding generator for qt can be daunting
<mfp> <- my bigtable-like DB built atop LevelDB
<flux> dimitrykakadu, what kind of conflict?
<flux> mfp, hm, does leveldb support rolling back transactions?
<mfp> flux: LevelDB by itself only provides atomic batch writes...
<mfp> ... transactions... I implemented them on top of that :)
<flux> and did you implement a relational data model on top of that?-)
<mfp> a bigtable-like data model, not relational
<DimitryKakadu> Some times I can't understand, is lablqt needed by somebody. I'm not a cool ocaml programmer, thats why sometimes I can't undestand what data structures use. I see 2 ways, but each way have some problems and I can't undestand what to do ((
<DimitryKakadu> What I expect that in a 5 minutes all will be working...
<mfp> i.e. tables ("column families" in bigtable parlance) holding ordered keys which have an arbitrary number of columns associated to them
<DimitryKakadu> I undestand some strage feature of C++ and than.... I need to rewrite code written by me
<flux> dimitrykakadu, well, at least you've learned something in the process?-)
<flux> it's still easy when you don't have a lot of code
<DimitryKakadu> flux: yes, I know a litlle bit more about programming now
<DimitryKakadu> flux: Now I'm in a few steps to implementing bindings for slots and type-safe connection signals and slots, but I can't do this few steps.
<adrien> why?
<DimitryKakadu> flux: Maybe its time to find people who sad that all is done wrong or that something is good
<adrien> well, describe what you've done so far
<DimitryKakadu> adrien: why? I think that because I am I. I need more discipline. I can every day in a month write study OCaml with some crazy idea, and than forget about it for long time.
<adrien> I mean how you've done it
<adrien> you do it on your free time
<DimitryKakadu> I think that better place for description is somewhere in LJ. I'm going to write post in a 10-15 minutes.
<DimitryKakadu> adrien: > you do it on your free time
<DimitryKakadu> adrien: is it a question?
<adrien> yes and no: afaiu, you're doing it on your free time and it's probably something that requires quite a lot of concentration so it's hard to find time for it
<adrien> (since you need 2 hours free to actually do something)
dnolen has quit [Quit: dnolen]
avsm1 has quit [Quit: Leaving.]
avsm has joined #ocaml
iratsu has joined #ocaml
penryu has left #ocaml []
sebz has quit []
sebz has joined #ocaml
<DimitryKakadu> some illitarate words about lablqt.
dnolen has joined #ocaml
<adrien> DimitryKakadu: there are many things you shouldn't bother trying to keep from C++
<adrien> they won't make sense
dnolen has quit [Client Quit]
<adrien> and there are others things which you can provide and which will make the API *way* better
<hcarty> DimitryKakadu: For classes vs modules - It is probably fine to use either. If one feels more natural or easier to you then go with that.
<adrien> I tend to avoid state in modules (mostly because I don't expect it in the modules I use)
<thelema_> adrien: very true - module state should be exported as an abstract type if necessary
<adrien> as for recursion among classes, you can put types in a separate file/module and recurse there
<adrien> (I have to check what gtk does exactly, it might do that only to some extent, and I need to solve the same issue myself in cowboy/glib)
<DimitryKakadu> adrien: wnad how to understand what classes put in another module?
<thelema_> DimitryKakadu: intense thought
oriba has joined #ocaml
<adrien> cowboy/glib defines everything in the same "fooTypes.ml" file, which is not very nice (but it works)
<adrien> also, can you currently display something on screen?
<DimitryKakadu> adrien: sorry, but no. QWidget::show is slot, but translating slots is "a little bit crazy" (c)
<adrien> if you are, then focus on that, get some examples and tests, and improve the API to make it nice to use with ocaml
<adrien> ok, well
<adrien> you need to replicate Qt's MOC?
<DimitryKakadu> mmm, I don't care about MOC
<DimitryKakadu> I think that to create C++ stubs for methods I can do without thinking about MOC
<DimitryKakadu> But maybe I'll see problems with memory leaks, and that I'll care about moc, but I can't say any concrete now
<adrien> maybe not replicate, rather, "handle" it
<adrien> mem leaks, you'll see that later on ;-)
<adrien> but in C++, you need MOC for signals and slots so I expected that you had to do at least a few things too
<adrien> actually you don't care about that either
<adrien> not currently at least (since it's only for new signals and slots)
sebz has quit [Quit: Computer has gone to sleep.]
<DimitryKakadu> i've catched your thougth
zorun has quit [Ping timeout: 240 seconds]
sebz has joined #ocaml
ttamttam has left #ocaml []
zorun has joined #ocaml
joewilliams_away is now known as joewilliams
bobry has quit [Ping timeout: 258 seconds]
ulfdoz has joined #ocaml
avsm has quit [Quit: Leaving.]
oriba has left #ocaml []
larhat has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
ttamttam has joined #ocaml
Anarchos has joined #ocaml
schmx has joined #ocaml
schmx has quit [Changing host]
schmx has joined #ocaml
schme has quit [Ping timeout: 240 seconds]
adrien has quit [Ping timeout: 240 seconds]
adrien has joined #ocaml
ulfdoz has quit [Ping timeout: 268 seconds]
junsuijin has joined #ocaml
bobry has joined #ocaml
cthuluh has quit [Ping timeout: 240 seconds]
DimitryKakadu has quit [Remote host closed the connection]
kakadu has joined #ocaml
cthuluh has joined #ocaml
lopexx has joined #ocaml
lopex has quit []
lopexx has quit []
lopex has joined #ocaml
marens has joined #ocaml
<marens> hello, i'm currently looking at lambda calculus and ocaml, can somebody explain to me why "let fact x = if x = 0 then 1 else x * (fact (x-1));;" works without rec?
<thelema_> marens: you're doing this in the toplevel?
<kakadu> marens: really workd?
<kakadu> works*
<thelema_> I'm guessing you have fact already defined, and what should be a recursive call is calling the other implementation
<thelema_> # let fact x = if x = 0 then 1 else x * (fact (x-1));;
<thelema_> # Error: Unbound value fact
<marens> let me try a new toplevel session
<NaCl> you probably defined fact previously
<marens> d'oh
<zorun> let "rec" ?
<zorun> oh, sorry, I'm totally out of it
* zorun slaps itself
<marens> in a new toplevel session it gives the expected error.
<thelema_> # let x = 5;;
<thelema_> val x : int = 5
<thelema_> # let x = x + 5;;
<thelema_> val x : int = 10
<marens> i just thought let fact x = if x = 0 then 1 else x * (fact (x-1)) in fact 3;; should use the recent definition
<NaCl> ocaml is black magic
<thelema_> "let rec" brings the value you're defining into its own scope. Without rec, references to the value you're defining go to the environment.
<marens> thanks for the fast help with this stupid mistake
avsm has joined #ocaml
<kakadu> i'm a little bit confused
<thelema_> kakadu: let foo x = {x = (x.b :> [`A|`B|`C])}
<NaCl> curly braces?
<NaCl> what does it mean?
<thelema_> NaCl: record
<NaCl> o
<NaCl> h
<NaCl> silly NaCl
* NaCl forgot
<thelema_> kakadu: if you want to use a variant of one type as a variant of a supertype, ocaml requires an explicit cast, similar to objects
<kakadu> thelema_: thanks. no explicit at all ...
<kakadu> mmm
<kakadu> implicit*
<thelema_> kakadu: yup, ocaml lacks implicit casts, even in these obvious cases.
_andre has quit [Quit: leaving]
<dark> any oasis package for ubuntu?
<thelema_> dark: odb works pretty well to install oasis on ubuntu
<dark> and odb is on ubuntu?
kakadu has quit [Quit: Konversation terminated!]
<adrien> btw, is odb pure ocaml? what are its deps?
<thelema_> dark: odb is a single .ml file to be run directly by the ocaml interpreter
<thelema_> adrien: yes, pure ocaml, deps only findlib and ocaml stdlib (str)
<thelema_> (str, unix)
thelema_ is now known as thelema
<adrien> will have to see it on windows/cygwin :P
<dark> in fact, I asked for this kind of suggestion many times, but, for a fresh new ocaml project, which build system one would use here? omake? just ocamlbuild? (is there a difference between ocamlbuild and oasis? it would be like, ocamlbuild is built-in in ocaml, oasis is built on top of it. right?)
<thelema> adrien: also the 'curl' executable and tar
<thelema> adrien: it runs programs to get some work done.
<adrien> thelema: oh! any plan to support bsdtar (instead)?
<adrien> tar on windows is a HUGE "no"
<adrien> I mean, gnu tar
<dark> thelema, so your suggestion for oasis-on-ubuntu is: download odb manually, install it on like /usr/local, and use it to install oasis?
<thelema> dark: it needs no installation
<thelema> dark: but yes
<dark> odb needs no installation? i suppose oasis needs
<adrien> thelema: and I do the same with yypkg, definitely the best way to go here too I think
<dark> and, what would you use? I searched a bit about using something off-ocaml like cmake, but, no great support found
<thelema> dark: odb can be chmodded 755 and run like a shell script
<dark> uhm
<thelema> adrien: it would pretty trivial to change the extract command in odb: https://github.com/thelema/odb/blob/master/odb.ml#L201
<thelema> dark: I would and do use ocamlbuild with a myocamlbuild.ml that I copy from project to project, a custom written _tags file (very easy to do) and a simple makefile to automate calling ocamlbuild
<adrien> thelema: the command works for bsdtar too but there are a few differences: gnu tar and bsdtar don't always write to the same file descriptors and bsdtar's output format with -v is different
<adrien> I used to handle both but ended up throwing away the code and started requiring bsdtar everywhere
<dark> no oasis? (too complicated?)
<thelema> adrien: I don't really need the -v, so it'll probably work.
<adrien> thelema: do you read what tar writes to stdout or stderr?
<thelema> adrien: nope, I just check the return code.
<adrien> shouldn't be any issue then ;-)
<thelema> dark: no oasis for most of my projects, if I started a new project that I intended to distribute, I'd make an oasis file so it would upload to oasis-db easily.
<thelema> adrien: great.
<dark> so ocamlbuild -> oasis is simple
<thelema> it's pretty easy to add an oasis file that contains the commands to run to build your project using whatever tools you want. It's also possible to give oasis the info needed for it to create a complete build system for a project. This is the part I don't know how to do.
iratsu has quit [Ping timeout: 245 seconds]
<thelema> I'm comfortable enough with ocamlbuild that I use it for build.
<dark> "Most of the value of ocamlbuild lies in the fact that it often needs no extra information to compile a project besides the name of the top-level module." , it is like, interesting
<thelema> dark: if you're using ocamlfind packages, you'll need a _tags file and a generic myocamlbuild.ml file
<thelema> under 3.12 and higher, the myocamlbuild.ml file isn't needed for ocamlfind
<thelema> my laptop still has 3.11.2 from ubuntu, so I still use myocamlbuild
<thelema> (to ocamlfind-enable my _tags file)
<dark> but then you run ocamlbuild from a makefile? like, a target that is always run? (why, just for "make" command?)
<thelema> because the ocamlbuild command is pretty long for my current project: "ocamlbuild run_tests.native" loses to "make opt"
<dark> hmm yes ubuntu is trying to install 3.11.2 here
<dark> ocaml 3.12 is from august 2010, ubuntu 11.04 still doesn't have it o.o
<thelema> iirc, something about 3.12 just missing debian's previous stabilization freeze
<adrien> or too new at the time, I can't remember exactly but it was a matter of days
Snark has quit [Quit: Quitte]
<sgnb> what thelema said
iratsu has joined #ocaml
edwin has quit [Remote host closed the connection]
Reaganomicon has joined #ocaml
Anarchos has quit [Ping timeout: 260 seconds]
Anarchos has joined #ocaml
qdl has left #ocaml []
mfp has quit [Ping timeout: 240 seconds]
ttamttam has left #ocaml []
mfp has joined #ocaml
dark has quit [Ping timeout: 245 seconds]
iratsu has quit [Ping timeout: 245 seconds]
iratsu has joined #ocaml
avsm has quit [Quit: Leaving.]
nimred has quit [Ping timeout: 258 seconds]
Morphous has quit [Read error: Operation timed out]
Morphous has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
lopexx has joined #ocaml
lopex has quit [Ping timeout: 264 seconds]
lopexx has quit [Client Quit]
lopex has joined #ocaml
<foocraft> Hi
<foocraft> I'm having a hard time understanding part of the tutorial on the main site.
<foocraft> Specifically the match part and how it works.
<dsheets> foocraft: what's the problem?
<foocraft> Let me try to translate it to English.
<foocraft> It's declaring a recursive function that will return [] on input of [] or ... I'm stuck here
<dsheets> ah, or if the list has at least a single element, it will sort the end of the list ([] or again >1 element) and then insert the first element into the newly sorted list
<foocraft> how is it using "head" and "tail" without declaring them previously?
<foocraft> Are they some variables refering to the last accessed list?
<dsheets> the left-hand-side of each match clause is a pattern
<dsheets> patterns let you perform "destructuring binds" to variables
<dsheets> In this case, the pattern uses the list concatenation operator to extract the head and tail (rest) of the list
<foocraft> ah okay, so when you're matching a list, head and tail are defined for you to use, right?
<dsheets> foocraft: you can pick the variable names however you like: "| h :: _ -> …" would match the first element to the var 'h' and throw away the rest
<dsheets> foocraft: "| f :: (sz,_) :: t :: _ -> …" would match the first element to 'f', the first element of the pair in the second list position as 'sz' and the third element as 't', throwing away the rest
<foocraft> Okay. so another way is match lst with [] -> [] | foo :: bar -> insert foo (sort bar)
<dsheets> foocraft: yep
<foocraft> (sz,_)
<foocraft> What's going on here. I suspect some other magic too :p
<dsheets> (_,_) is the shape of a 2-tuple so (a,b) is a pattern that puts the first element of the pair in 'a' and the second element in 'b'
<foocraft> so f is the first in the list, sz is the second and t is the third.
<foocraft> But why didn't you do f :: sz :: t?
<foocraft> (I highly appreciate this, btw)
<dsheets> f :: sz :: t :: _ is exactly what you describe. f :: (sz,_) :: t :: _ gets you the first part of the second element (assuming you are destructuring a list of pairs)
<foocraft> Aaah! That's sweet :)
<dsheets> so f : ('a,'b) and sz : 'a
<foocraft> Okay, so they're really just token holders, in a way, right?
<dsheets> foocraft: yes, it is very nice. You can do this with variant types and records as well
<dsheets> foocraft: they are a supercharged form of assignment that lets you open up your data structures to match in a variety of ways
<dsheets> foocraft: patterns are allowed in 'let' as well: "let (min,max) = minmax [1;2;3;4;5] in…"
<foocraft> I can see how, when I get better at this, this will be highly expressive.
<dsheets> foocraft: of course, the compiler will complain if your patterns do not cover the entire type
<dsheets> foocraft: does this clarify some of your confusion?
<foocraft> So if I do f :: (sz,_) :: t :: _ and the second element in the list I'm matching against is not a tuple, what would happen then?
<foocraft> Would it slap me?
<foocraft> You clarified a lot of it, thanks :)
<dsheets> foocraft: it would not let you compile. Lists must have elements of all the same type.
<dsheets> foocraft: perhaps something like "(North 3) :: (South 3) :: _" would be a list of LOGO turtle instructions
<dsheets> foocraft: If this is your only pattern, the compiler will warn but not error that you have unaccounted for cases (what happens with "(South _) :: (North _) :: _" ?)
<foocraft> With (South _) :: (North _) :: _ matching against what?
<foocraft> Against a list of LOGO turtle instructions?
<dsheets> sure, against the same thing that (North _) :: (South _) :: _ matches
<foocraft> It shoud compile. I think.
<foocraft> These are just variable names.
<foocraft> South and North.
<foocraft> Is that correct?
<dsheets> foocraft: ah, keep reading! North and South are constructors of a variant type; type logo = North of int | South of int | East of int | West of int
<dsheets> foocraft: if you now have a list of these instructions, you might want to match against it and your matches must cover the entire type matching against. "_" matches anything and that makes it somewhat dangerous because you no longer get warnings about unhandled cases
<dsheets> foocraft: "match instlist with (North n) :: _ -> n | (South s) :: _ -> s" is not complete
<foocraft> If it's not complete, is that a compile error?
<foocraft> Oh and what about the n.
<foocraft> I thought it would DEFINITELY not want you to match the n, and then not use it.
<foocraft> Oh okay no, my bad.
<dsheets> foocraft: it's actually a warning with cases that need patterns and then a runtime error if no patterns can be satisfied
<foocraft> You want to say you have a North and some number plus some other junk OR a south and a number and some other junk.
<foocraft> (correct me if I'm wrong in reading that one)
<dsheets> foocraft: yes, exactly. if this were the entire function, it would be logo list -> int and maybe called "first_move_magnitude" or something
<foocraft> Okay, I'll read more in the intro.
<foocraft> Thanks a lot, dsheets. :)
<dsheets> foocraft: you're welcome! Good luck. You're on the right track. :-)
<foocraft> :)
dnolen has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
iratsu has quit [Ping timeout: 245 seconds]
ikaros has quit [Quit: Ex-Chat]
arubin has joined #ocaml
sebz has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 240 seconds]