docelic is now known as docelic|sleepo
ctkrohn has joined #ocaml
skylan has quit [Read error: 54 (Connection reset by peer)]
skylan_ has joined #ocaml
skylan_ is now known as skylan
Kinners has joined #ocaml
samx has joined #ocaml
ctkrohn is now known as ctkrohn|away
samx has left #ocaml []
Smerdyakov has joined #ocaml
themus has quit ["Client Exiting"]
whee has quit [Read error: 110 (Connection timed out)]
TachYon has joined #ocaml
docelic|sleepo is now known as docelic
lam has left #ocaml []
lam has joined #ocaml
TachYon has quit [Remote closed the connection]
TachYon has joined #ocaml
vegai has joined #ocaml
TachYon has quit [Remote closed the connection]
docelic has quit [Read error: 60 (Operation timed out)]
miph has joined #ocaml
docelic has joined #ocaml
docelic has quit ["Client Exiting"]
cDlm_ has joined #ocaml
cDlm has quit [Read error: 60 (Operation timed out)]
Kinners has quit [Read error: 110 (Connection timed out)]
cDlm_ is now known as cDlm
phubuh has quit ["Lost terminal"]
lam has quit ["leaving"]
lam has joined #ocaml
lus|wazze has joined #ocaml
CybeRDukE has joined #ocaml
lus|wazze has quit ["sul °°"]
TachYon has joined #ocaml
CybeRDukE has quit ["Error: Sector not found -- search behind couch? (Y/N)"]
mattam_ has joined #ocaml
Smerdyakov has quit []
TachYon has quit [Remote closed the connection]
lam has left #ocaml []
lam has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
ctkrohn|away is now known as ctkrohn
ctkrohn is now known as ctkrohn|away
systems has joined #ocaml
whee has joined #ocaml
mrvn_ has joined #ocaml
kmag has joined #ocaml
<kmag> I have a newbie question:
<kmag> I'm trying to make a Unix socket part of a record
<kmag> type fcp_doc = {uri : string; size : int; sock : Unix.file_desc };;
<kmag> bash-2.05b$ ocamlc unix.cma fcp.ml
<kmag> File "fcp.ml", line 1, characters 49-63:
<kmag> Unbound type constructor Unix.file_desc
<kmag> bash-2.05b$
systems has quit [Read error: 60 (Operation timed out)]
<kmag> can anyone give me any pointers as to why this happens?
vincenz has joined #ocaml
<kmag> Hi vincenz
<Smerdyakov> You aren't including the right library when you compile?
<kmag> unix.cma isn't the right library?
<Smerdyakov> I think there is a separate interface vs. actual code.
<Smerdyakov> You might need to specify the interface to include.
<Smerdyakov> I'm new to this, too, so I can't say any more than that.
<whee> I think you meant file_descr
mrvn has quit [Read error: 110 (Connection timed out)]
<kmag> thanks. I made sock of type int and looked at the compile errors later to copy and paste the type... and pasted wrong
<kmag> that compiles
vincenz has quit ["KVIrc 3.0.0-beta1 "Eve's Avatar""]
Vincenz has joined #ocaml
<Vincenz> Hiya
<teratorn> does anyone know if String.sub get's optimized away in cases where there is no reason to create a seperate string?
<mellum> I don't think it does
<teratorn> :(
<mrvn_> teratorn: Why whouldn't there be?
<mrvn_> let foo () = let s = String.create 1000000 in String.sub s 100 100
<mrvn_> Should it keep the 1 MB string just so that you don't have to copy the 100 byte substring?
mrvn_ is now known as mrvn
<teratorn> that example in nonsensical
<mrvn> give a better one
<teratorn> well say i need to add a substring to a Buffer
<mrvn> Then you blit it
<teratorn> there's no need to store a seperate sub string, so it could, in theory, just copy out of the original string into the buffer
<teratorn> mrvn: er?
cDlm has left #ocaml []
<mrvn> val blit : string -> int -> string -> int -> int -> unit
<mrvn> String.blit src srcoff dst dstoff len copies len characters from string src, starting at character number srcoff, to string dst, starting at character number dstoff. It works correctly even if src and dst are the same string, and the source and destination chunks overlap. Raise Invalid_argument if srcoff and len do not designate a valid substring of src, or if dstoff and len do not designate a valid substring of dst.
<teratorn> yeah i know about blit
<mrvn> Then use it instead of first making a substring
<teratorn> but i don't see how it's applicable here
<teratorn> how can i blit into a buffer?
<teratorn> Buffer, i mean.
systems has joined #ocaml
<mrvn> module Buffer?
<mrvn> val add_substring : t -> string -> int -> int -> unit
<mrvn> add_substring b s ofs len takes len characters from offset ofs in string s and appends them at the end of the buffer b.
<mrvn> which will blit the string.
<teratorn> ah, well isn't that handy :)
<mrvn> But that will most likely copy the Buffer.
<mrvn> The Buffer module kind of sucks.
<teratorn> oh
kmag has quit [Read error: 60 (Operation timed out)]
<mrvn> Buffer uses exactly one string for buffering. That means it has to grow/shrink the string quite a lot. Also its limited to 16Mb
<mrvn> I wrote my own Buffer module that works with a circular list of strings of fixed length. New strings are added at the end as needed and freed at the start when emptyed. Its more stream orientated.
<teratorn> that's very interesting
<teratorn> i'm using Buffer to read everything off stdin into a string
<teratorn> perhaps your implementation would be better?
<mrvn> No, streams would be better.
<mrvn> Or do you need random access to the input?
<teratorn> no i pretty much just need to walk the input, char at a time
<mrvn> then use a stream
<teratorn> or well actually
<mrvn> or use the parser generator
<teratorn> i do need random access
<teratorn> im parsing the input into words, and i have to do things with those words
systems has quit ["Client Exiting"]
<mrvn> make a stream that reads the input in say 4K chunks into a string and returns a char at a time till the 4K are done. then read the next block and so on.
<mrvn> Or split it into words and make a stream of words.
<mrvn> or use the parser module.
<teratorn> hmm
<mrvn> /generator
<teratorn> interesting stuff
CybeRDukE has joined #ocaml
CybeRDukE has quit ["A program is a device used to convert data into error messages."]
kmag has joined #ocaml
systems has joined #ocaml
kmag has quit [Read error: 60 (Operation timed out)]
lus|wazze has joined #ocaml
mattam_ is now known as mattam
systems has quit ["Client Exiting"]
Smerdyakov has quit ["harumph"]
ctkrohn|away is now known as ctkrohn
TachYon has joined #ocaml
<ctkrohn> Hi, I'm just learning ocaml, and am having problems with a certain function. The ocaml interpreter tells me that I am applying a function to too many arguments, but I think I'm only applying it to one argument -- the number of arguments which the function takes.
<ctkrohn> Here's the definition:
<ctkrohn> let rec get_possible_moves pos =
<ctkrohn> and the line in question is: | X | O -> get_possible_moves (pos + 1)
<ctkrohn> I type the entire function into the interpreter, and it highlights the "get_possible_moves" and says "This function is applied to too many arguments."
NhJm has joined #ocaml
NhJm has left #ocaml []
<lus|wazze> what comes immediately after that line?
<lus|wazze> and immediately before, as well
<ctkrohn> oh, hrm... I noticed I was accidentally pasting a line in there that I shouldn't have been pasting. OK, so now I'm getting a different set of errors.
<ctkrohn> "This expression has type int list but is here used with type unit"
<ctkrohn> Doesn't () represent the empty list, or is that only the unit type?
* ctkrohn gets out his PDF
<lus|wazze> no () is the unit value
<lus|wazze> [] is the empty list
<ctkrohn> ah, ok
<ctkrohn> lemme try that then
<ctkrohn> ah, there we go.
<ctkrohn> thanks.
kmag has joined #ocaml
TachYon has quit [Read error: 54 (Connection reset by peer)]
TachYon has joined #ocaml
TachYon has quit [Remote closed the connection]
kmag has quit [Read error: 60 (Operation timed out)]