Yurik changed the topic of #ocaml to: http://icfpcontest.cse.ogi.edu/ -- OCaml wins | http://www.ocaml.org/ | http://caml.inria.fr/oreilly-book/ | http://icfp2002.cs.brown.edu/ | SWIG now supports OCaml| Early releases of OCamlBDB and OCamlGettext are available
aleksi has joined #ocaml
docelic has joined #ocaml
SoreEel has joined #ocaml
docelic has quit ["Client Exiting"]
kjs3 has quit ["using sirc version 2.211+KSIRC/1.2.1"]
jao is now known as jao_away
lament has joined #ocaml
vom_Fenster has quit ["Trillian (http://www.ceruleanstudios.com)"]
docelic has joined #ocaml
docelic has quit ["Client Exiting"]
docelic has joined #ocaml
docelic has quit ["later"]
docelic has joined #ocaml
olczyk has joined #ocaml
<olczyk> Anyone here?
olczyk has quit []
giedi has joined #ocaml
mattam has joined #ocaml
mattam_ has joined #ocaml
mattam has quit [Read error: 60 (Operation timed out)]
karryall has joined #ocaml
mattam_ is now known as mattam
lament has quit ["night"]
mattam has quit [forward.freenode.net irc.freenode.net]
mattam has joined #ocaml
vom_Fenster has joined #ocaml
giedi has quit ["Client Exiting"]
xmkl has quit [forward.freenode.net irc.freenode.net]
asqui has quit [forward.freenode.net irc.freenode.net]
whee has quit [forward.freenode.net irc.freenode.net]
xmkl has joined #ocaml
asqui has joined #ocaml
whee has joined #ocaml
Dalroth has joined #ocaml
whee has quit [forward.freenode.net irc.freenode.net]
asqui has quit [forward.freenode.net irc.freenode.net]
xmkl has quit [forward.freenode.net irc.freenode.net]
xmkl has joined #ocaml
asqui has joined #ocaml
whee has joined #ocaml
Demitar has joined #ocaml
<Demitar> Is it just me or is caml.inria.fr down?
<whee> it appears to be down
<whee> :(
<whee> ocaml.org is still up, though
<Demitar> Yes, I noticed.
TachYon25 has joined #ocaml
olczyk has joined #ocaml
<olczyk> ANyone?
<olczyk> Anyone here?
<whee> olczyk: what's up?
<olczyk> I'm confused by a simple thing in stack.ml
<olczyk> type a t= {mutable c; 'a list}
<olczyk> let create() ={ c=[]}
<olczyk> How does the compiler "know" that it is supposed to create a t and return it?
<olczyk> Sorry. type 'a t= {mutable c; 'a list}
<whee> well the only record type there that has 'c' as a field is of type t
<whee> so by creating a record with c = [], it has to be of that type
<olczyk> That's sort of what I though, but it seems a bit of a stretch.
<olczyk> SO anytime I need to create a record of type t, I just type: let ins=c=[];;?
<olczyk> let ins=c=soemthing;;? (it might not be []
<whee> you need braces around records, always
<whee> so let ins = {c = blah}
<olczyk> OK.
Demitar has quit ["BitchX-1.0c19 -- just do it."]
olczyk has quit [Read error: 60 (Operation timed out)]
hdaume has joined #ocaml
<hdaume> is there a single-line comment in caml, like // in C/Java or -- in Haskell?
<mattam> how to cast an object to its superclass ?
<mattam> found it!
Dalroth has quit [Remote closed the connection]
asqui has quit [Read error: 60 (Operation timed out)]
Dalroth has joined #ocaml
asqui has joined #ocaml
<mattam> hmmm... the object type system's not so nice, i always have to cast to superclasses. Maybe i'm wrong with something ?
two-face has joined #ocaml
<two-face> yo
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
two-face has quit ["Client Exiting"]
intero has joined #ocaml
<intero> hi all
<intero> i need a function that takes two lists and a counter
<whee> and does what :P
<intero> and returns how many elements of the first list are into the second
<intero> :)
<intero> can i paste the code?
<intero> i dont understand where i am wrong
<whee> sure
<intero> let rec ball (lsta,lstb) =
<intero> match (lsta,lstb) with
<intero> ([],_) -> acc
<intero> | (_,[]) -> acc
<intero> | (x::xs,y::ys) -> if x=y then ball ((xs,ys) acc+1) else ball ((xs,ys) acc);;
<intero> thanks
<whee> is it returning 0 all the time?
<intero> nope it doesnt compile
<whee> oh, acc is undefined
<intero> # Toplevel input:
<intero> # let rec ball (lsta,lstb) =
<intero> match (lsta,lstb) with
<intero> ([],_) -> acc
<intero> ^^^
<intero> | (_,[]) -> acc
<intero> | (x::xs,y::ys) -> if x=y then ball ((xs,ys) acc+1) else ball ((xs,ys) acc);;
<whee> you want to define acc somewhere
<intero> Unbound value acc
<whee> typically what people do is something like:
<whee> let ball lista listb =
<whee> let rec ball' lista listb acc = ....
<whee> in ball' lista listb 0
<intero> mmm let me try that
<intero> let rec ball' lista listb acc = ....
<intero> currification ?
<whee> yeah, I always do currying
<intero> but
<whee> you can curry the function call and match with tuples like you are
<intero> how can i check if the lists are [] then?
<whee> same way you do now
<whee> match (lista, listb) with ..
<intero> but if i curry it
<intero> it's not a couple anymore?
<whee> no, it's not, but it'll be made one when match gets to it
<intero> or should i study more?
<whee> well actually it probably will get optimized out by the compiler but still :)
<intero> mmm let me see
<intero> brb :P
<whee> the function accepts two curried arguments, then match goes and constructs a tuple of those two to match again
<whee> +st
<intero> | (x::xs,y::ys) -> if x=y then ball (xs ys acc+1) else ball (xs ys acc);;
<intero> ^^
<intero> This expression is not a function, it cannot be applied
<whee> the tuple construction most likely doesn't really happen, but it's still a tuple
<whee> rmove the parens
<intero> ok
<whee> and you probably want (acc+1)
<whee> make sure you're calling the recursive version of ball as well
<whee> I don't know how well that function would work though, it would only notice that the element exists in both if the element is in the same position in both lists
<intero> thats what i need :P
<intero> it does compile now
<intero> and works fine too
<intero> thanks alot :)
<intero> how long did you use ocaml for?
<whee> year or two
<intero> how did you find out?
<whee> I haven't been seriously into using it until this year, though
<intero> well i think you didnt lost shape :P
<intero> didnt lose
<intero> boh
<whee> I don't know when I started
<intero> i have a course at uni
<whee> I think I found out when I was looking at that stupid computer language shootout
<intero> i dont think i'd have ever find out otherwise
<whee> then I figured I should learn ocaml if it's rated #1, regardless if the benchmarks are flawed anyway :P
<intero> hehehe
<intero> what can you use it for?
<whee> pretty much anything. heh
<intero> lol
<intero> great
<whee> I write little programs to further my lazy ways
<intero> i thought i had not many possibilities
<hdaume> now that people are actually talking, is there a single-line comment in ocaml?
<whee> http://smaerty.ath.cx/scheduler/full_output.txt <- something I wrote the past couple days
<whee> hdaume: nada
<whee> although you can add that with camlp4, if you must have it :)
<hdaume> whee: darn
<intero> whee: my battery is leaving me
<intero> i'll be around
<intero> thanks alot for ur help
<intero> good physics proggies :)
<intero> take care
<whee> bye~
<intero> bye bye
intero has left #ocaml []
Kinners has joined #ocaml
<asqui> In caml light what are the available string parsing functions?
Dalroth has quit []
<whee> asqui: probably not much. around the same as ocaml I think
<whee> have you checked the manual?
<asqui> no ic ant access it atm
<whee> looks like you get regular expressions with str and pretty much the same as ocaml in the string library
<whee> geh, homework to do. bbl
lament has joined #ocaml
gl has joined #ocaml
engstad has joined #ocaml