smimou changed the topic of #ocaml to: OCaml 3.08.3 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
dan2 has quit [Remote closed the connection]
cjohnson has quit [""We live like penguins in the desert...""]
smimou has quit ["↓"]
cjohnson has joined #ocaml
mlh has quit [Client Quit]
skaller has joined #ocaml
skaller has left #ocaml []
dan2 has joined #ocaml
mlh has joined #ocaml
mlh has quit [Read error: 104 (Connection reset by peer)]
cjohnson has quit [""We live like penguins in the desert...""]
mlh has joined #ocaml
mlh has quit ["brb"]
mlh has joined #ocaml
dan2 has quit [Remote closed the connection]
ulfdoz has joined #ocaml
ulfdoz_ has quit [Read error: 60 (Operation timed out)]
vezenchio has joined #ocaml
Sonarman has quit ["leaving"]
Herrchen has joined #ocaml
Submarine has joined #ocaml
<ulfdoz> re
bk_ has joined #ocaml
mlh has quit ["The Knights who say NIH!"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
vodka-goo is now known as home-goo
pango has quit [Remote closed the connection]
pango has joined #ocaml
shawn_ has joined #ocaml
mrvn__ is now known as mrvn
mrvn is now known as mrvnw
mrvnw is now known as mrvn
shawn has quit [Read error: 110 (Connection timed out)]
araujo has quit ["Programs must be written for people to read, and only incidentally for machines to execute"]
eviltoylet has joined #ocaml
<eviltoylet> can someone please inform me of what Some and None mean? I still can't figure it out ...
<mauke> they're data constructors
<eviltoylet> how would i use them in a function? Or what would they do?
<eviltoylet> I tried making a function that pattern matched to Some(x,y) ... but i can't seem to figure out what to pass in
<mauke> they're defined like this: type 'a option = None | Some of 'a ;;
<eviltoylet> mmm, i'm getting more and more confused now.
<mauke> well, what are you trying to do?
<eviltoylet> function | Some (x,y) -> Some (x,y) | _ -> None trying to understand what this does
<mauke> looks like the identity function
<eviltoylet> but i dont quite understand the meaning of the Some (x,y) and None... even given the definition of them. perhaps i don't even understand the definition of it
<mauke> let foo x = x;;
<bk_> http://merjis.com/developers/ocaml_tutorial/ch4 has an explanation, not sure whether its formally correct tho
<eviltoylet> thanks bk_, let me look at it
<Hadaka> eviltoylet: that sort of a function is not a good idea to try and start understanding from, since it is does not look like reasonable code
<eviltoylet> yah i figured. its from a practice midterm :)
<eviltoylet> therefore its bound to be extremely complicated and obfuscated and yet do absolutely nothing.
<mauke> it's like function | x when x <> 0 -> x | _ -> 0 ;;
<eviltoylet> bk_: read it .. didn't help much
<mauke> well, the type of your function is ('a * 'b) option -> ('a * 'b) option
<mauke> it takes an option and returns an option of the same type
<eviltoylet> yah. so i'd put in Some ("hello", "blah");;
<mauke> yes
<eviltoylet> i understand the matching .. but i just dont get why Some and None are defined.. more specifically for what purpose
<eviltoylet> i know that none is = null .. but some is just ocnfusing me
<mauke> for optional values
<mauke> like a value that could be missing
<eviltoylet> oh, in which case None would be used?
<mauke> yes
<eviltoylet> ahh. okay, that makes sense now i suppose :D
<eviltoylet> thanks mauke
<mauke> you're welcome
<eviltoylet> now you wouldn't have any idea what this does would you? :D let rec f x = f x in f
<mauke> well, it gives you a function
<mrvn> an endless loop
<mauke> calling that function results in an infinite loop
<eviltoylet> hrmm, what does the in keyword do?
<eviltoylet> it seems like me it hsould be broken up as let rec f x = f x ... but i'm not sure why that in is there
<mauke> let VAR = DEF in EXPR is an expression
<mauke> it's a local definition
<mauke> e.g. print_int (let n = 2 in n * (n + 1)) ;;
<eviltoylet> that prints 6 all the time then?
<mauke> yep
<mauke> ok, stupid example
<mauke> but it's often useful for local function definitons
<eviltoylet> hrmm, i'm not sure where things are binded
<eviltoylet> so would that be (let rec f x = f x) in f?
<mauke> no, that's a syntax error
<mauke> the "variable" to be bound is the first f x
<mauke> the definition for it is the second s x
<mauke> and the final f is the expression in which f is visible
<mauke> (as bound above)
<eviltoylet> so .. (let rec f x) = (f x in f)?
<eviltoylet> or bah.
<mauke> no, you can't separate the parts
<mrvn> let rec f x = (f x) in f
<mauke> it's like (if EXPR1 then EXPR2 else EXPR3)
<mauke> you can't just say (if EXPR1) (then EXPR2)
<eviltoylet> lol.
<eviltoylet> geez, my brain just isnt programmed for this yet. i'm going to go stare at it a bit more. but thanks again :D
<mrvn> It's like asking: Why it is 'if' and not 'of'? It just is.
<mauke> in C you might do something like: { const int i = 42; ... }
<mauke> OCaml equivalent: let i = 42 in (...)
<eviltoylet> ahh
<eviltoylet> btw, its much better to write int const i :)
<mauke> um, no
<mauke> or do you write stuff like "int typedef lol_t;"?
<eviltoylet> why not?
<eviltoylet> int * const i; int const * i;
<eviltoylet> thats much easier to tell whats going on .
<mauke> int typedef intptr;
<eviltoylet> lol.
<mauke> er, int typedef *intptr; of course
<eviltoylet> wait -- how would you write the following two then. i being a constant pointer to an int, and i being a pointer to a constant int
<mauke> int *const i; and const int *i;
<eviltoylet> doopee doop. lets talk about ml :)
<mauke> int const a = 2, b = 3; <-- is b const here?
<eviltoylet> mmm, mmm... /me boots up ide
<mauke> const int a = 2, b = 3; <-- and now?
<eviltoylet> gcc claims they're all constant
<mauke> right
<eviltoylet> and thats the way they should be right? since const is a type modifier
<eviltoylet> haha, damn. lets talk ml. or bring this to the c channel where we can get a bigger flame war :)
<mauke> huhu, they're talking about randomness and chaos right now
<eviltoylet> hrmm... that seems to be what they're talking about all the time. last time i stepped in they talked aboug geiger counters
<mrvn> You want funny in c?
<mrvn> mrvn@frosties:~% cat foo.c
<mrvn> unsigned;
<mrvn> mrvn@frosties:~% gcc -c foo.c
<mrvn> foo.c:1: warning: useless keyword or type name in empty declaration
<mrvn> foo.c:1: warning: empty declaration
<mrvn> mrvn@frosties:~% ls -lh foo.o
<mrvn> -rw-r--r-- 1 mrvn mrvn 927 2005-05-03 13:11 foo.o
<mauke> er
<mrvn> A totally correct C translation unit.
<mauke> doesn't look correct to me
<mrvn> Read the grammar.
<eviltoylet> hrmm doesn't compile to object code for me
<mauke> grammar isn't everything
<mrvn> eviltoylet: with what error?
<mauke> "Constraints: [#2] A declaration shall declare at least a declarator (other than the parameters of a function or the members of a structure or union), a tag, or the members of an enumeration."
<eviltoylet> mrvn: declaration does notdeclare anything
<eviltoylet> thats ondev-cpp for windows
<eviltoylet> i just tried it on sparc and it works there
<mrvn> wow.
<mrvn> gcc doesn't care about the constraint.
<eviltoylet> i think devc++ uses gcc though
<mauke> mrvn: it does care: "foo.c:1: warning: empty declaration"
<mauke> that's the required diagnostic
smimou has joined #ocaml
haakonn_ has quit [Read error: 113 (No route to host)]
_JusSx_ has joined #ocaml
haakonn has joined #ocaml
_JusSx_ has quit [Client Quit]
_JusSx_ has joined #ocaml
pango has quit [niven.freenode.net irc.freenode.net]
home-goo has quit [niven.freenode.net irc.freenode.net]
vezenchio has quit [niven.freenode.net irc.freenode.net]
ulfdoz has quit [niven.freenode.net irc.freenode.net]
bk_ has quit [niven.freenode.net irc.freenode.net]
mattam has quit [niven.freenode.net irc.freenode.net]
cognominal has quit [niven.freenode.net irc.freenode.net]
shrimpx has quit [niven.freenode.net irc.freenode.net]
oracle1 has quit [niven.freenode.net irc.freenode.net]
Hadaka has quit [niven.freenode.net irc.freenode.net]
calvin_ has quit [niven.freenode.net irc.freenode.net]
noj has quit [niven.freenode.net irc.freenode.net]
smimou has quit [niven.freenode.net irc.freenode.net]
Demitar has quit [niven.freenode.net irc.freenode.net]
Banana has quit [niven.freenode.net irc.freenode.net]
cmeme has quit [niven.freenode.net irc.freenode.net]
vincenz has quit [niven.freenode.net irc.freenode.net]
CLxyz has quit [niven.freenode.net irc.freenode.net]
haakonn has quit [niven.freenode.net irc.freenode.net]
eviltoylet has quit [niven.freenode.net irc.freenode.net]
__DL__ has quit [niven.freenode.net irc.freenode.net]
mflux has quit [niven.freenode.net irc.freenode.net]
TeXitoi has quit [niven.freenode.net irc.freenode.net]
mrvn has quit [niven.freenode.net irc.freenode.net]
det has quit [niven.freenode.net irc.freenode.net]
p has quit [niven.freenode.net irc.freenode.net]
slashvar[lri] has quit [niven.freenode.net irc.freenode.net]
j_n has quit [niven.freenode.net irc.freenode.net]
Amorphous has quit [niven.freenode.net irc.freenode.net]
haakonn has joined #ocaml
smimou has joined #ocaml
eviltoylet has joined #ocaml
pango has joined #ocaml
bk_ has joined #ocaml
vezenchio has joined #ocaml
ulfdoz has joined #ocaml
mattam has joined #ocaml
home-goo has joined #ocaml
mflux has joined #ocaml
TeXitoi has joined #ocaml
mrvn has joined #ocaml
cognominal has joined #ocaml
__DL__ has joined #ocaml
Demitar has joined #ocaml
Banana has joined #ocaml
det has joined #ocaml
cmeme has joined #ocaml
shrimpx has joined #ocaml
calvin_ has joined #ocaml
noj has joined #ocaml
oracle1 has joined #ocaml
Hadaka has joined #ocaml
vincenz has joined #ocaml
p has joined #ocaml
slashvar[lri] has joined #ocaml
CLxyz has joined #ocaml
Amorphous has joined #ocaml
j_n has joined #ocaml
slashvar[lri] has quit [Remote closed the connection]
shrimpx has quit [Read error: 54 (Connection reset by peer)]
slashvar[lri] has joined #ocaml
shrimpx has joined #ocaml
Snark has joined #ocaml
dan2 has joined #ocaml
_JusSx__ has joined #ocaml
cjohnson has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
Submarine has quit ["Leaving"]
araujo has joined #ocaml
Submarine has joined #ocaml
araujo has quit ["Programs must be written for people to read, and only incidentally for machines to execute"]
hasp has joined #ocaml
dan2 has quit ["Leaving"]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
dan2 has joined #ocaml
mrvn_ has joined #ocaml
eviltoylet has left #ocaml []
mrvn has quit [Read error: 60 (Operation timed out)]
mrvn_ is now known as mrvn
home-goo is now known as vodka-goo
Submarine has quit ["Leaving"]
Herrchen has quit ["bye"]
TeXitoi has quit [Read error: 54 (Connection reset by peer)]
TeXitoi has joined #ocaml
Gueben has joined #ocaml
vezenchio has quit [""Under democracy one party always devotes its chief energies to trying to prove that the other party is unfit to rule—and bot]
Submarine has joined #ocaml
pango has quit ["Leaving"]
jzono1 has joined #ocaml
<jzono1> help me out with this, pleese:/home/jo/div/icedock-0.5)--
<jzono1> --(2140:Tue,03 May 05:$)-- make
<jzono1> ocamlopt.opt -inline 20 -unsafe -I xlib -c -o mx.cmx mx.ml
<jzono1> xlib/xlib.cmi is not a compiled interface
<jzono1> make: *** [mx.cmx] Error 2
<mrvn> cmxa
<jzono1> what?
<jzono1> i'm just trying to get this icedock app going
<jzono1> think i got to compile it myself to gtet it working
mrvn_ has joined #ocaml
<Snark> good night
Snark has quit ["Leaving"]
smimou has quit ["?"]
mrvn has quit [Read error: 60 (Operation timed out)]
araujo has joined #ocaml
<ulfdoz> cya
jzono1 has quit ["Leaving"]
pango has joined #ocaml
__DL__ has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit ["Leaving"]
_JusSx__ has quit ["leaving"]
hasp has left #ocaml []
smimou has joined #ocaml
Nutssh has joined #ocaml
Gueben has quit ["WiNdOz R0xOr dA w0R1d"]
angagon has joined #ocaml
<araujo> # (function x -> x) [];;
<araujo> What is the type of that expression?
<smimou> 'a list
<araujo> smimou, i thought it was '_a list
<smimou> why that ?
<smimou> the identity is fully polymorphic since OCaml 3.08 I think
<smimou> and intuitively its a 'a list
<mattam> Objective Caml version 3.08.3
<mattam> # (function x -> x) (ref []);;
<mattam> - : '_a list ref = {contents = []}
<mattam> hi smimou :)
<smimou> hi :)
<araujo> I thought a polymorphic type applied to polymorphic arguments would give a weak type variable
<smimou> mattam: # ref [];;
<smimou> - : '_a list ref = {contents = []}
<araujo> it is what the ocaml book says.
<mattam> yes
<smimou> araujo: they have made the type system a little more flexible recently
<mattam> it's the only way to get a weak type variable in the result type now
<mattam> araujo: there's no clear explanation yet how the new system work (AFAIK)
<araujo> Ah, ok
<araujo> Thanks
<araujo> Well, i think i can omit details for now :-)
<araujo> i just found weird i didn't get the same result from the book...
Sonarman has joined #ocaml
smimou has quit ["?"]