flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
Ariens_Hyperion has quit [Read error: 110 (Connection timed out)]
monadic_kid has quit ["Leaving"]
komar_ has quit [Read error: 104 (Connection reset by peer)]
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
jeanbon has quit ["EOF"]
Associat0r has quit [Client Quit]
Ched has quit [Read error: 60 (Operation timed out)]
Ched has joined #ocaml
jamii has quit [Read error: 110 (Connection timed out)]
Rotaerk has joined #ocaml
Rotaerk has left #ocaml []
hto has quit [Read error: 60 (Operation timed out)]
hto has joined #ocaml
sgnb` has joined #ocaml
sgnb has quit [Read error: 104 (Connection reset by peer)]
patronus_ has joined #ocaml
patronus has quit [Read error: 104 (Connection reset by peer)]
mogunus has quit [Remote closed the connection]
maskd has quit ["fs"]
jbapple has joined #ocaml
<jbapple> I'm having trouble with the debugger not recognizing bytecode, or not knowing how to generate it:
<jbapple> $ ocaml -version
<jbapple> The Objective Caml toplevel, version 3.10.2
<jbapple> $ ocamldebug -version
<jbapple> The Objective Caml debugger, version 3.10.2
<jbapple> $ ocamlc -g RecursivePerformance.ml
<jbapple> $ echo "step 0" | ocamldebug RecursivePerformance.cmo
<jbapple> Objective Caml Debugger version 3.10.2
<jbapple> (ocd) Loading program... /home/apple/debate/rating/RecursivePerformance.cmo is not a bytecode file.
<jbapple> (ocd)
<jbapple> $ file RecursivePerformance.cmo
<jbapple> RecursivePerformance.cmo: Objective caml object file (.cmo) (Version 006).
<flux> you should debug the binaries, not the object files
<flux> so, a.out in this case
<jbapple> no a.out is generated. I'm going to go look at the manual again to see how to specify "main", or whatever it's name is in OCaml
<jbapple> oh, there it is
<jbapple> THanks, flux
<flux> jbapple, usually you may want to specify the binary name with the -o -switch
<flux> jbapple, and if you have a bigger project, using a Makefile or ocamlbuild can be a helpful
<jbapple> It's just a small project for now
<jbapple> BTW, last I tried O'Caml (2002 or so), there was a GUI debugger
<jbapple> Is there still anything like that that is in wide use?
<jbapple> I found a few links, but nothing newer than 2005
<flux> I don't know, I haven't really looked
<flux> apparently cameleon2 has/is going to have something like that
<flux> apparently in a distant future, though :)
sgnb`` has joined #ocaml
sgnb` has quit [Read error: 104 (Connection reset by peer)]
<jbapple> Well, since the ocaml debugger can travel *backwards* in time, I'll just ask it to take me *forward* to a time when chameleon2 is feature-complete. :-)
jeddhaberstro has quit []
BiD0rD has joined #ocaml
BiDOrD has quit [Read error: 110 (Connection timed out)]
verte has joined #ocaml
rwmjones has joined #ocaml
verte_ has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
verte has quit [Read error: 60 (Operation timed out)]
kaustuv has quit [Read error: 113 (No route to host)]
Snark has joined #ocaml
Snark has quit [Client Quit]
totom has quit [Read error: 101 (Network is unreachable)]
totom has joined #ocaml
jbapple has quit ["Leaving."]
mpwd has joined #ocaml
jamii has joined #ocaml
Camarade_Tux has joined #ocaml
_zack has joined #ocaml
monadic_kid has joined #ocaml
mpwd has quit []
_zack has quit ["Leaving."]
itewsh has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Camarade_Tux has quit ["Leaving"]
xerxes has joined #ocaml
jedai has quit ["KVIrc 3.4.0 Virgo http://www.kvirc.net/"]
Camarade_Tux has joined #ocaml
Associat0r has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
Snark has joined #ocaml
jeanbon has joined #ocaml
itouch has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Yoric[DT] has joined #ocaml
itewsh has quit [Success]
jeremiah has joined #ocaml
itouch has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
xerxes has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
Jedai has joined #ocaml
BiD0rD has quit [Remote closed the connection]
mperillo has joined #ocaml
BiDOrD has joined #ocaml
Camarade_Tux has quit ["Quitte"]
Camarade_Tux has joined #ocaml
mpwd has joined #ocaml
Camarade_Tux has quit ["Quitte"]
verte has joined #ocaml
verte_ has joined #ocaml
Camarade_Tux has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
maskd- has joined #ocaml
maskd- is now known as maskd
verte_ has joined #ocaml
verte has quit [Read error: 60 (Operation timed out)]
verte_ is now known as verte
_zack has joined #ocaml
Smerdyakov has joined #ocaml
jeanb-- has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
mpwd has quit [Read error: 104 (Connection reset by peer)]
angerman has joined #ocaml
monadic_kid has quit ["Leaving"]
verte_ has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
mpwd has joined #ocaml
verte_ has joined #ocaml
verte has quit [Nick collision from services.]
verte_ is now known as verte
seafood has quit [Connection timed out]
verte has quit [Read error: 110 (Connection timed out)]
ztfw has quit [Remote closed the connection]
ztfw has joined #ocaml
monadic_kid has joined #ocaml
dejj has joined #ocaml
<flux> finally I have a use case for bitstring, get to try it out
mpwd_ has joined #ocaml
mpwd has quit [Read error: 110 (Connection timed out)]
dejj_ has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
dejj has quit [Read error: 110 (Connection timed out)]
ztfw has quit [Remote closed the connection]
ztfw has joined #ocaml
jeremiah has joined #ocaml
<flux> hmm, is it my bug, or is having a tail recursing parser non-trivial with bitstring?
<flux> I'm recursing from within the bitmatch expression and my stack blows
<Smerdyakov> Switch to a compiler without a stack limit. ;)
<flux> smerdyakov, well, it would use memory without bounds, which isn't good either
<flux> smerdyakov, besides SML doesn't have a bit matching syntax extension, so that would not help me at all :)
<thelema> flux: is there a reason you need to recurse so deep?
<flux> thelema, I have a packet capture with variable size packets. I recurse after parsing each packet. of course, I could do the loop outside that parsing function, but I would have expected that to work..
<flux> (I simply changed that from bitmatch bits with | .. -> do_something .. to (bitmatch bits with | .. -> fun () -> do_something..) (), it now works)
<thelema> bitmatch does some crazy rewriting, I'm not surprised it stops being tail recursive
jeremiah has quit [Read error: 104 (Connection reset by peer)]
<palomer> hrmph
<palomer> can someone give me an example of using printf?
<thelema> palomer: [Printf.printf "%d: %d" 12 81]
itewsh has joined #ocaml
<palomer> hrmph...
<palomer> printf looks like magic
<flux> it is
<flux> delicious magic!
<palomer> printf x always returns unit
<palomer> printf x y also
<palomer> printf x y z also
<palomer> what gives?
<flux> format string parsing in the compiler gives
<palomer> how is printf well typed?
<flux> val printf : ('a, Pervasives.out_channel, unit) Pervasives.format -> 'a
<flux> the magic is in the type
<flux> read functional unparsing white paper for better insight
<monadic_kid> the format type is treated specially, the string literal is analyzed at compile-time
<monadic_kid> and generates function types for you from that string
<palomer> so the type of printf x depends on x
<monadic_kid> yes
<flux> depends what you mean
<monadic_kid> x being a string format
<palomer> at compile time...
<flux> that's like saying let identity a = a 's type depends on a
<palomer> what about let x = printf in x y z
<flux> which it sort of does, but on the other hand doesn't
<thelema> palomer: the compiler analyzes your format string and generates a non-string type for it which drives the rest of the system.
<palomer> how does the compiler know if a computation will reduce to printf?
<flux> palomer, entering let x = Printf.printf in the toplevel will give you the answer
<flux> palomer, "printf" itself is not magical. it is the string type when used in the place of Persavisev.format is.
<monadic_kid> if you look at the docs for the format type, one of the type varibles is what get substituted with a function type which is computed from the format string at compile-time
jeremiah has joined #ocaml
<palomer> ahh, that's really magical
<flux> batteries has printf with different flavour of magic
mpwd has joined #ocaml
<monadic_kid> really? it looked like it was doing the samething to me
<flux> but it requires annotating the format strings with a prefix
<flux> monadic_kid, I mean the new shiny extensible ones
<monadic_kid> but on the same ideas of using a format string and extracting function types from it at compile-time?
<flux> monadic_kid, I thought it simply creates a tuple of certain type, like ("hello % bar %", [(fun () -> ..); (fun () -> ); etc])
<flux> yes
<monadic_kid> could do, haven't used put my batteries in :P
<flux> so haven't I :)
* monadic_kid deactivates into the abyss with the lack of power supplied from batteries
<palomer> err
<thelema> the batteries printf uses camlp4 to convert the string into a printer structure
<palomer> is there a function for unparsing? (ie string substitutions)
<thelema> palomer: sprintf?
<palomer> nice!!
<flux> and the joy doesn't end here
<flux> witness the power of ksprintf!
<palomer> err
<palomer> how is ksprintf useful?
<flux> let my_formatting_function fmt = Printf.ksprintf (fun str -> window#print_string str) fmt
<monadic_kid> doesn't it take a continuation function of the the string before being parsed
<flux> or: Printf.ksprintf failwith "aargh, error: %s" "foo"
<monadic_kid> so you could write most of those functions in terms of ksprintf
<palomer> how is that any better than failwith (Printf.sprintf "aargh,error:%s" "foo") ?
<flux> less parenthesis!
<monadic_kid> your giving it a function to pass on the results so you can do what ever you want
<monadic_kid> *you're
<flux> and it works also even if you happen to have a monadic or cps-based IO system
<flux> which btw I hope so does the batteries equivalent of formatting strings
<palomer> why isn't printf in pervasives?
<flux> btw, there's the Format module too
<flux> it might actually be a good idea to use it instead, but I don't remember why :)
<flux> it may be related to using the %t specifier in the format string
<monadic_kid> in F# sharp the format type has a property called Value for which you can pattern match on if you're was gonna write your own functino that takes format strings
<monadic_kid> you can write your own functions that take the format type and have functin types generated from string formats and i'm assuming that is the case with ocaml too
ztfw` has joined #ocaml
mpwd_ has quit [Connection timed out]
<monadic_kid> how do you guys handle very stateful problems like game states, is FRP the only decent way to go?
* palomer doesn't get FRP
ztfw` has quit [Client Quit]
<monadic_kid> i'm not groking it well either
<monadic_kid> this has been helpful though http://call-with-cc-en.blogspot.com/
fremo has quit [Remote closed the connection]
fremo has joined #ocaml
<monadic_kid> would be nice to see more tutorials/articles about it for f#/ocaml
fremo is now known as Guest32904
<palomer> I just want some kind of concrete motivating example
<palomer> like "this is ugly without FRP, let's see how we would handle it with FRP"
<monadic_kid> that would be useful and definitely a "Canonical Game Loop" FRP style would be useful too
Guest32904 is now known as fremo
ztfw has quit [Read error: 110 (Connection timed out)]
komar_ has joined #ocaml
<hcarty> palomer: The FrGui examples provide some nice illustrations, though I have found them rather hard to follow at times
BiDOrD has quit []
thelema has quit [Remote closed the connection]
itewsh has quit ["Quitte"]
thelema has joined #ocaml
Alpounet has joined #ocaml
mlbot has joined #ocaml
<Associat0r> yampa guys
<Associat0r> monadic_kid : http://haskell.org/yampa/
anryx has joined #ocaml
Snark has quit ["Ex-Chat"]
nimred has quit ["leaving"]
nimred has joined #ocaml
dejj_ has quit ["Leaving..."]
rwmjones has quit ["Closed connection"]
Ariens_Hyperion has joined #ocaml
_zack has quit [Read error: 104 (Connection reset by peer)]
_zack has joined #ocaml
rwmjones has joined #ocaml
rwmjones has quit ["Closed connection"]
angerman has quit []
ztfw has joined #ocaml
deech has quit [Read error: 104 (Connection reset by peer)]
deech has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Ched has quit [Remote closed the connection]
Ched has joined #ocaml
nimred has quit ["leaving"]
nimred has joined #ocaml
kushou_ has joined #ocaml
<kushou_> hi, i don't understand this code 'let h = function f -> function y -> (f y) + y ;;', i'm learning so sorry for this question.
kushou_ is now known as kushou
<thelema> h is a function that takes two arguments: f and y
jeddhaberstro has joined #ocaml
<kushou> ok, i agree
<thelema> it applies f to y, and then adds y to the result
<thelema> for example:
<thelema> let double x = 2 * x in h double 5
<thelema> would evaluate to...
<kushou> so f need to be a function, right ?
<thelema> yes
<thelema> it even needs to have a certain type - it returns something that can be (+)'d
<thelema> so it has to return what type?
<kushou> int ?
<thelema> yes. And what type does y have to be?
<kushou> int
<thelema> so what type does f need to have?
<kushou> int
<Alpounet> No
<thelema> almost. the full type combines the input and output
<Alpounet> don't forget f must be a function
<thelema> the full type of a function says what type it takes as an argument and what type it returns
<kushou> ok, i understand, it's difficult to think that you can give a function in argument (I have always worked in C++)
<thelema> yes, that'll take some work. You can use function pointers in C++, no?
<Alpounet> kushou, it's possible in C++ too. But C++ (and more generally mainstream languages) don't use functions as well as function languages do.
<Alpounet> thelema, there are many ways/tools in C++, but mostly for advanced C++ developers.
<kushou> yes, with void*, but i have never used it
<thelema> fair enough.
<Alpounet> > type t = { mutable x : int } ;;
<mlbot> type t = { mutable x : int; }
<thelema> so the type of f is int -> int
<thelema> meaning that it takes an int and returns an int
<Alpounet> > { x = 4 } ;;
<mlbot> - : t = {x = 4}
<Alpounet> let x = ref {x = 4} ;;
<Alpounet> > let x = ref {x = 4} ;;
<mlbot> val x : t ref = {contents = {x = 4}}
<thelema> kushou: does that make sense?
<Alpounet> > x.x <- 4 ;;
<mlbot> Type Error
<kushou> thelema: i'm ok now (val h : (int -> int) -> int -> int = <fun>)
<thelema> > (!x).x <- 4
<mlbot> Syntax Error
<thelema> kushou: good
<thelema> > x.x <- ref 4
<mlbot> Syntax Error
<kushou> thelema: can i have this for exemple: val h : (int -> int -> int) -> int -> int = <fun>
<kushou> ?
<thelema> > x.contents.x <- 4
<mlbot> Syntax Error
<Alpounet> kushou, yes but the body of the function wouldn't be the same
<kushou> ok
<thelema> you'd have to use a first argument that took two parameters
<Alpounet> thelema, I'm trying to modify the x value of a record having a reference on it
<Alpounet> I just realized I don't need a reference as values are mutable in my case
<kushou> thank you guys ! (and sorry for my bad english)
<thelema> kushou: good luck with ocaml
<kushou> thanks :)
<Alpounet> thelema, mutable fields are modified with <- right ?
<Alpounet> in my case, I'm doing : r1.r_y <- r1.r_y + 10
<Alpounet> r1 being a Sdlvideo.rect
<Alpounet> :p
ztfw` has joined #ocaml
<Alpounet> I get
<Alpounet> Error: Unbound record field label r_y
mperillo has quit [Read error: 60 (Operation timed out)]
<Alpounet> any idea ?
<Alpounet> > type ty = { mutable x : int } ;;
<mlbot> type ty = { mutable x : int; }
<Alpounet> > let foo : ty = { x = 4 } ;;
<mlbot> val foo : ty = {x = 4}
<Alpounet> > foo.x ;;
<mlbot> - : int = 4
<Alpounet> > foo.x <- 2 ; foo.x ;;
<mlbot> - : int = 2
<Alpounet> > foo.x <- foo.x + 1 ; foo.x ;;
<mlbot> - : int = 3
fremo has quit ["Reconnecting"]
fremo has joined #ocaml
<kushou> can i clear the toplevel ? (vars and functions)
<monadic_kid> you can rebind toplevels in the REPL but not in source code
<Alpounet> dammit
<Alpounet> it should work
ztfw has quit [Read error: 110 (Connection timed out)]
jamii has quit [Read error: 110 (Connection timed out)]
mperillo has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
<Alpounet> of
<Alpounet> I had to do r1.Sdlvideo.r_y
<Alpounet> good night
Alpounet has quit ["Quitte"]
<kushou> http://paste.pocoo.org/show/114447/ why does it don't work ? (types aren't good)
<kushou> wow
<kushou> *Why dosn't it work ?
<kushou> +e
<Camarade_Tux> kushou, you want to get the absolute value of each element as a string ?d
<kushou> yes
<kushou> it's to learn :)
<Camarade_Tux> then the first argument to List.map is wrong, it should be : (fun x -> absAstr (abs x))
<Camarade_Tux> also, you could write just : let absAstr = string_of_int;;
* Camarade_Tux goes to bed
Camarade_Tux has quit ["Quitte"]
<kushou> what time is it ?
mperillo has left #ocaml []
mlbot has quit [Remote closed the connection]
ztfw` has quit [Read error: 104 (Connection reset by peer)]
jbapple has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
<jbapple> Does anyone know where to find an ocaml binding for the error function (the numeric one)?
komar_ has quit [Read error: 104 (Connection reset by peer)]
slash_ has quit [Client Quit]
_zack has quit ["Leaving."]
anryx has quit ["Leaving"]
monadic_kid has quit ["Leaving"]
deech has quit [Read error: 104 (Connection reset by peer)]
deech has joined #ocaml
Ariens_Hyperion has quit []
pants1 has joined #ocaml
monadic_kid has joined #ocaml
<hcarty> jbapple: There may be something in the ocamlgsl bindings
monadic_kid has quit ["Leaving"]