flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
netx has quit ["Leaving"]
Proteus_ has joined #ocaml
Proteus has quit [Read error: 54 (Connection reset by peer)]
Proteus has joined #ocaml
mbishop has joined #ocaml
Proteus_ has quit [Read error: 113 (No route to host)]
seafood has joined #ocaml
Proteus_ has joined #ocaml
dejj1 has joined #ocaml
lecas has quit [Remote closed the connection]
Proteus__ has joined #ocaml
Proteus_ has quit [Read error: 104 (Connection reset by peer)]
nuncanada has joined #ocaml
pango_ has quit [Remote closed the connection]
dejj has quit [Read error: 110 (Connection timed out)]
Proteus has quit [Read error: 113 (No route to host)]
seafood has quit [Connection timed out]
sporkmonger has joined #ocaml
Proteus has joined #ocaml
mfp has quit [Read error: 104 (Connection reset by peer)]
dejj1 has quit ["Leaving."]
Proteus__ has quit [Read error: 113 (No route to host)]
Ched- has quit [Read error: 110 (Connection timed out)]
Ched- has joined #ocaml
Proteus_ has joined #ocaml
pango_ has joined #ocaml
mfp has joined #ocaml
Proteus_ has quit [Connection reset by peer]
Proteus_ has joined #ocaml
Proteus has quit [Read error: 113 (No route to host)]
bohanlon has quit ["leaving"]
Proteus__ has joined #ocaml
Mr_Awesome has quit [Connection timed out]
m3ga has quit ["disappearing into the sunset"]
Proteus_ has quit [Read error: 113 (No route to host)]
jeddhaberstro has quit []
_y_ has quit []
nuncanada has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
<Palace_Chan> if i want to check for Hashtbl.find sometable somekey but i want to catch a Not_found exception do i do: try Hashtbl.find sometable somekey with | Not_found -> (caught it)
<Eridius> what happens when you try?
<Eridius> incidentally, the | is optional. It's intended to provide a slightly "cleaner" appearance when each match case is on a separate line
<Palace_Chan> well Hashtbl.find throws Not_found if a key is not in the table...but i want to catch that exception and say return a boolean
<Eridius> ok, so what's the problem?
<Palace_Chan> so i guess inside the function i can do try Hashtbl.find, then with Not_found -> handle
<Palace_Chan> the syntax, i was wondering if that was it
<Eridius> I hope you realize you can test the syntax very quickly in the toplevel
<Palace_Chan> i have been doing so yes, only sometimes i am still not used to the compiler error messages
struktured_ has joined #ocaml
<Palace_Chan> i get type errors still, it's my second day in OCaml
<thelema> Palace_Chan: yes - that's the syntax.
<Eridius> Palace_Chan: I bet your handle statement is returning a different type
<Eridius> than the Hashtbl.find
<Eridius> after using ruby for a while, I love having a strong type inference system
<Palace_Chan> im going to check it on the top level
<Eridius> in my little scripts, once I fix all the type errors, it almost always works on first run
<Eridius> when it doesn't, it's because I have a conceptual error about how to solve the problem
<Eridius> Palace_Chan: what's the error you get?
<thelema> Palace_Chan: you only get one return type, so if your handler returns bool, your main function must also return bool
<Eridius> Palace_Chan: if you want your expression to return the value if it exists, or indicate it doesn't without an exception, I recommend using 'a option
<Palace_Chan> actually my function syntax "seems" correct
<Eridius> try Some (Hashtbl.find tbl key) with Not_found -> None
<Palace_Chan> 'a option the type ? how so ?
<Eridius> you could also check the result of Hashtbl.mem tbl key first, which returns a bool that indicates the presence of the key
<Palace_Chan> Eridius, if the exception is not thrown, that should return Some result ?
<Eridius> yeah
<Palace_Chan> without using .mem though, Hashtbl.find, in the case of not throwing exception, would return the image of the key...is there a way to detect that and report it in bool form ?
<Eridius> Palace_Chan: you can either return a bool, or you can return the type of value that the Hashtbl hash. You have to pick, one or the other
<Eridius> if you want to return a bool.. just use Hashtbl.mem
<Eridius> you're missing the whole type aspect here
<Eridius> this isn't a wishy-washy dynamic typed language. Your expression has to return a single type
<Eridius> this is the entire point of the 'a option type. It lets you represent the idea of "return an object, or return nothing at all"
<Eridius> kinda like returning a pointer or NULL in C
<Eridius> or an object or nil in ruby
<Palace_Chan> hmm, wait that is interesting i had never understood why there would be some made up type called type 'a option = None | Some of 'a
<Eridius> it's for exactly this situation
<Eridius> another example is in camlimages, the OImages.oimage class type has a method called save, which takes a filename, an file_type option, and a list of options.
<thelema> Palace_Chan: all pointers are non-null. Ocaml won't ever give you a null dereference.
<Eridius> the file_type option lets you say something like (Some Images.Png) to mean save as a PNG, or just None to mean infer the filetype from the filename
<Palace_Chan> i see
struktured has quit [Read error: 110 (Connection timed out)]
<Palace_Chan> in the signature: val get_current_ctr : unit -> int
<Palace_Chan> unit is not the return type anymore
<Eridius> that's a function which takes unit and returns an int
<Palace_Chan> like, if one says let get_current_ctr () : int -> !ctr
<Palace_Chan> that is also a function which takes unit and returns int
<Eridius> sure
<Palace_Chan> ah, little confusing since in the first case unit appears righrt between : and ->
<Palace_Chan> in the place the return type usually appears
<Eridius> you're confusing yourself
<Eridius> val get_current_ctr : type
<Eridius> type there is unit -> int
<Palace_Chan> ohhhh
<Eridius> actually, your let code is syntactically invalid
<Palace_Chan> a function from unit to int
<Palace_Chan> cuz that is what it is
<Eridius> let get_current_ctr () : int = !ctr
<Eridius> hopefully that'll clarify it
<Palace_Chan> yes, thanks i didnt catch that
<Eridius> let get_current_ctr () : unit -> int = (fun () -> !ctr)
struktured_ has quit ["Konversation terminated!"]
<Palace_Chan> whenever i define a type i need a constructor of some sort as in type t = This | That don't i ?
<Palace_Chan> but if i wanted to define a type within a module interface, i.e between sig and end what does a type definition prototype look like ?
threeve has quit []
<Eridius> Palace_Chan: you don't have to expose the type definition, but it does have to be defined somewhere
<Palace_Chan> by exposing...is adding the signature of something to an .mli file what is meant by "exposing the functionality to other modules" ?
<Eridius> yeah
<Eridius> you can leave it as an abstract type in the .mli as long as you implement it in the .ml
<Eridius> for example, in hashtbl.mli you see: type ('a, 'b) t
<Eridius> it's an abstract type. You don't know how the hashtable is actually implemented
<Palace_Chan> ah it seems List module in the standard library doesnt have a mem function to check if it contains an element returrning bool
<thelema> Palace_Chan: List.find would probably work for that.
<Eridius> no, there's a List.mem
<Palace_Chan> there is ? let me check again
<Eridius> List.find takes a predicate ('a -> bool)
<Palace_Chan> ah you're right, it's under Scanning
<Palace_Chan> memq looks similar...whoa what's the diff between physical equality and structural equality ?
<Eridius> structural equality means every field of the object is equal to the same field in the other object
<Eridius> physical equality means literally the same object
<Eridius> in C, structural equality would be comparing the value of a pointer, while physical equality would be comparing the pointer itself
<Palace_Chan> oh i see, like OO languages like java use == and overriden .equals()
<Palace_Chan> Eridius, so then mem and memq are indistinguishable unless you deal with objects...and mayyybe records or refs
<Eridius> for primitive types like ints, yeah
Jedai has quit [Read error: 60 (Operation timed out)]
Snark has joined #ocaml
kig has joined #ocaml
struktured has joined #ocaml
Proteus_ has joined #ocaml
Proteus__ has quit [Read error: 104 (Connection reset by peer)]
bluestorm has joined #ocaml
<flux> end of summer-meeting of jane street's ocaml summer of code is approaching (it's on friday)
<flux> atleast then we well learn how the projects went
<flux> I guess there might be a big deadline's-approaching-crunch going on right now :)
Proteus__ has joined #ocaml
Proteus__ has quit [Read error: 60 (Operation timed out)]
Proteus_ has quit [Read error: 113 (No route to host)]
Yoric[DT] has joined #ocaml
Palace_Chan has quit [Client Quit]
mishok13 has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
smimou has joined #ocaml
filp has joined #ocaml
Associat0r has quit []
Proteus has joined #ocaml
mfp has quit [Read error: 104 (Connection reset by peer)]
bluestorm has quit [Remote closed the connection]
ppsmimram has quit ["Leaving"]
filp has quit ["Bye"]
Proteus has quit ["Leaving"]
OChameau has joined #ocaml
mfp has joined #ocaml
munga_ has joined #ocaml
munga has quit [Read error: 104 (Connection reset by peer)]
Myoma has quit ["Leaving"]
Snark has quit ["Ex-Chat"]
Myoma has joined #ocaml
ppsmimou has joined #ocaml
mfp has quit [Read error: 104 (Connection reset by peer)]
netx has joined #ocaml
netx has quit [Client Quit]
mfp has joined #ocaml
ygrek has joined #ocaml
ttamttam has joined #ocaml
xavierbot has joined #ocaml
<xavierbot> _child: 'lose' 'POE::Session=ARRAY(0x874ee04)' ''
<xavierbot> _stop:
<xavierbot> can't exec (./ocamlbotwrapper) in child pid 6853: No such file or directory at /usr/share/perl5/POE/Wheel/Run.pm line 498.
<xavierbot> _child: 'lose' 'POE::Session=ARRAY(0x874ee04)' ''
<xavierbot> _stop:
<xavierbot> can't exec (./ocamlbotwrapper) in child pid 6854: No such file or directory at /usr/share/perl5/POE/Wheel/Run.pm line 498.
xavierbot has quit [Remote closed the connection]
<flux> yes..
Myoma has quit ["Leaving"]
marmotine has joined #ocaml
<rwmjones_> whois was running xavierbot there needs to do 'make permissions' first
Myoma has joined #ocaml
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
mgodshall has quit [Read error: 110 (Connection timed out)]
seafood_ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Client Quit]
seafood has joined #ocaml
struktured has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
tomh_-_ has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
tomh_-_ has quit ["http://www.mibbit.com ajax IRC Client"]
mfp has quit [Read error: 110 (Connection timed out)]
seafood has quit []
threeve has joined #ocaml
mfp has joined #ocaml
bohanlon has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
Associat0r has joined #ocaml
nuncanada has joined #ocaml
ttamttam has left #ocaml []
Ched has joined #ocaml
Ched- has quit [Connection timed out]
vpalle has joined #ocaml
bluestorm has joined #ocaml
bluestorm has quit [Client Quit]
rwmjones_ is now known as rwmjones
maattd has joined #ocaml
pango_ has quit [Remote closed the connection]
mishok13 has quit [Remote closed the connection]
pango_ has joined #ocaml
vpalle has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
Linktim has joined #ocaml
Linktim_ has joined #ocaml
jonafan_ is now known as jonafan
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Ched has quit [Remote closed the connection]
Ched- has joined #ocaml
bluestorm has joined #ocaml
CoryDambach has joined #ocaml
OChameau has quit ["Leaving"]
pantsd has joined #ocaml
Amorphous has quit [Success]
jderque has joined #ocaml
Amorphous has joined #ocaml
maattd has left #ocaml []
mwhitney has quit [Read error: 110 (Connection timed out)]
pantsd has quit [Read error: 110 (Connection timed out)]
pantsd has joined #ocaml
mfp has quit [Remote closed the connection]
Snark has joined #ocaml
bluestorm has quit [Remote closed the connection]
pantsd has quit [Read error: 110 (Connection timed out)]
pantsd has joined #ocaml
psnively has joined #ocaml
ttamttam has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
itewsh has joined #ocaml
Linktim has quit ["Quitte"]
vpalle has joined #ocaml
vpalle has quit [Client Quit]
Linktim has joined #ocaml
ttamttam has left #ocaml []
Oatschool has joined #ocaml
itewsh has quit [Read error: 113 (No route to host)]
Eridius has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Snark has quit ["Ex-Chat"]
mwhitney has joined #ocaml
cyrax has joined #ocaml
hkBst has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
bluestorm has joined #ocaml
bluestorm has quit [Client Quit]
itewsh has joined #ocaml
cyrax_ has joined #ocaml
cyrax has quit [Read error: 110 (Connection timed out)]
cyrax_ has quit ["leaving"]
Palace_Chan has joined #ocaml
jeddhaberstro has joined #ocaml
jeddhaberstro has quit [Remote closed the connection]
jeddhaberstro has joined #ocaml
Jedai has joined #ocaml
tomh_-_ has joined #ocaml
jderque has left #ocaml []
longh has joined #ocaml
Linktim_ has quit [Read error: 113 (No route to host)]
itewsh has quit [Remote closed the connection]
itewsh has joined #ocaml
Eridius has joined #ocaml
longh has quit [Remote closed the connection]
ygrek has quit [Remote closed the connection]
threeve has quit []
nuncanada has quit [Remote closed the connection]
kig has quit [Remote closed the connection]
jlouis has quit ["Leaving"]
nuncanada has joined #ocaml
itewsh has quit [Read error: 113 (No route to host)]
mfp has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
struktured has joined #ocaml
Eridius has quit ["Leaving..."]
Eridius has joined #ocaml
mfp has quit [Read error: 104 (Connection reset by peer)]
<struktured> anyone in nyc checking out the summer of code ?
mfp has joined #ocaml
marmotine has quit ["mv marmotine Laurie"]
psnively has quit []
Demitar has joined #ocaml
tomh_-_ has quit ["http://www.mibbit.com ajax IRC Client"]
sporkmonger has quit []
Kopophex has joined #ocaml
Kopophex has quit ["Leaving"]