hcarty changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
julm__ has joined #ocaml
julm_ has quit [Read error: 54 (Connection reset by peer)]
slash_ has quit [Read error: 110 (Connection timed out)]
slash_ has joined #ocaml
julm__ has quit ["leaving"]
ikaros has quit ["Leave the magic to Houdini"]
verte has joined #ocaml
verte is now known as verte-work
jzmer has joined #ocaml
slash_ has quit [Client Quit]
ski_ has joined #ocaml
Nutssh has joined #ocaml
onigiri has quit []
komar_ has quit [Remote closed the connection]
komar_ has joined #ocaml
jeddhaberstro has joined #ocaml
Nutssh has quit [Read error: 60 (Operation timed out)]
jzmer has quit ["Leaving"]
jeddhaberstro has quit [Client Quit]
tmaeda is now known as tmaedaZ
tmaedaZ is now known as tmaeda
<BigJ> hey anyone around?
<orbitz> hi
ulfdoz has joined #ocaml
sporkmonger has joined #ocaml
sporkmonger has quit [Remote closed the connection]
sporkmonger has joined #ocaml
kaustuv_` has joined #ocaml
tvn2009 has quit ["Leaving"]
kaustuv_ has quit [Read error: 145 (Connection timed out)]
<BigJ> can anyone tell me the error in my code
<BigJ> let i = 1 in
<BigJ> let f = 2.3 and
<BigJ> let a = (float_of_int i) +. f
<BigJ> ;;
julm has joined #ocaml
<orbitz> BigJ: if you have 'and' you don't need let
<orbitz> and you are missing an 'in'
<BigJ> k let me try that again
ulfdoz has quit [Read error: 110 (Connection timed out)]
<orbitz> what are you tryign to accomplish?
<BigJ> define i to be 1 and f to be 2.5 and then do float_of_int on i, add the 2 floats then store the result in a variable and print it
<orbitz> let a = let i = 1 and f = 2.3 in float i +. f in Printf.printf "%d\n" a
<BigJ> a calls itself?
<orbitz> where?
<BigJ> sorry nm
<orbitz> or let i = 1 and f = 2.3 in let a = float i +. f in ...
<BigJ> i get confused between using in let or and
<BigJ> i'm not sure the difference
<orbitz> let this = that and bongo = mango
<orbitz> lets you define 2 variables in 1 let
<BigJ> can you define more than 2
<orbitz> sure, more and's
<BigJ> why do you need a seperate in let for a?
<orbitz> because you can't refrence values you bind in an and
<orbitz> they don't exist yet
<orbitz> let x = y and z = x + 1 in z
<orbitz> x doesn't exist yet, so you have to do another let
<BigJ> ahh because z is part of the function x?
<orbitz> there is no function x there
<BigJ> variable declaration
<orbitz> z references x, z is not part of x
<BigJ> it is inside the same scope
<orbitz> x is in z's scope, not the other way around
<BigJ> i just find it really confusing about how local variables work because I am used to writing a "method" or function and defining a variable inside that scope
<BigJ> in say C or java
<orbitz> C or Java have no real comparison I believe
<BigJ> ya that's the hard part nothing to really compare it to
<orbitz> it's not that complex of an idea though. let a = b and c = d in a + c
<orbitz> a and c do not exist until the 'in'
<orbitz> so c cannot reference a before it exists
ttamttam has joined #ocaml
<orbitz> so let a = b and c = a + d in a + c wouldn't work, a doesn't exist when c is being bound
<BigJ> k I'll have to think it over and do some more reading. thanks for the info
sporkmonger has quit []
<ski_> BigJ : also consider
<ski_> let a = a + b and b = a * b in ..a..b..
<ski_> or
<ski_> let a = b and b = a in ..a..b..
<ski_> (both those assume you already have an `a' and a `b' in scope)
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
f[x] has joined #ocaml
yurug has quit ["KVIrc Insomnia 4.0.0, revision: , sources date: 20090115, built on: 2009/03/07 02:39:30 UTC http://www.kvirc.net/"]
Alpounet has joined #ocaml
verte-work has quit ["~~~ Crash in JIT!"]
clank has joined #ocaml
<clank> Is it possible to make records that share parameters? for example, I can't seem to create a point2d after defining point3d: type point2d = {x:float; y:float} type point3d = {x:float; y:float;z:float} ;;
<clank> share parameter names, i mean
<Alpounet> even if you annotate which type you want explicitly ?
<clank> sorry, how do I do that? (I'm very new)
julm_ has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
<Alpounet> let o = { x = 1.0, y = 2.0, z = 3.0 } : point3d
<Alpounet> or let o : point3d = { x = 1.0 etc }
<flux> well
<flux> it cannot be done
<flux> workarounds: type point2d = { x2d : float .. } etc
<flux> module Point2D = struct type t = {x : float .. } end
<flux> also, with objects that is possible
<clank> let a ={x = 3.0; y=4.0}:point2d;; gives me syntax error
<Alpounet> yeah
<Alpounet> it's wrong
<flux> the syntax would be ({ .. } :point2d), but it won't work anyway
<Alpounet> confused
<tab> clank: it's not possible with structure
<flux> there's a patch that would actually allow that, but it's for 3.00 and I suppose we'll never see in the mainline ocaml
<Alpounet> too much C++ kills C++, pissed of writing C++ all day long.
<clank> okay; I suppose something like this calls for objects/inheritance anyways
<tab> clank: what about just writing them differently and have a function that convert them to 3d/2d ?
<flux> clank, if you're dealing with lots of points, it may be more efficient to go with records
<Alpounet> I'd more likely manipulate them via make_point, translate, rotate, etc functions
<clank> tab: I'm just trying to get a grip on the typing system, i'm not actually writing a real program yet :-P
<Alpounet> exactly because of the record fields name collisions problems
<clank> is name collision between type variants a problem as well?
<Alpounet> actually
<clank> like type t1 = A|B type t2 = A|C;;
<flux> yes
<flux> one alternative in that situation is to use polymorphic variants
<Alpounet> if you write let foo = A
<Alpounet> how can the compiler decide which A you're dealing with
<flux> (but that's an advanced topic with its own problems, mainly with compiler error messages)
<clank> Alpounet: it seems to use the most recently defined type...
<Alpounet> in the toplevel
<Alpounet> right ?
<clank> ya
<flux> in any case, for a short demo, this works: type t1 = [ `A | `B ] type t2 = [ `A | `C ] let f () = `A
<Alpounet> IIRC, the compiler would raise an error.
<flux> in general I simply avoid using name constructor names
<flux> it can actually help the readability too, to prefix constructors with a short related tag, especially if you have other concepts that need to use similarly named constructors
<Alpounet> and anyway, A, B, C and so on are bad names :-)
_zack has joined #ocaml
verte has joined #ocaml
Yoric[DT] has joined #ocaml
Yoric[DT] has quit [Read error: 145 (Connection timed out)]
ikaros has joined #ocaml
<rwmjones> anyone got a readable intro to functional reactive programming of GUIs, pref. one that includes real code and doesn't spend pages talking about "signals" ?
Nutssh has joined #ocaml
Nutssh has quit [Client Quit]
ikaros has quit ["Leave the magic to Houdini"]
mishok13 has quit [pratchett.freenode.net irc.freenode.net]
_zack has quit ["Leaving."]
_zack has joined #ocaml
ikaros has joined #ocaml
julm has joined #ocaml
mishok13 has joined #ocaml
julm_ has quit [Read error: 145 (Connection timed out)]
<rwmjones> gildor:
<rwmjones> $ host mirror.ocamlcore.org
<rwmjones> ;; connection timed out; no servers could be reached
<gildor> rwmjones: ovh problem
<gildor> rwmjones: seems to be back online
<gildor> rwmjones: it also cuts my kimsufi connection
<gildor> exactly at the same time
<rwmjones> thanks
tmaeda is now known as tmaedaZ
<gildor> all: OVH (datacenter for ocamlcore.org) seems to have some network problems, don't know how long it will last
ertai has quit [Read error: 60 (Operation timed out)]
ertai has joined #ocaml
albacker has joined #ocaml
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
sgnb has quit [Remote closed the connection]
sgnb has joined #ocaml
_andre has joined #ocaml
bzzbzz has quit [Remote closed the connection]
bzzbzz has joined #ocaml
Yoric[DT] has joined #ocaml
komar_ has quit [Read error: 110 (Connection timed out)]
verte_ has joined #ocaml
<rwmjones> cduce is driving me mad
<gildor> rwmjones: what is the problem
<gildor> ?
<rwmjones> gildor, I'm trying to get that perl code translated into cduce -- see caml-list
<rwmjones> into ocamlduce rather
<kaustuv_`> rwmjones: what happens if you just Obj.magic it to whatever type you need?
<kaustuv_`> (Don't tell anyone I suggested this.)
verte has quit [Read error: 110 (Connection timed out)]
<rwmjones> it'll almost certainly crash
<kaustuv_`> so it's not a phantom type issue then?
kaustuv_` is now known as kaustuv
<kaustuv> I'm a total ocamlduce noob, but the examples on http://www.cduce.org/examples.html don't appear to use match ... with
kaustuv_ has joined #ocaml
verte_ has quit ["~~~ Crash in JIT!"]
<kaustuv_> what is the difference between using match ... with and giving something that looks like a type and omitting match ... with?
<kaustuv_> rwmjones: look at the example on page 7 of ftp://ftp.di.ens.fr/pub/users/castagna/padl05.ps.gz that uses transform ... with instead of match ... with
komar_ has joined #ocaml
<orbitz> kaustuv_: hi
<rwmjones> that's cduce, not ocamlduce
<orbitz> hi rwmjones
<orbitz> rwmjones: = richard jones?
<kaustuv_> rwmjones: ah, I see. I presume you've already read http://www.cduce.org/ocaml_manual.html#transl ?
<rwmjones> ? I've no idea how that is relevant
<kaustuv_> Sorry, never mind, I've obviously no clue about ocamlduce.
kaustuv has quit [Read error: 110 (Connection timed out)]
<gildor> rwmjones: ocsigne guy could help you
<gildor> rwmjones: have you asked sgnb ?
willb has joined #ocaml
<rwmjones> sgnb, ping?
<rwmjones> I think _zack hit the nail on the head there
<_zack> rwmjones: eh
<rwmjones> in your reply to that thread on caml-list
<_zack> rwmjones: yup, trying to look at the issue from the point of view of a non caml regular was a bit, err, surreal
<_zack> actually, once upon a time there was an initiative to standardize tree-based XML access interfaces across different OCaml libraries
<_zack> it seems to me that XPath (1.0) can easily be implemented on top of that
<_zack> but the initiative probably died away
Alpounet has quit ["Page closed"]
sporkmonger has joined #ocaml
nnyby has quit [Remote closed the connection]
<kaustuv_> There has to be a friendlier way to do this in ocamlduce: http://ocaml.pastebin.com/d18ba564a
ikaros has quit [Remote closed the connection]
nnyby has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
komar_ has joined #ocaml
<orbitz> surely ocamlduce shoudl be implemented as a caml4p?
<thelema> orbitz: maybe it needs type info
BigJ2 has joined #ocaml
<BigJ2> I am wondering how I can create a function float * float -> string
<thelema> BigJ2: let ffs f1 f2 = Printf.sprintf "(%f,%f)" f1 f2
<Yoric[DT]> ocamlduce has a type system more powerful than that of OCaml
<Yoric[DT]> It couldn't be implemented on top of Camlp4.
<kaustuv_> Success, but not sure I like the result: http://ocaml.pastebin.com/d64b12f30
<orbitz> Yoric[DT]: interesting
<kaustuv_> OCamlDuce actually has more of a set system than a type system
<Yoric[DT]> Well, it's a type system with union, intersection and sets.
<Yoric[DT]> s/sets/singleton sets/
<orbitz> would one actually use ocamlduce in the real world? sticking to an ocaml dist just for XML processing seems horrifying
<Yoric[DT]> But without functions.
<Yoric[DT]> (i.e. no functions in these sets)
<_zack> rwmjones: gotcha, Gerd has an xpath evaluator on top of xpath, too bad concrete syntax is still missing
<kaustuv_> It seems that unless I want to go mad with x-type expressions, I have to re-ify the schema of the XML document as XML types.
<BigJ2> thelema: how do I import Printf to the interpreter?
derdon has joined #ocaml
<orbitz> the REPL? it's already accessable
<rwmjones> is orbitz a bot?
<Yoric[DT]> Not that I know of.
<thelema> rwmjones: orbitz just has less lag than you. and doesn't sleep.
<orbitz> crap, thelema's onto me
<thelema> :)
<orbitz> I have a confession to make
<orbitz> i'ma ctually...
<orbitz> from the future!
* thelema is from the past
<orbitz> In this future, Ocaml is the only language anyone writes code in.
<thelema> orbitz: no billandtedding the channel.
<orbitz> thelema: i'm here to collect you
* thelema hopes ocaml of the future is much better than ocaml now.
* Yoric[DT] hopes in the future, everyone writes code in OPA but the few people who don't write code in OPA write code in a much improved OCaml.
<orbitz> haah
<Yoric[DT]> Just to make everyone happy :)
<orbitz> Yoric[DT]: anything we can see on OPA? (OPA is your project right?)
<Yoric[DT]> Not quite yet / Yes.
<orbitz> Yoric[DT]: but i'm from the future, so clearly I've alrady seen OPA. no harm in showing me :)
<Yoric[DT]> :)
derdon has quit []
<Yoric[DT]> Just know that it's shaping up nicely, I'm happy with what we're doing but the code still needs much cleanup and testing before we can release 1.0 .
<kaustuv_> What is OPA?
<kaustuv_> (besides an ingredient in some form of chemical weapon...)
sporkmonger has quit []
kaustuv_ is now known as kaustuv
<hcarty> kaustuv: A language Yoric[DT] is working on at his new place of employment
<kaustuv> hcarty: I inferred as much, but I am curious what it is. MLState's web-site does not explain much about exactly what they do.
<hyperboreean> hey guys where can I find some networking code written in OCaml?
<orbitz> ocamlnet project
<hyperboreean> ok, so that is the library that is used for networking in OCaml?
<orbitz> it is a library
<kaustuv> 'Networking' can mean lots of different things. Do you want low level socket API stuff, high level protocols, or do you want CGI/specialized web servers?
<hyperboreean> kaustuv: basic stuff for now, I think socket level will do
<hyperboreean> ocaml has support in the Unix module for that, right?
<kaustuv> Yes
<hyperboreean> ok
<hyperboreean> thanks
<hyperboreean> so, some tiny examples of how to do it are available somewhere?
komar_ has quit ["WeeChat 0.2.6.3-ohshi"]
<hcarty> kaustuv: It sounds like the language is similar to OCaml, but with a more advanced type system.
<Camarade_Tux> mldonkey/unison for some definition of "tiny examples" :D
<hcarty> kaustuv: I'm not a CS person, so I don't know the details of what would make up a "more advanced type system" :-)
komar_ has joined #ocaml
<kaustuv> hcarty: I think the 'P' in the acronym and Yoric's background suggests that it might be more than just a type system. Possibly involves process/pi-calculus in some way
<Yoric[DT]> Well, the P in the calculus is completely unrelated.
<Yoric[DT]> But, yes, my background suggests well :)
<Yoric[DT]> It's a programming language designed for web programming.
<Yoric[DT]> The core is functional + concurrent.
* Camarade_Tux wonders where Smerdyakov is :P
<Yoric[DT]> :)
<kaustuv> Were you present for Adam's DEFUN demo/tutorial/advertisement?
<Yoric[DT]> Yep.
<Yoric[DT]> We even went for dinner afterwards with Adam and a few others :)
<Yoric[DT]> (and yes, we're both aware that we have common objectives for our respective languages)
ttamttam has quit ["Leaving."]
<Yoric[DT]> Anyway, no more details until we have a release.
<Yoric[DT]> Which should be soonish.
<Yoric[DT]> On these words, by everyone.
<Yoric[DT]> On these words, bye everyone.
Yoric[DT] has quit ["Ex-Chat"]
onigiri has joined #ocaml
smimou has joined #ocaml
ski_ has quit ["Lost terminal"]
Snark has joined #ocaml
<BigJ2> what is wrong with this statement?
<BigJ2> let direction (x,y) =
<BigJ2> let b = print_string ("hello") ;;
<Camarade_Tux> the construct is "let X = ... in"
<Camarade_Tux> let b = ...;; would be useless, you're getting the result of print_string, storing it but you would never be able to doa nything with that
<BigJ2> I am trying to create a function float * float -> string. so for the float * float part it has to be a tuple?
<Camarade_Tux> you could have float -> float -> string
<BigJ2> yes but that is different to float * float -> string is it not?
<Camarade_Tux> let direction x y = Printf.printf "%s ; %s\n" x y
<Camarade_Tux> BigJ2: it is
<BigJ2> the first one is a pair and the second one is 2 seperate expressions?
<Camarade_Tux> BigJ2: why do you need x and y ? why not just one value?
<hcarty> BigJ2: print_stringis string -> unit, so you are not returning a string here even if you get rid of the inner "let .. ="
* Camarade_Tux will just pretend he used sprintf instead of printf :D
<BigJ2> because I am creating a program that takes a "x" and "y" co-ordinate
<hcarty> Camarade_Tux: :-)
<BigJ2> the requirement is that the function be in the form float * float -> string
<Camarade_Tux> tuple then
<hcarty> Homework?
Alpounet has joined #ocaml
<BigJ2> i am just confused because when I plugged let direction (x,y) = print_string "hello" it returned unit
<BigJ2> unit();
<BigJ2> into the interpreter that is
<hcarty> Right
<Camarade_Tux> it's as hcarty told you: print_string writes to the terminal, it doesn't return a string
<BigJ2> ahh i see
<Camarade_Tux> you would use one of : (^), String.concat, Printf.sprintf
<hcarty> BigJ2: For issues like this, try typing each part individually in to the toplevel to see the types
<hcarty> BigJ2: That can be a huge help in tracking down type issues
<BigJ2> ya that's how I managed to figure out how to use a tuple
ikaros has joined #ocaml
_zack has quit ["Leaving."]
onigiri has quit []
gim has quit ["moving..."]
BigJ2 has quit []
bzzbzz has quit [Remote closed the connection]
Amorphous has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
<albacker> my_list.(i) is same as (List.nth my_list i) ?
Amorphous has joined #ocaml
<thelema> lists don't have direct acces syntax
<albacker> well List.nth does give me the n-th element of my_list doesn't it ?
<mfp> don't tell anybody... module Array = List .... somelist.(n) :-P
<Alpounet> yeah
<albacker> what do you mean by direct access syntax? like arrays do?
<thelema> yes
<Alpounet> but my_list.(i) is invalid
<Alpounet> it only works on arrays
<albacker> oh :/
* albacker facepalms
<Alpounet> it has no sense for lists, since elements aren't contiguous in memory
<mfp> Alpounet: works on whatever Array.get happens to manipulate (see above)
<Alpounet> heh
<Alpounet> yeah
<Alpounet> but it wasn't the point I was talkin' about :-p
<albacker> ok a stupid question.. what's wrong here
<albacker> let rev my_list =
<albacker> let list2 = ref [] in
<albacker> for i=0 to (List.length my_list) do
<albacker> list2 := (List.nth my_list i) :: list2
<albacker> done;
<albacker> in rev [1;2;3;4];;
<albacker> i wrote it to reverse this list.
<albacker> i'm just exercising.. i could have done this recursively but i want to see the loop version first.
<thelema> your rev returns a list ref
<albacker> true
gim has joined #ocaml
<albacker> if i change list2 with !list2 it still doesnt work
<albacker> exception, failure nth :/
<albacker> first time i encounter smth like this..
ulfdoz has joined #ocaml
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb has joined #ocaml
<Alpounet> rev returns unit, I think
maskd has quit [pratchett.freenode.net irc.freenode.net]
noj has quit [pratchett.freenode.net irc.freenode.net]
mfp has quit [pratchett.freenode.net irc.freenode.net]
patronus has quit [pratchett.freenode.net irc.freenode.net]
bacam has quit [pratchett.freenode.net irc.freenode.net]
ozzloy has quit [pratchett.freenode.net irc.freenode.net]
churchill has quit [pratchett.freenode.net irc.freenode.net]
Mr_Awesome has quit [pratchett.freenode.net irc.freenode.net]
<thelema> 0 to length - 1
<thelema> albacker: your loop goes one too long
<albacker> yep, thankyou
<Alpounet> you should put a "!list2" after "done;"
Asmadeus_ has joined #ocaml
<albacker> yes :)
Camarade1Tux has joined #ocaml
<albacker> ok recursive one now..
<albacker> rec. should ead less memory then the loop-one i think since we're dealing with lists?
Asmadeus has quit [Read error: 104 (Connection reset by peer)]
<albacker> doing List.nth we should go til the i-eme element of the list, and that in a loop.. thats too much for big lists.. right?
Camarade_Tux has quit [Read error: 113 (No route to host)]
maskd has joined #ocaml
<hcarty> albacker: Perhaps not less memory, but less time.
<thelema> yes, it's a lot of work scanning to the last element of a list
Yoric[DT] has joined #ocaml
noj has joined #ocaml
mfp has joined #ocaml
patronus has joined #ocaml
Mr_Awesome has joined #ocaml
bacam has joined #ocaml
churchill has joined #ocaml
ozzloy has joined #ocaml
ofaurax has joined #ocaml
ztfw has joined #ocaml
BigJ2 has joined #ocaml
<BigJ2> how would I do multiple if statements?
<BigJ2> let direction (x,y) =
<BigJ2> let a = "direction (" ^ (string_of_float x) ^ "," ^ (string_of_float y) ^ ")" in
<BigJ2> if x = 0.0 && y = 0.0 then print_string (a ^ " = no direction\n") else() in
<BigJ2> if x = 0.0 && y < 0.0 then print_string (a ^ " = south \n") else () ;;
<orbitz> but the enxt if int he else
<orbitz> which is all an else if is
<orbitz> i woul write that with a function though
<BigJ2> put the next if in the else?
<orbitz> let direction = function (x, y) when x = 0.0 && y = 0.0 -> Pritnf ...
<orbitz> BigJ2: that is what you wan to do right?
<orbitz> btw, comparing floats for equality is almost always a bad idea
<BigJ2> i would be better to use pattern matching?
<orbitz> i would
<BigJ2> ya I plan to, i just don't know how to implement it
<orbitz> hrm in ooking at yoru code again, I wouldn't use function like i did, since youw ant teh 'a' there. let direction v = let a = Pritnf.sprintf .... in match v with (x, y) when .... -> ... | (x, y) when ... -> ...
<thelema> let dir = function (0., y) when y > 0. -> "north" | (0.,y) -> "south" | (x,0.) when x > 0. -> "east" | (x,0.) -> "west" | _ -> "not a cardinal direction"
<BigJ2> thelema why do you have function (0., y) instead of function (x,y)
<thelema> what direction is 2,3?
<BigJ2> north east
<thelema> okay, add [ | (x,y) when x > 0 && y > 0 -> "northeast" ]
<orbitz> thelema: ohh, how about doing each x and y speratly and composing!
<thelema> match (sign x, sign y) with ...
<orbitz> BigJ2: let x = 0.0 and y = 0.1 in match (x, y) with (0., y) -> "mmmbop" | _ -> "fail" what happens?
<BigJ2> i suppose it should print north
<orbitz> what should?
<orbitz> my example has no "north" in it
f[x] has quit [Read error: 60 (Operation timed out)]
<BigJ2> orbitz: are u asking me what would be returned by your expression?
<orbitz> yes
<BigJ2> "mmmbop"
<orbitz> do you see why thelema had (0., y) isntead of (x , y)?
<BigJ2> so that it only handles the y co-ordinates?
<Alpounet> it matches the x with 0.
<Alpounet> match (x, y) with (0., y) means that to enter the (0., y) case, (x,y) must be of the form (0., y), that is x must be equal to 0.
<Alpounet> (for y, we don't care)
<BigJ2> so whenever it matches x to 0 it then just checks the y value?
<orbitz> in the sepcific example Alpounet just gave it does nto check y at all
<orbitz> BigJ2: can you describe pattern matching to me? (don't worry about how correct you are, just want to see how you understand it then we can correct any place you misunderstand)
<Alpounet> actually
<Alpounet> it'd be clearer to put another letter instead of y
<Alpounet> match (x, y) with (0., idontcareaboutthisvalue)
<orbitz> _ !
<Alpounet> (yeah, let's go slowly IMO)
<orbitz> i think a different examle all together might be helpful to BigJ2 to understand pattern matching
tylermac has joined #ocaml
<BigJ2> so you are putting the x value to match to 0 and then providing the conditions for when it is either greater or less than zero it is either east or west?
<hcarty> I would like to request testers for the latest PLplot Subversion revision, now with Super OCaml Gtk+ Powers (tm)
Mr_Awesome has quit [Read error: 104 (Connection reset by peer)]
Mr_Awesome has joined #ocaml
<Alpounet> hcarty, what's new ?
<hcarty> The requirements are: CMake 2.6.0 or later, OCaml 3.x (tested with 3.10.x and 3.11.x, should work with earlier) and lablgtk2 + Cairo-OCaml if you want the GUI goodness.
<hcarty> Alpounet: The new bits are a more OCaml-like and high-level set of plotting interfaces and the ability to provide your own Cairo surface to plot on, and with that embed plots in lablgtk apps.
<Alpounet> hcarty, you just want people to check if things compile & run well ?
<hcarty> Alpounet: Yes, if you have time.
<Alpounet> let me install the missing stuffs and I'll do that.
<Alpounet> damn, cairo-ocaml isn't packaged on my distro :(
<hcarty> Ah, drat.
<hcarty> Alpounet: What distro?
<Alpounet> arch
<Alpounet> I'm testing it, for some days now.
<Alpounet> but I'll find a way to get cairo-ocaml
<Alpounet> I can compile it myself if necessary.
<hcarty> I'm planning to try out the just-released Chakra Arch livecd/liveusb later this evening if I have time.
<hcarty> Alpounet: Thank you! I really appreciate it.
<hcarty> It does require that Cairo-OCaml is findable by findlib.
<Alpounet> hcarty, I find arch to be very satisfying for the kind of use I make of a Linux system.
<Alpounet> hmm
BigJ2 changed the topic of #ocaml to: #ocaml
<BigJ2> whoops
<BigJ2> sorry
<BigJ2> was trying to read the topic....
Alpounet changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
<Alpounet> (wasn't this channel registered, etc ?)
<BigJ2> this is what I came up with ..... http://www.pastebin.org/30929
<Alpounet> hcarty, which version of Cairo-OCaml ?
<hcarty> The latest snapshot, which is roughly 1.2
<hcarty> BigJ2: Aside from some type issues, that looks reasonable
ulfdoz has quit [Read error: 110 (Connection timed out)]
ttamttam has quit ["Leaving."]
<hcarty> Alpounet: And then the META file from Debian, Fedora or GODI
<Alpounet> hmm
<Alpounet> it'll be hard to fine
<Alpounet> find*
<Alpounet> but I'll manage :-)
<hcarty> Alpounet: I'll dig it out :-)
<Alpounet> copied in cairo-ocaml-master/
<hcarty> I think it should end up wherever Arch puts the other META files... but I have not used Arch's OCaml packages to know how they work.
<Alpounet> /usr/lib/ocaml/site-lib/camlp4/META and so on
<hcarty> Ok, then it should probably just go in /usr/lib/ocaml/site-lib/cairo/META
<Alpounet> cairo-ocaml compiling
<hcarty> And hopefully findlib will magically know it's there :-)
<Alpounet> finished compiling
slash_ has joined #ocaml
<Alpounet> actually, I have to do it by hand
<Alpounet> but it's not an issue :)
<hcarty> :-)
<hcarty> I'm hoping to be able to give the upstream Cairo-OCaml some development love soon
<Alpounet> :)
<Alpounet> ok
<Alpounet> cairo-ocaml shoud be installed
<hcarty> Particularly now that it is packaged for each of the Big Three (Debian, Fedora and GODI).
<Alpounet> ocamlfind list
<Alpounet> [...]
<Alpounet> cairo (version: n/a)
<Alpounet> cairo.lablgtk2 (version: n/a)
<Alpounet> n/a :s
<hcarty> Yes, that's one of the things I'd like to address by adding META upstream :-)
<Alpounet> anyway, I'll now try to build plplot
<hcarty> Alpounet: http://ocaml.pastebin.com/m72c72a98 -- those are the basic steps
<hcarty> Followed by "make" or "make -j 3" if you have a multi-core/cpu system.
<Alpounet> by $PLPLOT_SRC you mean the src/ subdir of your archive, right ?
<hcarty> Alpounet: No, src/../
<Alpounet> ok
<hcarty> Alpounet: CMake is kind of odd at first, but it does have the benefit of keeping the source tree clean.
<hcarty> Similar to ocamlbuild's _build directory.
<Alpounet> [100%] Built target test_dyndrivers
<hcarty> From the build directory, "cd examples/ocaml/"
<Alpounet> damned, just figured out it hasn't taken the ENABLE_ocaml option in account
<hcarty> cmake.out should have some information on why. Can you pastebin it?
<Alpounet> yep
<Alpounet> -- WARNING:camlidl not found. Disabling ocaml bindings
<Alpounet> probably because of that
<hcarty> Ah, yes - sorry, I forgot that requirement
<Alpounet> I don't know 'ocamlidl'.
<Alpounet> any hint ?
<hcarty> camlidl is a C -> OCaml binding generator, kind of like SWIG but OCaml-specific and it generates better/cleaner code than SWIG.
babyGreeve has joined #ocaml
babyGreeve has quit [Remote closed the connection]
<hcarty> If I do end up using Arch for any length of time I'll have to add camlidl and cairo-ocaml to AUR :-)
<Alpounet> yep
<Alpounet> and me to learn ocaml lib packaging...
<Alpounet> I guess I'll have to invent a META for it :-p
derdon has joined #ocaml
<hcarty> Alpounet: No, not for camlidl :-)
<hcarty> The "camlidl" binary just needs to be in your $PATH
<hcarty> Wait, that's not completely true
<hcarty> libcamlidl.a is a build-time requirement
<hcarty> for PLplot
BigJ2 has quit []
<hcarty> "make install" should take care of that though.
<Alpounet> yeah
<Alpounet> just a system path to modify
<Alpounet> damn ...
onigiri has joined #ocaml
<hcarty> What the current issue?
<hcarty> camlidl doesn't have the most modern build setup, unfortunately.
<Alpounet> OCAMLLIB
<Alpounet> what is it supposed to be ?
<hcarty> It apparently requires manual editing of at least one of the Makefiles involved
<Alpounet> /usr/lib/ocaml/site-lib/ ? /usr/lib/ocaml/ ? none works.
<hcarty> OCAMLLIB should picked up automatically
<hcarty> It takes the value from `ocamlc -where`
<Alpounet> it doesn't :/
<Alpounet> # Location of the Objective Caml library in your installation
<Alpounet> OCAMLLIB=/usr/lib/ocaml/site-lib/
<Alpounet> I'll replace it with that
<Alpounet> it is okay now
<Alpounet> they could have put that...
<hcarty> Oh, is this in camlidl?
<Alpounet> anyway, let's return to plplot's install :-p
<hcarty> Sorry - I thought you were asking about the PLplot config :-)
<Alpounet> yeah, it is in camlidl ...
<hcarty> You'll have to clean out the build/ directory and run "cmake ...." again
<Alpounet> ok now ocaml is activated
<hcarty> Did it find Cairo and lablgtk?
<Alpounet> ocamlfind: Package `lablgtk2' not found - Required by `cairo.lablgtk2'
<Alpounet> hmm
<Alpounet> could you give me your lablgtk2 META ? :-p
rwmjones has quit [Read error: 113 (No route to host)]
<Alpounet> Error: Cannot find file /usr/lib/ocaml/site-lib/lablgtk2/lablgtksourceview.cma
<Alpounet> is it a problem ? :-(
<hcarty> Well, it means that some of it built, apparently :-)
<Alpounet> -- lablgtk2 OCaml library found
<Alpounet> OTOH :-)
<hcarty> Yeah ... it shouldn't need lablgtksourceview.cma
<Alpounet> ok, cairo found to
<hcarty> Oh, remove the mentions of lablgtksourceview from the META file
<hcarty> The lablgtk2 META file
<hcarty> Apparently GODI adds it all in one place. I don't know if it's different for other versions of the file.
<Alpounet> done
<Alpounet> I'm in examples/ocaml
<hcarty> Does it have executables in there? Hopefully xgtk_interfaceocaml as one of them?
<Alpounet> only Makefiles/CMakefiles
<hcarty> What was your cmake commandline?
Yoric[DT] has quit ["Ex-Chat"]
<Alpounet> there was -DBUILD_TEST=ON
<hcarty> Oh - are you in build/examples/ocaml/ or examples/ocaml/ ?
<Alpounet> buiild/
<Alpounet> ok
<Alpounet> got it
* Alpounet ashamed
<hcarty> What happened?
<Alpounet> hmm
<Alpounet> no
<Alpounet> I thought the right one was build/../examples/ocaml
<Alpounet> but it isn't
<hcarty> No, they should be in build/examples/ocaml
<Alpounet> -- Cairo OCaml library found
<Alpounet> File "test_gtk.ml", line 1, characters 0-1:
<Alpounet> Error: Cannot find file /usr/lib/ocaml/site-lib/lablgtk2/lablgtksourceview.cma
<Alpounet> in cmake.out
<hcarty> Ok, the lablgtk2 META file needs to be edited and then everything under build/ deleted and them cmake re-run
<Alpounet> the META has been edited
<Alpounet> I'll re-delete everything and all
<hcarty> Yes, CMake caches a lot of things and I'm not sure how to override them
_JusSx_ has joined #ocaml
<Alpounet> still no binaries in build/examples/ocaml/
<hcarty> Can you pastebin or email me cmake.out?
<Alpounet> yep
<hcarty> Thank you very much for your time on this!
<Alpounet> wait
<Alpounet> there was a *tiny* problem in my META file actually
<Alpounet> (lablgtk2 one)
<Alpounet> it's make-ing right now
<Alpounet> yay it builds ocaml-related binaries :p
<hcarty> :-)
<hcarty> (Partial) Victory!
<Alpounet> and now ? :)
<hcarty> Are there binaries in build/examples/ocaml/?
<hcarty> A bunch of x*ocaml files
<Alpounet> yeah
<hcarty> Hooray! Run one ... ./x01 is a good start
<Alpounet> I tested x01ocaml
<Alpounet> it works perfectly
<hcarty> I recommend xcairo as a good output device from the menu it gives
<hcarty> Sorry, ./x01ocaml
<Alpounet> nice postscript output :-)
<hcarty> Excellent :-)
<Alpounet> damn
<Alpounet> the cairo one is excellent !
<hcarty> And ./xgtk_interfaceocaml?
<hcarty> Isn't it though? :-)
<Alpounet> but when I exit it, it tells me : XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
<Alpounet> after 31 requests (31 known processed) with 0 events remaining.
<hcarty> http://plplot.sourceforge.net/examples.php gives an overview of each example
<Alpounet> wow, the earth in GTK+
<hcarty> Ah, that happens if you close the window rather than pressing enter or right-clicking on the plot.
<Alpounet> heh
<Alpounet> but you (& others, I guess ?) did a very good job
<hcarty> The "closing the xcairo window crashes the plot/application" is a bug that is on the TODO list... I'm not very familiar with the internals of X.
<Alpounet> I'm taking a look at the examples' OCaml code
<hcarty> Thanks. PLplot has been around for a while, at least 1992. I provided the OCaml portion (bindings, examples, etc) and have contributed other pieces to the core of the library.
<hcarty> The examples are not the most idiomatic OCaml. They are converted directly from the C examples, so they have a very C-like flavor.
<Alpounet> yeah
<Alpounet> anyway
<hcarty> xplot01.ml and xgtk_interface.ml should be a bit better
<Alpounet> it provides the given features directly in OCaml
<hcarty> And it plays nicely with the toplevel, which is handy.
<Alpounet> indeed !
<hcarty> Thank you again for the testing. I'm happy to hear that it works somewhere other than on my system :-)
<Alpounet> we should now ask the guy who worked on the OCaml profiling tool to take plplot-ocaml as its main plotting library :D
<hcarty> I may do that, though I don't know if they'd want to add the dependency :-)
<Alpounet> they'll have to make a choice
<hcarty> At some point when I'm feeling adventurous I'll try to add a GODI package for PLplot.
<Alpounet> nice plots or little dependencies :-p
<Alpounet> wow, good luck
<hcarty> Yes, the GODI package will likely not be for a while:-)
<Alpounet> it'd be worth a GODI packaging sprint just for it
<hcarty> All the OCaml prerequisites are there in GODI now, thankfully.
<Alpounet> but again, awesome work !
Snark has quit ["Ex-Chat"]
<hcarty> Thank you! I think I'll post it to the list soon for a general request for testing and comments on the API.
_andre has quit ["leaving"]
tylermac has left #ocaml []
<Alpounet> yep
<Alpounet> is there any tutorial somewhere ? or "just" the documentation ?
<hcarty> Just the documentation and examples for now.
<hcarty> I have the start of a simple tutorial in the documentation
<Alpounet> ok good
<Alpounet> people may like that
<Alpounet> just a little introductory material
<hcarty> Yes, I want to the latest documentation and the ocamldoc reference online before I post to the list.
<Alpounet> ok !
<Alpounet> any other thing you'd like me to test ?
<hcarty> The toplevel?
<hcarty> If you have time
<hcarty> http://ocaml.pastebin.com/m3ebc973a -- you may need to add these to your environment, depending on where/if you installed PLplot
<hcarty> If you didn't install it, then running the toplevel from build/bindings/ocaml/ should allow you to load "plplot.cma"
<hcarty> Alpounet: I've never used org-mode - I'm generally using vim - but that link looks interesting.
<Alpounet> yes :)
<Alpounet> ok, exports done
<Alpounet> tell me a function I can call
<Alpounet> :)
<hcarty> "#require "plcairo";;" from the toplevel, and then "module P = Plcairo;;" is a decent first test
<hcarty> That should pull in both the core PLplot library and the Cairo-specific interface
<Alpounet> it doesn't know #require :/
<hcarty> Ah
<hcarty> "#use "topfind";;" first
<hcarty> Then "#require "plcairo";;" then "Plplot.plinit ();;"
<Alpounet> haha
<Alpounet> it works
<hcarty> Woo-hoo!
<Alpounet> it asks me the output format
<Alpounet> etc
<hcarty> Excellent
<hcarty> That's exactly what it should do :-)
<Alpounet> haha
<Alpounet> good job ! :)
* hcarty does a dance in celebration
<Alpounet> *put your hands up, put your hands up*
flux has quit [pratchett.freenode.net irc.freenode.net]
flux has joined #ocaml
<hcarty> Interesting ... the latex output eats underscores from the PLplot documentation (docbook sources)
<Alpounet> hmm
albacker has quit ["Leaving"]
<hcarty> So "some_example" comes out as "some example" in the PDF output.
<hcarty> But only in some cases :-)
BigJ2 has joined #ocaml
<Alpounet> ok
<Alpounet> not a huge problem to solve I guess :)
<hcarty> No, I'm working on it now
sctb has joined #ocaml
<hcarty> They are all function or module names, so I'm just wrapping them in known-ok formatting.
<hcarty> Alpounet: Once I have this built, would you be interested in commenting on the OCaml portion of the docs?
sctb has left #ocaml []
<Alpounet> yeah, absolutely
_JusSx_ has quit ["leaving"]
<derdon> what is the best way to "unpack" a list or array? I can do ``let (a,b,c) = foo;;`` if foo is a tuple, but that's neither possible with lists nor with arrays
komar_ has quit ["WeeChat 0.2.6.3-ohshi"]
<hcarty> derdon: You'll get a warning, but you can do the same thing - "let [a;b;c] = some_list"
<hcarty> or "let [|a;b;c|] = some_array"
<hcarty> derdon: It's an unsafe match though because you don't account for differently-sized arrays or lists.
<hcarty> derdon: So the compiler will warn about it.
<BigJ2> i am wondering how i can make this print http://pastebin.com/m34ac04f5
<derdon> hcarty: hm, looks like bad style with this warning. is there any better "ocaml-like" way?
<hcarty> Alpounet: http://0ok.org/ocaml/plplot/doc/core/ocaml.html -- the HTML version of the docs
<Alpounet> derdon, consider the whole array, indepently of its size
<hcarty> derdon: "let (a, b, c) = match l with | [a;b;c] -> (a, b, c) | _ -> failwith "Bad array!""
ofaurax has quit ["Leaving"]
<hcarty> ^^^^ that should be "Bad list!" I suppose.
<Alpounet> or, if you're really really sure the list will have a size of 3, and that the program hasn't any sense if not, then do like hcarty tells you
<Alpounet> but Array.iter, Array.map & friends are ... your friends :)
<derdon> I just use an assertion to make sure that the array has a length of 3 ... (not very good, I know)
<Alpounet> okay, then hcarty's way is fine
<hcarty> Alpounet: Out of curiosity - are running a 32 or 64bit kernel?
<Alpounet> 32
<Alpounet> I used to run a Debian 64... heh
<hcarty> Ok, thanks
<hcarty> :-)
<hcarty> I'm on 64bit. I wouldn't expect any trouble from that, but it's nice to know that there really isn't any.
<Alpounet> Heh.
<Alpounet> hcarty, http://0ok.org/ocaml/plplot/doc/core/ocaml_bindings.html, last paragraph : Plplot.Plot and Plplot.Quick_plot. Plplot.Plot provides a simlified naming scheme => sim*p*lified
<hcarty> Alpounet: Ah, thanks!
<hcarty> I'm glad I haven't pushed my doc changes upstream yet :-)
<Alpounet> heh
<Alpounet> nothing else noticed here in the doc
<Alpounet> they're fine ;)
<hcarty> Alpounet: Thank you very much for the proof-read and comments
<hcarty> The intro and various examples seem reasonably clear to you?
<Alpounet> yes !
<Alpounet> anyway, once officially published, there'll be blog posts etc about it
<Alpounet> but yeah this is clearly enough to start playing with it
<hcarty> Alpounet: Interesting side note - "simlified" does not trigger vim's spell check.
<hcarty> Wonderful, thanks
<hcarty> No, nevermind
<hcarty> It does, just not in the mode I was in.
BigJ2 has quit []
<myst> how is it possible to curry (<= x)? Because ((<=) x) equals (x <=).
<hcarty> myst: You'll need to use something like (fun x y -> y <= x)
jeddhaberstro has joined #ocaml
<hcarty> myst: Or use bluestorm's pa_holes or an equivalent extension -- http://bluestorm.info/camlp4/pa_holes.ml.html
BigJ2 has joined #ocaml
kaustuv_ has joined #ocaml
<hcarty> Alpounet: http://0ok.org/ocaml/plplot/doc/plplot/ -- the ocamldoc API reference
<hcarty> Alpounet: (not that you have to read it! Just in case you have an interest in the library beyond testing :-))
kaustuv has quit [Read error: 110 (Connection timed out)]
derdon has quit []
<Alpounet> hcarty, this is a bit late for tonight, but I should play a bit with it. It could be fun actually, for my articles/college reports/etc
<Alpounet> thanks !
<Alpounet> bookmarked :)
<hcarty> Alpounet: You're quite welcome, and thank you as well. You got mention in the commit message with the spelling error fixes :-)
<Alpounet> heh, thanks ;)
<hcarty> Alpounet: http://plplot.sf.net is the one to track long-term. I'm hoping to find a way to include the ocamldoc-generated documentation in the general PLplot documentation build process.
<Alpounet> myst, or use a function like : let flip f x y = f y x ;; then currying <= x becomes : flip (<=) x
<Alpounet> hcarty, good luck, doesn't look like an easy task !
* Alpounet really misses mlbot
<hcarty> Alpounet: Indeed - who was working on that?
<Alpounet> me
<hcarty> I remember rwmjones had xavierbot
<hcarty> Alpounet: Ah, of course :-)
<hcarty> My apologies!
<myst> Alpounet, thanks for the tip.
<Alpounet> but mlbot's code and binaries died altogether with my HD
<hcarty> Oh no - that's quite unfortunate.
<Alpounet> and I admit I'm kinda reluctant to put my nose again in these OCaml compiler modules (something like 25 were needed, IIRC, when building mlbot, and given in a precise order...)
<Alpounet> bringing xavierbot back looks easier :-p
<Alpounet> anyway, it's late here, gotta go.
<hcarty> Good night
<hcarty> Thanks again for the testing
<Alpounet> Good night and cheers hcarty
Alpounet has quit ["Leaving"]
jeddhaberstro has quit [Read error: 60 (Operation timed out)]
ztfw` has joined #ocaml
jeddhaberstro has joined #ocaml
ztfw has quit [Connection timed out]
thrasibule has joined #ocaml
BigJ2_ has joined #ocaml
BigJ2 has quit [Read error: 104 (Connection reset by peer)]
BigJ2_ is now known as BigJ2
slash_ has quit [Client Quit]
BigJ2_ has joined #ocaml
BigJ2 has quit [Read error: 104 (Connection reset by peer)]
BigJ2_ is now known as BigJ2
<BigJ2> orbitz: are you still around?
<hcarty> BigJ2: Someone else may be able to help if you have a question
BigJ2_ has joined #ocaml
BigJ2 has quit [Read error: 104 (Connection reset by peer)]
BigJ2_ is now known as BigJ2
<BigJ2> hcarty: I think I figured out pattern matching but I can't figure out how to print the return value I am guessing I need to store it in a variable?
<BigJ2> this is what I have come up wtih
<hcarty> BigJ2: Where do you define the function "direction"?
<orbitz> ugh
<orbitz> could you not usepastebin.org
<orbitz> it keeps on trying to install malware on me
<BigJ2> line 1
<BigJ2> ya sure what's a better one?
<orbitz> codepard.org is pretty good
<orbitz> codepad i mean
<mbishop> or paste.lisp.org