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/
m3ga has joined #ocaml
monochrom has quit ["me!"]
p has quit [Read error: 60 (Operation timed out)]
noss has quit ["4E4F2055"]
p has joined #ocaml
m3ga has left #ocaml []
ulfdoz has joined #ocaml
ulfdoz_ has quit [Read error: 145 (Connection timed out)]
drz has joined #ocaml
mlh has quit [Client Quit]
<ulfdoz> morgän!
dan2 has quit [Read error: 60 (Operation timed out)]
angagon has quit [Read error: 110 (Connection timed out)]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
Herrchen has joined #ocaml
Snark has joined #ocaml
mrvn has joined #ocaml
vezenchio has joined #ocaml
mrvn_ has quit [Read error: 145 (Connection timed out)]
Herrchen has quit ["leaving"]
Herrchen has joined #ocaml
Herrchen has quit [Client Quit]
Herrchen has joined #ocaml
mrvn_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
__DL__ has joined #ocaml
mlh has joined #ocaml
_JusSx_ has joined #ocaml
ramen has joined #ocaml
shawn_ has joined #ocaml
smimou has joined #ocaml
Submarine has joined #ocaml
shawn_ has quit [Read error: 110 (Connection timed out)]
_JusSx_ has quit ["leaving"]
bk_ has joined #ocaml
pango_ has quit [Read error: 60 (Operation timed out)]
pango_ has joined #ocaml
mrvn has joined #ocaml
vodka-goo has joined #ocaml
<vincenz> morgan ain't here
mrvn_ has quit [Read error: 60 (Operation timed out)]
Submarine has quit ["Leaving"]
Gueben has joined #ocaml
Snark has quit ["Leaving"]
mikeX has joined #ocaml
<mikeX> dpkg java
<mikeX> oops
<pango_> -r of course ;)
<mikeX> : D
ptolomy has joined #ocaml
ptolomy has quit ["leaving"]
pango_ has quit ["bbl"]
Submarine has joined #ocaml
pango has joined #ocaml
solarwind has quit ["leaving"]
mikeX has quit ["Leaving"]
_JusSx_ has joined #ocaml
faigo has joined #ocaml
faigo has quit [Remote closed the connection]
_JusSx_ has quit ["leaving"]
faigo has joined #ocaml
faigo has quit [Remote closed the connection]
_JusSx_ has joined #ocaml
bzzbzz has joined #ocaml
mlh has quit [Client Quit]
flycat has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
bk_ has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
Snark has joined #ocaml
shawn_ has joined #ocaml
<Snark> slt
ramen has quit [Client Quit]
<vodka-goo> hi
joo has joined #ocaml
Submarine has quit ["Leaving"]
shawn_ has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
_JusSx__ has joined #ocaml
<araujo> what 's wrong with: while (let s = read_line() != "quit") do begin print_string s; print_newline() end done;;
<araujo> ?
<smimou> you cannot just do let s = smth
<mrvn> araujo: s is a bool
<smimou> the let should be IN something
<mrvn> That parses as: let s = (read_line() != "quit")
<araujo> :-P
<mrvn> and then it is mising 'in'
<araujo> so, i should do something like:
<araujo> mmmm
<araujo> but how do i add 'in' there?
<mrvn> let rec loop () = let s = read_line(); if s != "quit" then print; foo()
<mrvn> s/;/ in/
<smimou> or use a ref for s if you want a while loop
<araujo> mm.. true
<araujo> mrvn, yeah, thanks. but i wanted to do it imperatively :-)
<araujo> somethihng like: (let s = ref read_line()) != "quit" ?
<mrvn> let s = ref ""; while(s := read_line(); s != "quit"); do ... ?
<smimou> araujo: in ...
<mrvn> let s = ref ""; while(s := read_line(); !s != "quit"); do ... ?
<Snark> mrvn: s/foo/loop/ too, no?
<smimou> idem for mrvn though :p
<mrvn> Snark: ups, absolutely.
<araujo> mm, i didn't know we can use ; inside while <expr> ...
<smimou> expr is just any expression of type bool
<Snark> araujo: use () to force grouping
<araujo> Snark, () = begin .. end right?
<Snark> araujo: I think so
<smimou> yes
<araujo> ok, get it
flycat has quit ["Leaving"]
<araujo> # let s = ref ""; while (s := read_line(); !s = "quit") do print_string !s; print_newline() done;;
<araujo> Warning: this expression should have type unit.
<araujo> This expression has type bool but is here used with type 'a ref
<mrvn> araujo: which one?
<araujo> (s := read_line(
<araujo> the s
<mrvn> s <- read_line()? or just ((s := read_line(); !s = "quit"))?
<araujo> uh]?
<araujo> im getting the error in: (s := read_line(); !s = "quit")
Herrchen has quit ["bye"]
<Snark> araujo: !s = "quit" is a bool
<smimou> 1. I think you want !s <> "quit"
<Snark> uh
<Snark> :-/
<smimou> 2. it works well with let s = ref "" IN ...
* araujo test
<mrvn> let s = ref "";;
<mrvn> let _ = while (s := read_line(); !s = "quit") do print_string !s; print_newline() done;;
<mrvn> or with in as smimou says.
<smimou> I think its better to avoir toplevel declarations first
<smimou> avoid
<mrvn> araujo: let s = ... starts an implizit begin ... end block.
_JusSx_ has quit [Read error: 110 (Connection timed out)]
<araujo> i tried all what you guys said
<araujo> but it doesn't iterate
<mrvn> araujo: !s = "quit" is wrong
<mrvn> !s <> "quit" ot !s != "quit"
<mrvn> or not !s = "quit" or not !s == "quit"
<smimou> du not != nor == !!!
<Snark> mrvn: "toto" = "foo" is wrong?
<smimou> it would never be false
<mrvn> does ocaml have !=?
<smimou> != is for testing physical equality
<smimou> which is certainly not what you want here
<mrvn> # "foo" != "foo";;
<mrvn> - : bool = true
<mrvn> # "foo" <> "foo";;
<mrvn> - : bool = false
<araujo> :-P
<araujo> i see
<araujo> what is the <> for?
<smimou> <> is inequality on values
<smimou> to test if two strings don't have the same contents for example
<smimou> (= !strcmp)
<smimou> (= strcmp, sorry)
vodka-goo has quit []
<araujo> i see
<araujo> thanks
<araujo> and what is the operator for value equality?
<smimou> =
<mrvn> There is = and ==. just try them on a string
<smimou> (== is for checking if the two *pointers* are equal)
<mrvn> It is too bad ocamls = isn't a == | =
<Snark> good night
Snark has quit ["Leaving"]
<araujo> mm..
<araujo> is it the 'else' branch mandatory?
<smimou> no but then the then branch has to be of type unit
<smimou> no else = else ()
<mflux> mrvn, what do you mean? = doesn't do a ==-shortcut?
<mflux> anyway, I wouldn't mind the the physical equality was a function instead of an operator.. having =, ==, <> and != can be confusing ;)
<ulfdoz> cya
Gueben has quit ["plouf"]
mrvn_ has joined #ocaml
<araujo> now im trying a slightly modified version:
<araujo> # let rec edit_loop() = match read_line() with
<araujo> n when n <> "quit" -> ()
<araujo> | p -> begin print_string p; print_newline(); edit_loop() end;;
<araujo> but it doesn't iterate
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]
monochrom has joined #ocaml
<araujo> mm.. i see
<araujo> i need to use '='
<smimou> PS: your begin / end is not necessary here
mrvn__ has joined #ocaml
__DL__ has quit [Remote closed the connection]
<araujo> smimou, yeah, also noticed that
mrvn has quit [Read error: 110 (Connection timed out)]
pango has quit ["Leaving"]
<mflux> araujo, I believe that would be better (more neatly) written as .. "quit" -> () (no n when n.. -stuff)
<araujo> Oh right!!!
<mflux> araujo, btw, that becomes really nice when using streams
mrvn_ has quit [Read error: 110 (Connection timed out)]
pango has joined #ocaml
cjohnson has joined #ocaml
dan2 has joined #ocaml
flycat has joined #ocaml
Submarine has quit ["Leaving"]
flycat has quit [Remote closed the connection]
smimou has quit ["?"]
monochrom has quit ["me!"]
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
<araujo> this doesn't work: Str.string_match;; ?
cjohnson has quit [Remote closed the connection]
mrvn__ is now known as mrvn