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> What's wrong with this: # List.assoc 1 (1, 2);; ?
<mauke> List.assoc has the type 'a -> ('a * 'b) list -> 'b
<TeXitoi> araujo: (1, 2) is a couple, not a list
<araujo> oh right :-/
<araujo> Thanks TeXitoi
<TeXitoi> welcome
Nutssh has joined #ocaml
hangman4 has quit [Read error: 113 (No route to host)]
Smerdyakov has joined #ocaml
hangman4 has joined #ocaml
Smerdyakov has quit [Client Quit]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 145 (Connection timed out)]
<araujo> val establish_server : (in_channel -> out_channel -> unit) ->
<araujo> sockaddr -> unit
<araujo> in_channel: the channel receiving the client data
<araujo> out_channel: the channel senbding the data to the client
<araujo> is it right?
<Nutssh> Sounds right, given the types.
* araujo will test it
humasect has joined #ocaml
Aradorn has quit ["( www.nnscript.de :: NoNameScript 3.81 :: www.XLhost.de )"]
<araujo> Nutssh: other question, im thinking to get the descriptors of every channel
<araujo> Will they contain values with the same type the client sent, or do i need to make some _black_ convertion?
<araujo> Or better, i wouldn't need to get the files descriptor, and i can use them just like that
<Nutssh> Don't know. Reread the library docs?
<araujo> Nutssh: yeah, i found it
<araujo> I can use functions like input_line to get in_channel->string
Nutssh has quit [Read error: 110 (Connection timed out)]
__DL__ has quit ["Bye Bye"]
bk_ has quit [niven.freenode.net irc.freenode.net]
bk_ has joined #ocaml
mflux_ has joined #ocaml
mflux has quit [niven.freenode.net irc.freenode.net]
Banana_ has joined #ocaml
TeXitoi_ has joined #ocaml
cp has quit [niven.freenode.net irc.freenode.net]
dan2 has quit [niven.freenode.net irc.freenode.net]
TeXitoi has quit [niven.freenode.net irc.freenode.net]
skylan has quit [niven.freenode.net irc.freenode.net]
Banana has quit [niven.freenode.net irc.freenode.net]
calvin_ has quit [niven.freenode.net irc.freenode.net]
beta3 has joined #ocaml
skylan has joined #ocaml
calvin_ has joined #ocaml
araujo has quit [K-lined]
cp has joined #ocaml
calvin_ has quit [niven.freenode.net irc.freenode.net]
skylan has quit [niven.freenode.net irc.freenode.net]
ulfdoz_ has quit [niven.freenode.net irc.freenode.net]
Hadaka has quit [niven.freenode.net irc.freenode.net]
vincenz has quit [niven.freenode.net irc.freenode.net]
shrimpx has quit [niven.freenode.net irc.freenode.net]
johs has quit [niven.freenode.net irc.freenode.net]
CLxyz has quit [niven.freenode.net irc.freenode.net]
skylan has joined #ocaml
calvin_ has joined #ocaml
shawn_ has joined #ocaml
CLxyz has joined #ocaml
beta3 has quit [niven.freenode.net irc.freenode.net]
Banana_ has quit [niven.freenode.net irc.freenode.net]
hangman4 has quit [niven.freenode.net irc.freenode.net]
gim has quit [niven.freenode.net irc.freenode.net]
_fab 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]
_shawn has quit [niven.freenode.net irc.freenode.net]
angagon has quit [niven.freenode.net irc.freenode.net]
cognominal has quit [niven.freenode.net irc.freenode.net]
visitor_q has quit [niven.freenode.net irc.freenode.net]
araujo has joined #ocaml
hangman4 has joined #ocaml
_fab has joined #ocaml
visitor_q has joined #ocaml
det has joined #ocaml
cognominal has joined #ocaml
gim has joined #ocaml
araujo has quit [Client Quit]
beta3 has joined #ocaml
Snark has joined #ocaml
mrvn has joined #ocaml
araujo has joined #ocaml
Naked has joined #ocaml
clog has joined #ocaml
mrvn_ has joined #ocaml
mrvn has quit [Read error: 60 (Operation timed out)]
xidaux has joined #ocaml
xidaux has quit [Client Quit]
Skal has joined #ocaml
smimou has joined #ocaml
araujo has joined #ocaml
<araujo> Hello.
<araujo> I don't understand why i can do this in the top level: flush stdout;;
<araujo> But it doesn't work in a source file.
<mrvn_> because sources files don't like ;;
<mrvn_> and can't have an expression.
<araujo> No i mean, sorry, im using , flush stdout; in the source file.
<araujo> mrvn_, i keep getting:
<araujo> File "client.ml", line 20, characters 13-19:
<araujo> This expression has type Unix.file_descr but is here used with type
<araujo> out_channel
<mrvn_> do you shadow stdout?
<araujo> no i don't, wait , i will paste the code
<araujo> there.
<mrvn_> araujo: loose the ;;
<araujo> uh?
<araujo> you mean i remove ;;
<mrvn_> yes
<mrvn_> or rather don't type them in the first place. They are useless.
<araujo> really?
<araujo> mrvn_, i keep getting the same error :-(
<mrvn_> I don't.
<araujo> you don't get the error?
<mrvn_> mrvn@frosties:~% ocamlc -c foo.ml
<mrvn_> mrvn@frosties:~%
<mrvn_> I had to add a few "Unix."
<araujo> mm.. where?
<araujo> Unix.stdout ?
<mrvn_> No, that's where your problem is.
<mrvn_> val stdout : file_descr
<mrvn_> File descriptor for standard output.
<mrvn_> Unix.stdout shadows stdout.
<mrvn_> Don't use open.
<araujo> oh :-P
<araujo> Thanks a lot mrvn_
<araujo> mrvn_, do you know socket programming?
<mrvn_> some
mattam has joined #ocaml
<araujo> Im not getting the expected results with a small example
<araujo> here you can take a look at the server: http://rafb.net/paste/results/SiF8Kd63.html
<araujo> mrvn_, i think the problem is in the client, because the server works fine with telnet for me.
<araujo> Nevertheless, i can't find what im doing wrong
<mrvn_> What do you expect and what do you get?
<araujo> well, i enter a string through the client
<araujo> And i expect the server returns the same strig but in uppercase
<araujo> But when i enter the string in the client, it does nothing.
<mrvn_> do you flush the fd?
<araujo> of the server or the client?
<mrvn_> the client. the server should flush on exit.
<araujo> And the thing is, that it works with telnet
<araujo> mrvn_, take a look: http://rafb.net/paste/results/rRhuYz47.html
<araujo> i flush the out_channel if it is what you mean
<araujo> flush oc;
<mrvn_> consider using gethostbyname instead of inet_addr_of_string
<mrvn_> and add a newline on the error message: Printf.printf "%s <server_address> <server_port>" Sys.argv.(0)
Demitar has joined #ocaml
<mrvn_> araujo: you aren't sending a newline.
<mrvn_> mrvn@frosties:~% nc -l -p 1234
<mrvn_> foo
<mrvn_> (no newline)
<araujo> yeah, right
<mrvn_> mrvn@frosties:~% ./bla 127.0.0.1 1234
<mrvn_> foo
<mrvn_> FOO
<araujo> it worked?
<mrvn_> with newline it does
<araujo> Geez, it works now :-P
<araujo> Thanks mrvn_
<araujo> mmm..
<araujo> mrvn_, so, the problem was that input_line reads until a newline?
<mrvn_> Or until EOF. But you never close the socket on the clients end.
<araujo> Oh, i see
<mflux_> he wouldn't see the response in that case ;)
<mflux_> oh wait, was it supposed to echo the response back to the socket or not? oh well
<mrvn_> you close stdout but not stdin.
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
<mflux_> araujo, you could simply read the input one character at a time and upcase that, or if that feels inefficient you could use the Unix.read-stuff
<mflux_> do note that interleaving buffered and Unix.* is not a good idea
TeXitoi has joined #ocaml
<araujo> Ok, let me see that mflux_
<araujo> mflux_, Unix.read-stuff ?
<mflux_> for example Unix.read, Unix.write, you will need a file descriptor for those
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
<araujo> I see.
<araujo> mflux_, and yes, it was supposed to echo the response back to the socket
TeXitoi has joined #ocaml
<araujo> There is any advantage of using Unix.read,write instead?
_shawn has joined #ocaml
<mflux_> if you're doing a threaded server then I imagine not really, but if you're writing a 'traditional' unix server with a select loop, then they are a must
Skal has quit [Remote closed the connection]
shawn_ has quit [Read error: 110 (Connection timed out)]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
beta3 is now known as dan2
karryall has joined #ocaml
cjohnson has quit [Connection timed out]
Skal has joined #ocaml
cjohnson has joined #ocaml
Gueben has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
Smerdyakov has joined #ocaml
<ulfdoz> hrhr
<ulfdoz> ECHAN, sorry
Smerdy has joined #ocaml
Smerdyakov has quit [Nick collision from services.]
Smerdy is now known as Smerdyakov
Smerdyakov has quit [Client Quit]
vezenchio has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
_JusSx_ has joined #ocaml
TeXitoi_ has joined #ocaml
TeXitoi_ has quit [Read error: 104 (Connection reset by peer)]
TeXitoi_ has joined #ocaml
TeXitoi has quit [Read error: 110 (Connection timed out)]
pango__ has joined #ocaml
Snark has quit [Read error: 60 (Operation timed out)]
Snark has joined #ocaml
pango_ has quit [Read error: 60 (Operation timed out)]
Smerdyakov has joined #ocaml
Gueben has quit ["plouf"]
vezenchio has quit [Read error: 110 (Connection timed out)]
pango__ has quit [clarke.freenode.net irc.freenode.net]
Hadaka has quit [clarke.freenode.net irc.freenode.net]
CLxyz has quit [clarke.freenode.net irc.freenode.net]
pango__ has joined #ocaml
Gueben has joined #ocaml
CLxyz has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
Gueben has quit ["plouf"]
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
<Snark> any ocamlfind guru there?
<Snark> I'm trying to find how to check for the presence of some packages in a configure script
<Snark> the goal would be to fail at configure-time and not compile-time
Msandin has joined #ocaml
<mflux_> ocamlfind list | grep '^package\b' && echo cool ?
<karryall> Snark: ocamlfind query <package name>
<Snark> yes, but what should I put in a configure.in
<Snark> ?
<karryall> I use this:
<karryall> AC_DEFUN([AC_CHECK_OCAML_PKG],
<karryall> [dnl
<karryall> AC_REQUIRE([AC_PROG_FINDLIB])
<karryall> if test "$use_findlib" = yes ; then
<karryall> AC_MSG_CHECKING(findlib package $1)
<karryall> if $OCAMLFIND query $1 >/dev/null 2>/dev/null; then
<karryall> AC_MSG_RESULT(found)
<karryall> pkg_$1="$1"
<karryall> else
<karryall> AC_MSG_WARN(not found)
<karryall> unset pkg_$1
<karryall> fi
<karryall> fi
<karryall> ])
<Snark> may I ask you to paste it on http://www.rafb.net/paste/ and the permission to use it?
_JusSx__ has joined #ocaml
<Snark> thanks
<Snark> wonderful
<Snark> things are taking shape
Smerdyakov has quit ["brb"]
<Snark> now if only ocaml-gettext could be packaged
Smerdyakov has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
TeXitoi has joined #ocaml
<Snark> good night
Snark has left #ocaml []
TeXitoi_ has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit ["brb"]
Submarine_ has joined #ocaml
Submarine_ is now known as Submarine
Submarine has quit [Client Quit]
Msandin has quit [Read error: 145 (Connection timed out)]
Smerdyakov has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
bk_ has joined #ocaml
Gueben has joined #ocaml
Gueben has quit ["plouf"]
xcar has joined #ocaml
vezenchio has joined #ocaml
Smerdyakov has quit ["eat"]
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
_JusSx__ has quit ["leaving"]
Herrchen has quit ["good night"]
mlh_ has joined #ocaml
Smerdyakov has joined #ocaml
Skal has quit [Remote closed the connection]
mlh_ has quit [Client Quit]