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/
<araujo> Hello
<araujo> quite in here
<Smerdyakov> Hello, friend araujo.
<araujo> Smerdyakov, hello buddy :-)
<araujo> how that goes?
Sonarman has joined #ocaml
<Smerdyakov> It goes well.
<araujo> geez, i always forget the ;;
* araujo used to haskell
<araujo> Goo Smerdyakov
Skal has quit [Read error: 131 (Connection reset by peer)]
<araujo> mm.. i can't do : (float_of_int 7) + 56;; ?
<Sonarman> should that be +. maybe?
<araujo> you right, thanks
<araujo> And it is something like 56.
cjohnson has quit [""We live like penguins in the desert...""]
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]
<mflux> kv
<mflux> vincenz, pong
ulfdoz has joined #ocaml
ulfdoz_ has quit [Read error: 145 (Connection timed out)]
CLxyz has quit []
Demitar has quit [Read error: 60 (Operation timed out)]
CLxyz has joined #ocaml
Demitar has joined #ocaml
<ulfdoz> remorning
<araujo> Hello..
<araujo> When i got something like: val my_func : int -> int = <fun>
<araujo> It means that the function takes an int and returns an int among a function?
<mflux> the function takes an integer and returns an integer, nothing else
<mflux> such a function could be written like let my_func i = i + 1
<mflux> or let my_func = function i -> i + 1, or let my_func = fun i -> i + 1
<mflux> or let my_func (i:int) : int = i + 1 or let my_func : (int -> int) = fun (i:int) -> i + 1 if you want to go difficult..
<araujo> hah, get it
<araujo> And what the <func> exactly means?
<mflux> just that it's a function
<araujo> That im declaring a function?
<mflux> the value of the entry is a function
<mflux> for example integers it would show the value
<araujo> Oh get it
<mflux> for functions it can only show that it's a function
<araujo> Thaks mflux
<mflux> happy to help
Sonarman has quit ["Lost terminal"]
smimou has joined #ocaml
pango has joined #ocaml
nlv11757_ has joined #ocaml
abl has joined #ocaml
<araujo> # let rec list_even l = function
<araujo> | [] -> []
<araujo> | x :: l -> if (x mod 2) = 0 then (x :: list_even l) else list_even l ;;
<araujo> It doesn't work.. according to the message, list_even returns "a' list" , but im trying to return "int list" , ideas?
<araujo> Seems to me like i need to cast the returning value
<solarwind> Well.. function means that it implcitely 'grabs' an argument. So, let rec list_even l = shoud be let rec list_even =.
<solarwind> You're actually passing two parameters. A list and 'l'.
<solarwind> To be even more confusing, you called the tail of your list 'l'.
<solarwind> (that's why I always use something like a::tl when I patter match a list)
<solarwind> pattern, too.
<solarwind> You could have written that as: let rec list_even l = match l with | [] -> [] | ...
<araujo> oh, i see
<solarwind> araujo: To be more clear, 'function' is a pattern matching on the first argument passed to that function.
<araujo> solarwind, oh, i thought it was because of the | [] -> [] , | x :: l -> , respectively
<araujo> that it was taking just an argument
<solarwind> Well, if you make something like match l with | [] -> [] | a::tl -> ... both [] and a::tl are actually 'patterns' of l.
<araujo> Right.
<solarwind> If you pattern match a function argument (and I mean function not 'function') you shouldn't try to 'access' the argument inside the pattern match.
<araujo> i see, makes sense.
<araujo> Can i do this:
<araujo> # let x = 3
<araujo> and y = x
<araujo> and z = y;;
<araujo> ?
<mflux> no
<mflux> and not even 'let rec' even though that's what you're attempting
<mflux> just do let x = 3 let y = x let z = y;;
<araujo> i ask 'cause, i think i read somewhere in a book that you can't, but i apparently can here...
<araujo> mm...
<araujo> mflux, i don't get it, it works here
<mflux> you've propably defined x earlier
<mflux> start a new ocaml session
<mflux> (I assume that's what you're doing)
<araujo> hah, yeah, you are right
<araujo> i see ... so if i have x defined before, the others variables will take that value
<araujo> # let x = 9
<araujo> and y = x;;
<araujo> val x : int = 9
<araujo> val y : int = 3
<araujo> :-)
<mflux> things you refer to in a let statement will always refer to previous bindings
<araujo> Good to know.
<mellum> # let x = 9 and y = x;;
<mellum> Unbound value x
<mellum> doesn't work for me
<mflux> so let foo n = if n > 1 then (foo n - 1) * 2 else 42 will not compile either; 'let rec foo' needs to be used
<araujo> mellum, yes, it doesn't, i had x defined previously
<mellum> Ah, OK.
<araujo> mflux, that clarifies me a bit the 'rec' keyword
<mflux> araujo, it's the same thing with non-function definitions too; for example let rec infinite_123 = [1; 2; 3] :: infinite_123
<mellum> mflux: that's a language extension, though.
<mflux> mellum, hm, infinite lists or such constructs? it could be used for trees etc?
<mflux> besides, extension to what? ocaml is ocaml?-)
<mellum> Recursive definitions of values
kinners has joined #ocaml
<mellum> mflux: well, "extension" then means "we might arbitrarily change or remove this feature"
<mflux> oh
<mflux> I thought the 'extension' distinction was quite arbitrary, after all there is only one implementatino..
<araujo> mflux, 'let rec fun' allows to take updated arguments right? and not the previous one?
<mflux> araujo, I don't get it?
<araujo> hah, i think it's me who doesn't get it
<araujo> i mean, why can't i use 'let func' for recursive functions?
<mflux> because when you refer to 'func', it isn't yet in the scope, you're declaring it
<nlv11757_> because you have to use let rec for that
<mflux> 'rec' will bring the symbol for which the value you are defining into the scope
<araujo> oh,
<araujo> it is like to avoid: 'let u = u + 9' ;;
<araujo> simple, i was making too much of a problem out of this...
<vincenz> re
<vincenz> mflux: you there?
<mflux> yes
<mflux> just checking?-)
Tachyon76 has joined #ocaml
Tachyon76 has quit ["Leaving"]
<vincenz> oh sorry
<vincenz> I had a question
<vincenz> You mentioned something about extensions to ocaml for monads
<mflux> yes
<mflux> I haven't actually used it, only glanced at the documentation (or website ;))
<vincenz> got the link?
<mflux> hmm.. apparently not on hump, searching..
<vincenz> thx
Hadaka has quit [Read error: 60 (Operation timed out)]
Demitar has quit [Read error: 54 (Connection reset by peer)]
solarwind has quit ["leaving"]
kinners has quit ["leaving"]
gim_ has quit [Read error: 110 (Connection timed out)]
gim_ has joined #ocaml
gim_ is now known as gim
nlv11757_ has left #ocaml []
vodka-goo has joined #ocaml
bzzbzz has joined #ocaml
Gueben has joined #ocaml
Demitar has joined #ocaml
kleenest has joined #ocaml
Gueben has quit ["Leaving"]
Gueben has joined #ocaml
pango has quit [sterling.freenode.net irc.freenode.net]
pango has joined #ocaml
senko has quit ["Leaving"]
vezenchio has joined #ocaml
<mflux> well, did you get anything useful out of that?-)
<mflux> what is your local time anyway, btw, mine is 2123
pango has quit ["bbl"]
pango has joined #ocaml
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
TeXitoi has joined #ocaml
cjohnson has joined #ocaml
cjohnson has quit [Remote closed the connection]
pancake has joined #ocaml
<pancake> hi
<pancake> how can i fix this? Reference to undefined global `Unix'
<pancake> i've no unix.cmo :/
cjohnson has joined #ocaml
cjohnson has quit [Read error: 104 (Connection reset by peer)]
pancake has quit ["bzzz"]
TeXitoi has quit ["leaving"]
smimou has quit ["?"]
<Nutssh> See the instructions for the compilation options for using the Unix interface.
vodka-goo has quit []
cjohnson has joined #ocaml
<vincenz> unix.cma unix.cxma depending on native or not
Demitar has quit [Read error: 110 (Connection timed out)]
haakonn has quit [Remote closed the connection]
Gueben has quit ["Leaving"]
cjohnson has quit [Read error: 104 (Connection reset by peer)]
cjohnson has joined #ocaml
haakonn_ has joined #ocaml
<ulfdoz> cya