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!)
<rpg> define val i = e;
<dobblego> the assignment of i to the expression
<rpg> but then it has to be equivalent...
<dobblego> it doesn't help your example that println returns the unit type/value
<rpg> its like saying 5 > 4 and if a=5 then a MUST be > 4
<dobblego> yes you can say that, since > is not a side-effect
<dobblego> here are two programs:
<dobblego> f(println(x));
<dobblego> f(println(x));
<dobblego> / end 1
<dobblego> val i = println(x);
<dobblego> f(i);
<dobblego> f(i);
<dobblego> they have different outcomes
<rpg> how ???
<dobblego> (for *any* value of f)
<rpg> ure calling f() twice
<dobblego> there exists a value for f such that program outcomes are affected
<rpg> just like in the first example
<dobblego> yes, but println is executed once in the first and twice in the second
<dobblego> oops, other way around
<dobblego> yes, but println is executed twice in the first and once in the second
<rpg> its executed twice in the first since ure calling it twice
<dobblego> right
<rpg> and twice in the second since ure calling f() twice
<dobblego> no
<rpg> explain
<dobblego> the value for 'i' in this example is the unit value
<dobblego> println returns a type that is unit
<dobblego> I am passing that value to f
<dobblego> the execution of f does not invoke println again
<rpg> ok im starting to understand
<rpg> u already have the println() value stored in i
<dobblego> right
<rpg> so instead of calling it u just use the stored variable
<rpg> stored result rather
<dobblego> I have seen functions that delete an element from a list, then return boolean if the element really was deleted
<dobblego> this is a side-effect too
<rpg> 1 sec le me re-capitulate
<dobblego> also, any function that returns the unit value is almost guaranteed to be a side-effect
<rpg> so print_float would not be a side-effect ?
<rpg> *produce
<dobblego> why not?
<rpg> i dunno...why does it matter if it returns unit value or int value
<dobblego> I am unfamiliar with print_float (and ocaml for that matter)
<rpg> ok
<rpg> good
<rpg> ure on my level then
<dobblego> knowing languages is unimportant to me :)
<rpg> ok
<rpg> so going back
<rpg> we have prog1: readLine(); readLine(); // and prog2: i = readLine() ; i; i; <--there is a side effect because the second readLine ( from prog1 ) could read a different string
<rpg> correct ?
<dobblego> yes
<rpg> ok
<dobblego> a function that accepts no arguments and is not a constant is guaranteed to be a side-effect
<thelema> rpg: if you do [let i = readline ()], i gets bound to the return value of readline.
<thelema> if you do [let i = readline in i ()] then readline gets called under the name i.
<thelema> dobblego: time()
<rpg> so every time i type i it recalls correct ? (2nd example)
<dobblego> thelema, that's an interesting argument :)
<thelema> rpg: if you bind i to readline [let i = readline in ...] then you've just created another pointer to the readline function - one called 'i'.
<rpg> yes
<rpg> not to the value of readline but to readline itself
<rpg> correct ?
<thelema> if you bind i to the result of calling readline on unit [let i = readline () in ...] then i has whatever value gets read in.
<thelema> yes, correct.
jeddhaberstro has quit []
<rpg> ok
<rpg> now when it comes to println
<rpg> or just print
<rpg> to make it simple
<thelema> another way to write it could be [let i () = readline () in...]
<rpg> when ure printing...how could that be a side effect
<thelema> do you understand currying?
<rpg> maybe ifu define
<thelema> a curried function has only one argument, but returns a function that takes the next argument, etc, until it returns the final result.
<thelema> [(int,int) -> int] -- not curried (and abuse of notation)
<thelema> [int -> int -> int] -- curried. == [int -> (int -> int)]
<thelema> for example: let add = fun x -> fun y -> x+y
<thelema> This allows reasonable partial application of functions.
<rpg> i think i do...its like saying x(y) = x(g(z))=x(g(m(n)))
<rpg> math-wise
<thelema> kind of, it's like saying x(y,z) = (a(y))(z)
<rpg> so y = returned value of g(z) and z = returned value of m(n)
clog has joined #ocaml
tomh_-_ has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
rwmjones has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
sporkmonger has quit [Connection timed out]
itewsh has quit [Remote closed the connection]
Submarine has quit [Read error: 110 (Connection timed out)]
im_alone is now known as maxote
jeddhaberstro has quit []
jeddhaberstro has joined #ocaml
longh has quit [Read error: 54 (Connection reset by peer)]
rwmjones has quit ["Closed connection"]
msandin has quit ["Leaving."]
guillem has quit [Remote closed the connection]
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
tomh_-_ has quit [Read error: 104 (Connection reset by peer)]
Yoric[DT] has joined #ocaml
wlmttobks has joined #ocaml
viimrles has joined #ocaml
tomh has joined #ocaml
prongla has joined #ocaml
<prongla> anyone using F# ? does it have type-inference like haskell and ocaml or is it more like scala? u have to declare types but it can do some type-inferencing?
<Yoric[DT]> prongla: from what I understand, the functional aspects have type inference but the OO don't.
marmotine has quit ["mv marmotine Laurie"]
<Yoric[DT]> Other than that, good night.
Yoric[DT] has quit ["Ex-Chat"]
<prongla> good ngiht?
<prongla> oh
<Associat0r> prongla : it is kinda like ocaml
<Associat0r> prongla : and like he said OO inference gets tricky
<prongla> well i kind of dont need it for that
<prongla> i want functional with some OO when it fits and on a popular platform
<prongla> can i run it in emacs?
<ozy`> I'm pretty sure you could find a fully developed INTERCAL mode for emacs if you needed it for something
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
<Associat0r> prongla : you can also use the free Visual Studio 2008 shell
<Associat0r> or monodevelop
<prongla> asso: im looking into them. im just very used to emacs so im veyr productive with it. basiclaly im lookin for a fully interated programming/matlab/visualising environment(for machine learning)
<prongla> matlab is very good but it would be cool o have everything in one
<rpg> when comparing strings
<rpg> which is smaller
<rpg> aa or aba
<rpg> ooops
<rpg> i ment
<rpg> ab or aab
prongla has quit [Read error: 104 (Connection reset by peer)]
prongla has joined #ocaml
prongla has left #ocaml []