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/
paganini has joined #ocaml
paganini has quit ["Leaving"]
Smerdyakov has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
Herrchen has joined #ocaml
Herrchen_ has quit [Read error: 60 (Operation timed out)]
Smerdyakov has quit ["I'm gone."]
monochrom has quit ["good morning, sweet dream"]
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
mlh_ has joined #ocaml
petter_ has joined #ocaml
mlh has quit [Client Quit]
Tue16499 has joined #ocaml
<Tue16499> if i have a "if .. then .." then i guess the thenexpression is obliged to return a value of type unit no?
<mellum> Tue16499: yes
<mellum> "else ()" is implied, and the types need to match.
<Tue16499> thought so
<Tue16499> ty
<Snark> no
<Snark> the then can have any type
<mellum> no? whoops.
<Snark> and if there is an else, then it must have the same type
<Snark> a "if then " expression has the type of the then-result
<mellum> # if 1=1 then 17;;
<mellum> This expression has type int but is here used with type unit
<mellum> so seems like it has to be unit to me.
<mellum> well. gotta run, see you
<Snark> of course
<Snark> if you use it at toplevel
<Snark> oh
<Snark> my bad
<Snark> of course, if there's no "else" then the default is "else ()" so yes the then must be unit
<Snark> sorry
<Tue16499> :)
vezenchio has joined #ocaml
mlh_ has quit [Client Quit]
smimou has joined #ocaml
Banana_ has joined #ocaml
TaXules has quit [Remote closed the connection]
Banana has quit [Read error: 104 (Connection reset by peer)]
TaXules has joined #ocaml
Snark has quit [Read error: 60 (Operation timed out)]
Snark has joined #ocaml
TaXules has quit [Read error: 110 (Connection timed out)]
pnou_ has joined #ocaml
Enveigler has joined #ocaml
<Enveigler> Can some point at information/description of "array projections"?
pnou has quit [Read error: 110 (Connection timed out)]
Gueben has joined #ocaml
Gueben has quit [Client Quit]
<Snark> what is it?
<Enveigler> Something mention in appendix A of http://pauillac.inria.fr/~remy/cours/appsem/ocaml.pdf
<Enveigler> And your question is my question. :) What are they?
<Snark> on which page?
<Enveigler> 131 "Array projections are polymorphic: they operate on any kind of array:"
<Snark> which is not in appendix A...
<Snark> oh
<Snark> evince's page numbers aren't the same as the ones in the document
<Snark> there is a +8
<Enveigler> It's also here in html
<Snark> aaahhhh...
<smimou> Enveigler: in a couple you've got 2 projections for each of the 2 components
<smimou> with an array of size n you've got n projections
<Snark> tab.(2) is a projection
<Enveigler> That's the same as tab[2] in c?
<smimou> yes
<Enveigler> The 3rd element of the array?
<smimou> yes
<Enveigler> Okay. Just different terminology.
Gueben has joined #ocaml
<Enveigler> Thankyou both.
<Enveigler> BTW is "a couple" the same as "a pair"?
Gueben has quit [Remote closed the connection]
Gueben has joined #ocaml
Gueben has quit [Remote closed the connection]
Gueben has joined #ocaml
TaXules has joined #ocaml
<Tue16499> i have to define 'f' with let f = ... before i can use it?
<Snark> Tue16499: of course
Gueben has quit [Remote closed the connection]
<Tue16499> thats too bad
Enveigler has quit [Read error: 110 (Connection timed out)]
<petter_> Tue16499: you can use an anonymous function, if thats what you mean
<Tue16499> nah, my problem is that i have this huge ml file with classes etc in it. And i wanted to use some class method somewhere lexicographically above all this stuff
<Tue16499> but the class etc cant be moved upwards because it again depends on shit
<Tue16499> and making all the stuff a simultaneous assignment...
<Tue16499> well that would just be tedious
Smerdyakov has joined #ocaml
Tue16499 has quit ["Leaving"]
Smerdyakov has quit ["work"]
Saulzar has joined #ocaml
monochrom has joined #ocaml
Saulzar has quit [Remote closed the connection]
Gueben has joined #ocaml
mrsolo has joined #ocaml
Hipo has quit [Read error: 104 (Connection reset by peer)]
Hipo has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
Schmurtz has joined #ocaml
noj_ is now known as noj
Snark has quit ["Leaving"]
mrsolo has quit [Remote closed the connection]
mrsolo has joined #ocaml
angagon has joined #ocaml
angagon has left #ocaml []
petter_ has quit [Read error: 110 (Connection timed out)]
Godeke has joined #ocaml
Enveigler has joined #ocaml
<Enveigler> I just read that Ocaml doesn't allow opening a file for both reading and writing. Is this an implementation thing or a philosophical thing?
<mfurr> Enveigler: There is no way to do it with the pervasives module, but you can open a file r/w with Unix.openfile
<Enveigler> ... if your on Unix which I'm not. That aside, I just wondered what the reasoning behind the decision was?
vezenchio has quit ["\o/ in mochintin namocniuh \o/"]
<mfurr> the vast majority of the Unix.* functions work on any platform, Unix.openfile certainly does
<mfurr> as for the decision, I guess they wanted a type-safe input/output channels, but I can't speak for the inria people
<Enveigler> Okay, thanks. I'll go find the Unix library
<mfurr> its part of the standard distribution
Godeke has quit [Client Quit]
<Schmurtz> Unix.openfile does work on any plateform
<Schmurtz> but it's not very easy to use it
<Schmurtz> (Unix.read and Unix.write more than Unix.openfile)
<Enveigler> Can I use in_channel_of_descr & out_channel_of_descr on the same file descriptor simultaneously?
<Enveigler> (And would it buy me anything by way of ease of use?)
lfelipe has joined #ocaml
<lfelipe> hi
<lfelipe> anyone here knows the "Modern Compiler Implementation in ML" book ?
<Schmurtz> Enveigler, try...
<Schmurtz> lfelipe, not me
<Schmurtz> Enveigler, however you may experience some strange behaviour if you dont flush your after writing and before reading
<Schmurtz> with only one fd, you have only one position cursor
<lfelipe> I was wondering if it was going to be easy to use Ocaml with it
<Schmurtz> if you write some data, it'll be writen at the current position in the file and this position will be updated to the end of wrtiten data
<Schmurtz> when you read something, you'll get the data just after the previously writen text
<Schmurtz> the best solution is to read all data, close the file
<Schmurtz> and when you want to save the data, reopen the file with write access and rewrite the complete file
<Schmurtz> if you use the file as a database storage (or something like that which require random read/write access), use the Unix module
<Enveigler> Schmurtz: Thanks. I realise I'd need to seek between reads and writes. I am trying now, but falling over syntax at the moment. (I real new to Ocaml incase it wasn;t obvious :)
<Schmurtz> and be careful to not read and write at the same time ;)
<Enveigler> That's sounds like there is a trap (laziness?) awaiting me?
<Schmurtz> and if you use in/out_channel, don't forget to flush (otherwise, your data will stay in a cache buffer)
<Schmurtz> Enveigler, if you use 2 threads, one reading and one writting
<Schmurtz> imagine you seek to the writing position, the reading thread seek to another position, and then the writing thread write in a bad position
<Enveigler> Okay. It'll be a while before I'll be trying to thread anything :)
<Schmurtz> :)
<Schmurtz> in a nutshell, use only one thread for disk access
<Schmurtz> and flush after writing data
<Schmurtz> it should work
lfelipe has quit ["[BX] Reserve your copy of BitchX-1.1-final for the Nintendo Gameboy today!"]
<Enveigler> Sounds good. Interesting though about flushing. If I do a write (no flush) then seek to another part of the file, the dirty buffer gets flushed to disk before anything is read at the new position?
<Enveigler> sthough/thought/
<Schmurtz> you never know when the data will be flushed
<Enveigler> Okay. a writeAt pos data that flushes sounds good. Thanks.
<Schmurtz> if you write something, it may be written immediately, or delaied
<Schmurtz> as the ocaml lib want
<Schmurtz> however, if you use Unix.write, I don't think you need to flush
<Schmurtz> (but Unix.write, has other complexe behaviour)
<Enveigler> The retry till done stuff?
<Schmurtz> yes
<Schmurtz> when the unix call is interrupted
<Enveigler> I'll sort out my syntax errors and see how I get on. Thanks for your help.
<Schmurtz> good luck
<Enveigler> One question. Do I need to specify the location of the Unix Lib when building? (If so How?)
<Schmurtz> you just have to add unix.cma on the ocamlc command line
<Enveigler> C:\OCaml\test>ocamlc rdwr.ml unix.cma
<Enveigler> Error while linking rdwr.cmo: Reference to undefined global `Unix'
<Schmurtz> wrong order
<Schmurtz> unix.cma must be before rdwr.ml, because rdwr.ml depends on it
<Enveigler> Got it.
<Schmurtz> ocaml is sometime not so nice...
mlh has joined #ocaml
Enveigler has quit [Read error: 110 (Connection timed out)]