headache has quit ["I'll be back"]
jdrake has joined #ocaml
Xcalibor has quit ["Terminando cliente"]
foxster has joined #ocaml
lus|wazze` has joined #ocaml
<
lus|wazze`>
whoops wrong channel
lus|wazze has quit [Read error: 110 (Connection timed out)]
jdmarshall has joined #ocaml
jdrake has quit [calvino.freenode.net irc.freenode.net]
jdrake has joined #ocaml
foxster has quit [Read error: 104 (Connection reset by peer)]
avn has quit [Read error: 113 (No route to host)]
jdrake has quit ["Oops. This machine just fell asleep"]
jdmarshall has quit ["ChatZilla 0.8.31 [Mozilla rv:1.4/20030624]"]
bk_ has joined #ocaml
mattam_ has joined #ocaml
phubuh has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
Kinners has joined #ocaml
buggs|afk is now known as buggs
Kinners has quit [Read error: 60 (Operation timed out)]
Kinners has joined #ocaml
__DL__ has joined #ocaml
two-face has joined #ocaml
<
two-face>
Mein Freund!
buggs has quit ["maybe it crashed"]
lus|wazze` has quit ["The Ogre philosopher Gnerdel believed the purpose of life was to live as high on the food chain as possible. She refused to e]
buggs has joined #ocaml
det has joined #ocaml
det has quit [Remote closed the connection]
det has joined #ocaml
systems has joined #ocaml
systems has quit ["Client Exiting"]
whiskas has joined #ocaml
<
whiskas>
quick question: what does the "in" keyword (or what it's called) do?
<
whiskas>
I'm currently reading hickeys book
<
two-face>
let a = foo in let b = a
<
smkl>
it's a part of the "let .. = .. in .." expression
<
Kinners>
it says, use these bindings in this context
<
phubuh_>
it's kind of like an open brace in a C-like language
<
whiskas>
humm.. I know I'm stupid
<
whiskas>
but I'm not 100% clear about this
<
smkl>
"let p = e1 in e2" first evals e1, then binds the value to pattern p, then evals e1 ... in the context of e2, the bindings of p are available
<
Maddas>
it's for the scope, so to say
<
smkl>
err, then evals e2
<
Maddas>
the expression after "in" is the scope which the definition is valid in, that's how I memorized it ;)
<
whiskas>
ok, now seems to be clearer
<
whiskas>
thanks :P
<
whiskas>
so in let p = e1 in e2 first evals e1, then evals e2 in the context of e1 then binds e1 to p?
<
whiskas>
did I get it right?
<
whiskas>
wait, that doesn't make sense
<
Maddas>
I'm not sure.. let p = e1 in e2 means that p is bound to e1 in the expression e2
<
Maddas>
let x = 10 in x*x
<
whiskas>
ok, so e1 is evaled in e2 context then bound to p, right?
<
Maddas>
I really don't know what you mean with "evaluated in e2 context", sorry
<
Kinners>
whiskas: e1 is evaluated before anything to do with e2
<
whiskas>
ok, so why is this not valid? let a = 10 in let b = a + 3;;
<
whiskas>
syntax error
<
smkl>
whiskas: because the let expression needs to have form "let .. in .."
<
Kinners>
whiskas: let e1 = e2;; is a module level binding
<
Maddas>
let a = 10 in let b = a + 3 in b;;
<
whiskas>
now I'm really confused
<
Maddas>
Indenting can help.
<
Maddas>
ah, I see, two-face pasted the let a = foo in let b
<
Kinners>
whiskas: you're thinking in an imperative style, with variables :)
<
Kinners>
whiskas: in your example, what is 'b'? is it meant to be a global (module) variable?
two-face_ has joined #ocaml
<
Maddas>
of course "let .. = .. in" is not only for simple variables but also for functions
<
whiskas>
auci, this is really hard :(
<
Maddas>
It's not really hard, it's just different :)
<
Maddas>
whiskas: do you know any other languages?
<
whiskas>
C++, of course
<
Kinners>
whiskas: the thing is, they're called bindings because they're not variable once they're bound
<
whiskas>
ouch, how come?
<
Maddas>
You can't modify a binding.
<
Maddas>
Well, not anything un-mutabel :)
<
Maddas>
mutable, even
<
Maddas>
let a = 10;; (* a is 10, forever, until you declare a new "a" *)
<
whiskas>
this is clear
<
Kinners>
one of the tenets of functional languages is not having side effects
<
whiskas>
yeah, so it seems
<
Maddas>
I think the book explains it pretty well :)
<
whiskas>
which one?
<
Maddas>
the one by jason hickey
<
whiskas>
ok then, I'll just keep on reading ;)
<
whiskas>
thanks for the hints
* whiskas
is away: Whatever
<
Maddas>
Well, you might just want to do a few simple examples or so yourself
<
Kinners>
so let a = 10 in let b = a * a;; doesn't make sense in those terms, the side effect of the a = 10 expr would be to change the global b
two-face has quit [Read error: 110 (Connection timed out)]
Kinners has left #ocaml []
* whiskas
is back (gone 00:41:07)
<
whiskas>
I don't understand this piece of code... if anyone can help, I'll be more than happy
<
whiskas>
let is_one = fun 1 -> true;;
<
two-face_>
is_one 1 should give true
<
vegai>
is there some part of it specifically that you don't get?
<
whiskas>
how is this a function, if the argument ain't a variable
<
whiskas>
know what I mean?
<
whiskas>
umm... so to to grasp this?
<
vegai>
I'm pondering how to explain this
<
Smerdyakov>
The behavior of the function in non-1 is to raise a Match failure.
<
Smerdyakov>
Just like if you did:
<
Smerdyakov>
let 1 = 2 in ...
<
vegai>
if I got it right, he expects something that looks like "let is_one a = if a == 1 then true..." and doesn't get the idea of fun there
<
vegai>
(forgive my pseudosyntax)
<
whiskas>
yeah, something like thata
<
whiskas>
again, excuse me for being such a newbie
<
Maddas>
You are pattern matching
<
Maddas>
If I remember correctly, your example is equivalent to this:
<
Maddas>
(well, it does the same thing, but not in exactly the same way)
<
Maddas>
let is_one x = match x with 1 -> true;;
<
whiskas>
now I got it
<
whiskas>
thanks a lot
<
vegai>
4.2. especially
<
whiskas>
that's what I'm reading :)
<
mellum>
WTF? My program spends 2.33% of its time in string_length... why isn't that inlined?
<
whiskas>
mellum: don't I know you from somewhere? :D
<
vegai>
whiskas: yes, 4.2 explains fun
<
whiskas>
well, it seem not for stupid people
<
mellum>
whiskas: probably :)
<
vegai>
no, actually it's earlier, in "3.1 Functions"
<
whiskas>
let me re-read that again
<
vegai>
...but the pattern-matching part in 4
two-face_ has quit ["Client exiting"]
* whiskas
is away: Whatever
<
whiskas>
how is ocaml in respect to network programming?
<
whiskas>
maaan, this is waaaaay harder than I expected
<
phubuh_>
i find it pretty nice
<
phubuh_>
i have a direct connect client in progress that uses non-blocking sockets -- i could put the code on the web for you to look at
<
vegai>
whiskas: mldonkey (a wide p2p-app) at least works quite nice
<
vegai>
no idea about its code
<
whiskas>
yeah, so I heard
<
vegai>
that's the most impressive ocaml-program I've tried yet
<
vegai>
most impressive I know, also
<
whiskas>
stupid question: if ocaml is so cool, why isn't it used more widely?
<
phubuh_>
paul graham wrote an article about that if you substitute "lisp" for "ocaml"
<
vegai>
even though c++ sucks so much, why does everyone use it? =)
<
vegai>
s/does/do I guess
<
phubuh_>
most of it applies to ocaml as well
<
vegai>
a good answer in a haskell book I was just reading (School of Expression, probably)
<
vegai>
a language has to fill some niche to be successful
<
vegai>
ocaml's niche might be extreme power combined with a quite elegant language
<
vegai>
perhaps that's not enough, though
<
vegai>
slightly OT, but whoa! "Xmule Developer gets Subpoenaed"
<
vegai>
"...originating from the RIAA/MPAA". Bastards
tmilford has joined #ocaml
buggs has quit [Read error: 54 (Connection reset by peer)]
buggs has joined #ocaml
<
Maddas>
phubuh_: I'd love to see your source :)
<
phubuh_>
the tar format is sadly stream-based, so unpacking the 2 KB of code from this ~1 GB archive is going to take a while
<
phubuh_>
otoh that'll give me time to go pick up the pizza i ordered
<
Maddas>
heh. " If you want to trick a pointy-haired boss into letting you write software in Lisp, you could try telling him it's XML."
<
whiskas>
c ya tomorrow, folks
<
whiskas>
thanks for all the help
whiskas is now known as whiskas|off
* whiskas|off
is back (gone 00:36:24)
* whiskas|off
is away: Whatever
<
phubuh_>
i'm back, and file-roller has finally opened the archive
<
phubuh_>
now to extract
<
bk_>
parts of "Crash Bandicoot" were apparently written in LISP, heh
<
phubuh_>
much of it was
<
bk_>
i was very surprised when i found out about that
<
Maddas>
wow bk_ :)
tmilford has quit [Read error: 104 (Connection reset by peer)]
__DL__ has quit [Read error: 110 (Connection timed out)]
__DL__ has joined #ocaml
polin8 has joined #ocaml
Xcalibor has joined #ocaml
mattam_ is now known as mattam
lus|wazze has joined #ocaml
malc has joined #ocaml
jdrake has joined #ocaml
<
jdrake>
friends, I have a problem with modules
<
jdrake>
By doing what the manual says, I tried to create a module named UserInput, and compiled fine
<
jdrake>
going to the toplevel, i then opened, it - no errors. Then trying to use the stuff inside it - Reference to undefined global `UserInput'
<
malc>
how about loading it?
<
jdrake>
you mean #load?
<
malc>
either that or #use, my memory fails me recently
<
jdrake>
i can't get #load to work
<
jdrake>
i have never actually been able to get it to work
<
jdrake>
something about how I am entering
<
jdrake>
# #load UserInput
<
jdrake>
Syntax error
<
Smerdyakov>
It's for filenames....
<
malc>
uh.. quote it
<
malc>
#load "UserInput"
<
Smerdyakov>
#load "somefile.cmo";;
<
jdrake>
that seems to work
<
jdrake>
now - why doesn't open work
<
jdrake>
i haven't actually tried writing a program with this yet, but open is how I would be using it
<
Smerdyakov>
Actually, open does work.
<
Smerdyakov>
Problem solved!
<
jdrake>
how do you explain this:
<
jdrake>
# open UserInput;;
<
jdrake>
# UserInput.prompt;;
<
jdrake>
Reference to undefined global `UserInput'
<
malc>
where's #load?
<
jdrake>
why should I have to use #load, when I don't do that for something like List
<
jdrake>
or is that a pervasive
<
malc>
because ocaml is prebuilt with stdlibrary
<
jdrake>
and one more question -
<
malc>
you can use ocamlmktop if you are so anal
<
jdrake>
I don't want to hear anything relating to an anus ps
<
jdrake>
why does the standard library not use the module and struct stuff, and just have plain files
<
Xcalibor>
the Pervasives module is #loaded into the toplevel automagically+
<
jdrake>
i understand that now
buggs is now known as buggs|afk
bk_ has quit ["I'll be back"]
bk_ has joined #ocaml
Xcalibor has quit ["Terminando cliente"]