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/
gim has quit [Remote closed the connection]
cjohnson has quit [Connection timed out]
smimou has quit ["↓"]
nrb23 has joined #ocaml
nrb23 has quit [Client Quit]
<araujo> How do i include the 'Str' module in a source code file?
<Smerdyakov> You can't control linking in source files.
<Smerdyakov> Read the manual pages.
<araujo> uh?
<Smerdyakov> What?
ulfdoz has joined #ocaml
<araujo> I mean, im using atm something like: Str.string_match
<araujo> what i want to do, is to avoid typing 'Str' every time i use string_match
<Smerdyakov> Two main possibilities.
<Smerdyakov> The "easy way out": open Str
<Smerdyakov> The more refined way: module S = Str
<Smerdyakov> Then: S.string_match
<araujo> mm.. i see
<araujo> it is like declaring S to Str right?
<Smerdyakov> Yes
ulfdoz_ has quit [Read error: 145 (Connection timed out)]
<araujo> Smerdyakov: and.. how do i link it?
<Smerdyakov> Neither of these things changes the way linking works. If it's been working with Str.string_match, it should work with either of these.
<araujo> Smerdyakov: should it work with: ocamlc -o program prog.ml ?
<Smerdyakov> No. Read the manual on the str library.
<araujo> Ok.
<Smerdyakov> That's the Str module.
<Smerdyakov> I mean the str library.
<araujo> where's that?
<Smerdyakov> Read the table of contents.
<araujo> Thanks Smerdyakov
<araujo> streams aren't supported anymore?
Herrchen has joined #ocaml
mlh has quit [Client Quit]
__DL__ has joined #ocaml
Submarine has joined #ocaml
shammah has joined #ocaml
vodka-goo has joined #ocaml
<mflux> araujo, ocamlc -pp camp4o
<mflux> camlp4o even
<mflux> it is only separated from the core
smimou has joined #ocaml
Toots has joined #ocaml
Toots has left #ocaml []
Submarine has quit ["Leaving"]
Snark has joined #ocaml
<Snark> slt
<mflux> what does that mean?
cognominal has quit ["Leaving"]
cognominal has joined #ocaml
cognominal has quit [Client Quit]
cognominal has joined #ocaml
<vodka-goo> mflux: means hi
<vodka-goo> hi in french is "salut"
<mflux> well, salut I would've understood ;)
<Snark> mflux: oh, the question was about "slt"
<Snark> I would have answered
vezenchio has joined #ocaml
bzzbzz has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
bk_ has joined #ocaml
<araujo> mflux: can't i use them from the repl?
vodka-goo has quit []
Snark has quit ["Leaving"]
slashvar[lri] has quit [Read error: 104 (Connection reset by peer)]
cjohnson has joined #ocaml
_JusSx_ has joined #ocaml
<mflux> araujo, repl?
cjohnson has quit [""We live like penguins in the desert...""]
vodka-goo has joined #ocaml
_JusSx_ has quit ["leaving"]
mrvn has joined #ocaml
pango__ has joined #ocaml
[TSP]Aradorn has joined #ocaml
<[TSP]Aradorn> wow there is an actual ocaml chan =p
mrvn_ has quit [Read error: 110 (Connection timed out)]
<[TSP]Aradorn> anyone know a good tutorial on reading in files and parsing them?
<[TSP]Aradorn> i can open the file and read line by line, but cant figure out how to automate the process on an unknown file size
pango_ has quit [Read error: 110 (Connection timed out)]
<mflux> actually, that's somewhat tricky :-o, because input_line throws an exception at the end of the data, and catching that exception must be done before a new recursion level in the loop
<mflux> basically the logic goes like: let rec loop () = let i = input_line stdin in process_line i; loop () in loop ()
<mflux> and that can go inside a try ... with End_of_file -> ()
<mflux> but if you need to return a value from the loop, you need to catch the exception earlier
<[TSP]Aradorn> complicated much =p
Submarine has joined #ocaml
<[TSP]Aradorn> k ill give that a try on the top lvl
<mflux> such as: let rec loop lines = match try Some input_line stdin with End_of_file -> None with Some line -> loop (line::lines) | None -> lines in loop ()
<mflux> Some input_line stdin -> Some (input_line stdin)
<mflux> (writing the code to an editor and reindenting might be useful)
<[TSP]Aradorn> heh yeah
<[TSP]Aradorn> im a java user and im trying to learn ocaml to help out my functional programming skills and god its difficult =p
<mflux> and loop () -> loop []
<mflux> so what kind of tutorials have you been reading?
<[TSP]Aradorn> and the compilers manual for caltech =p
<mflux> (quite) some time ago I found this useful: http://merjis.com/developers/ocaml_tutorial/
<[TSP]Aradorn> i do alot of Natural language processing and functional languages are great for that so im going to pickup ocaml to add to my knowledge base
<mflux> atleast the title fits your description ;)
[TSP]Aradorn is now known as Aradorn
<Aradorn> ah I have looked at that tut
gim has joined #ocaml
<Aradorn> ok im trying to decipher what you gave me earlier
<Aradorn> so basically its a recursive function that goes to the end of the file and builds a list of strings backwards?
<Aradorn> until its back at the start of file (which is the first recursive call)
Snark has joined #ocaml
<Aradorn> word of advice dont tell the toploop to scan a 30 meg text file =p
Msandin has joined #ocaml
<mflux> araujo, the problem with your code is that it isn't tail recursive
<mflux> aradorn even
<Aradorn> yeah got a tail recursive version too just working on learning the ropes of how each works compared to what i know from java
<mflux> aradorn, let rec foo () = try .. foo () with .. means there is a 'catch'-block still around after entering the function again
<Aradorn> right
<mflux> here's something I've used:
<mflux> type ('a, 'b) value = Value of 'a | Exception of 'b
<mflux> let valuefy s = try Value (s ()) with exn -> Exception exn
<mflux> actually let valuefy s arg = try Value (s ararg) with exn -> Exception exn could be better
<Aradorn> so you recurse with the exception and the string each time?
<mflux> so it allows you to write let rec loop lines = match valuefy input_line stdin with Value line -> loop (line::lines) | Exception End_of_file -> lines | Exception exn -> raise exn
<mflux> I imagine most of the time the exception is the cue to finish recursion
<mrvn> or even better: use a parser generator
Aradorn has quit ["( www.nnscript.de :: NoNameScript 3.81 :: www.XLhost.de )"]
<Snark> good night
Snark has left #ocaml []
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
<ulfdoz> re
Herrchen has quit ["good night"]
[TSP]Aradorn has joined #ocaml
<[TSP]Aradorn> man learning this language is actually harder than i expected...
<vodka-goo> new habits :)
<ulfdoz> Everything is better than C. ;)
[TSP]Aradorn has quit ["( www.nnscript.de :: NoNameScript 3.81 :: www.XLhost.de )"]
[TSP]Aradorn has joined #ocaml
bk_ has joined #ocaml
Submarine has quit ["Leaving"]
<[TSP]Aradorn> ok when i goto compile a file into bytecode i get this error:
<[TSP]Aradorn> let f x = x + 1;;
<[TSP]Aradorn> print_int (f 18);;
<[TSP]Aradorn> print_newline();;
<[TSP]Aradorn> err dangit
<[TSP]Aradorn> Fatal error: cannot open pervasives.cmi
<[TSP]Aradorn> Fatal error: exception Misc.Fatal_error
<[TSP]Aradorn> anyoen know why?
<vodka-goo> that's one I never had... don't understand :(
<[TSP]Aradorn> hrm wonder if its because im using windows...
<vodka-goo> ocamlc -c your.ml works for me
<[TSP]Aradorn> i get the same error as above
<vodka-goo> I cannot test with w$, sorry
<[TSP]Aradorn> gah this sucks
__DL__ has quit [Remote closed the connection]
Msandin has quit [Read error: 131 (Connection reset by peer)]
<[TSP]Aradorn> woot fixed it =p
<[TSP]Aradorn> if i have a queue which is implemented using a list and i need to get the head of that list can i do: let x = q.c.hd ??
mlh has joined #ocaml
<vodka-goo> if the implementation is hidden by the interface, no
<vodka-goo> in most of the case one writes a head function, in the module where queue = list is known
<araujo> mflux: yes, the read-eval-print-loop
<ulfdoz> cya
mrpingoo has joined #ocaml
[TSP]Aradorn has left #ocaml []
[TSP]Aradorn has joined #ocaml
<[TSP]Aradorn> hrm stupid irc is acting up
gim has quit [No route to host]
gim has joined #ocaml
vodka-goo has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["Ayn Rand encapsulates the rage that every teenager feels on finding that his first paycheque has had taxes taken out of it"]