Begbie has joined #ocaml
karlm has joined #ocaml
<
karlm>
hey, so it's my first day with Ocaml...
<
karlm>
ad I'm looking at the manual
<
karlm>
I'm a bit ocnfused about exactly the syntaxt of pattern matching for destructuring lists
<
karlm>
what's the meaning of the pipe in there ?
<
karlm>
wow, the more complicated examples actually make more sense
<
karlm>
so match acts like a case-switch in your C-derrived languages
<
karlm>
and the pipe seperates cases
vaibhav has quit [Read error: 110 (Connection timed out)]
karlm has left #ocaml []
Begbie has quit ["restarting X"]
smkl has quit [card.freenode.net irc.freenode.net]
mr_bubbs has quit [card.freenode.net irc.freenode.net]
pnou has quit [card.freenode.net irc.freenode.net]
Segora has quit [card.freenode.net irc.freenode.net]
lam has quit [card.freenode.net irc.freenode.net]
emu has quit [card.freenode.net irc.freenode.net]
smkl has joined #ocaml
mr_bubbs has joined #ocaml
lam has joined #ocaml
Segora has joined #ocaml
pnou has joined #ocaml
emu has joined #ocaml
cleverdra has joined #ocaml
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
systems has joined #ocaml
systems has quit [Read error: 104 (Connection reset by peer)]
graydon has joined #ocaml
teeku has joined #ocaml
<
teeku>
join #haskell
<
mr_bubbs>
did you miss a / ?
<
cleverdra>
Yes, he did.
<
teeku>
yep... sorry 'bout that
<
mr_bubbs>
didn't understand if you were telling me to or if you messed up, hehe
<
mr_bubbs>
I see you are watching the channel, cleverdra
<
cleverdra>
Which channel?
<
mr_bubbs>
this one
ayrnieu has joined #ocaml
Dalroth has joined #ocaml
cleverdra has quit [Read error: 110 (Connection timed out)]
mrvn has quit [card.freenode.net irc.freenode.net]
xtrm has quit [card.freenode.net irc.freenode.net]
merriam has quit [card.freenode.net irc.freenode.net]
xtrm has joined #ocaml
mrvn has joined #ocaml
merriam has joined #ocaml
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
karlm has joined #ocaml
<
karlm>
I'm a little confused on teh ocaml sytaxt. This is only my second day with ocaml.
<
karlm>
I'm trying to close a socket after reding from it, butreturn the value of the read.
<
karlm>
class http_peer (name : string)(port : int) =
<
karlm>
val mutable cookies = Array.create 10 (None : cookie)
<
karlm>
val sock = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0
<
karlm>
val sock_addr = Unix.ADDR_INET(Unix.inet_addr_of_string name, port)
<
karlm>
method get (url : string) (buf : string) =
<
karlm>
Unix.connect sock sock_addr;
<
karlm>
Unix.send sock (String.concat "" ["GET "; url ;"\015\012"]) 0 (6 + String.length url) [];
<
karlm>
Unix.read sock buf 0 (String.length buf) and Unix.close sock;
<
karlm>
method close =
<
karlm>
Unix.close sock
<
karlm>
preferably the close would go at the end of method get
<
ayrnieu>
You have a syntax question?
<
karlm>
right, so Ican't use a let inside the method, nor a val.
<
karlm>
Wat isthe proper sytaxt for making assignment within a method?
<
ayrnieu>
Why can't you use let inside the method?
<
karlm>
Not sure... I can't get the syntax to work out.
<
karlm>
"in" binds a name only for the next expression, right?
<
ayrnieu>
Right. Use parentheses.
<
karlm>
let len = Unix.read sock buf 0 (String.length buf) in
<
karlm>
(Unix.close sock; len)
<
karlm>
is that right?
<
smkl>
you can have let a = b in c ; d ; e ... that will bind a in all of them
<
karlm>
thanks... it compiles now...
<
karlm>
seems to run fine. Thanks a bunch.
<
karlm>
Any idea where I can getdocumentation on the bytecode and interpreter?
<
ayrnieu>
What kind of documentation?
<
karlm>
Much prettier than the .fr site!
<
ayrnieu>
Yes, I like the Camel-picture. It's also a link to camel-worship.txt, which is interesting.
<
karlm>
I assume the bytecode interpreter is a stack-based vm?
erg has joined #ocaml
<
karlm>
smkl : btw, where did you find that link?
<
smkl>
karlm: just saw it once
<
karlm>
seen an ocaml bytecode interpreter in java?
<
smkl>
i've never tried it
erg has quit ["class."]
teeku has left #ocaml []
<
karlm>
Anny efforts to make an ocaml bytecode JIT compiler?
<
ayrnieu>
Why? It already compiles to native code.
<
karlm>
so you could make it trusted.
<
karlm>
simultaneously
<
ayrnieu>
A JIT on an incompatibly-designed platform would be faster than OCaml's own native-code generator?
<
ayrnieu>
I'm not familiar with 'trusted', I imagine that there are technical equivalents, though perhaps less of a 'drop-in' nature.
<
ayrnieu>
I don't know of such an effort, sorry.
<
karlm>
one advantage of a JIT is that you can continuosly profile and re-optimize your code.
<
karlm>
HP made a PA-RISC emulator that ran on PA-RISC, jsut for kicks.
<
karlm>
It ran some code faster than native.
<
ayrnieu>
hmm, I don't deny that a lot of intelligence has been directed at the area.
<
karlm>
Too bad HP sunk so much intothe Itanic.
systems has joined #ocaml
systems has quit ["Client Exiting"]
karlm has quit [Read error: 110 (Connection timed out)]
mrvn_ has joined #ocaml
two-face has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
ayrnieu has quit [Read error: 110 (Connection timed out)]
two-face has left #ocaml []
Dalroth has quit []
gl has quit [No route to host]
vaibhav has joined #ocaml
malc has joined #ocaml
vaibhav has quit [Read error: 110 (Connection timed out)]
vaibhav has joined #ocaml
vaibhav has quit [Read error: 110 (Connection timed out)]
vaibhav has joined #ocaml
malc has quit [Read error: 110 (Connection timed out)]
karryall has quit [card.freenode.net irc.freenode.net]
karryall has joined #ocaml