dan2 changed the topic of #ocaml to: OCaml 3.08.2 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | 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/
drewr has quit [Read error: 110 (Connection timed out)]
<mellum> Unfortunately, it isn't really possible to implement efficient bit vectors in Ocaml, because of the annoying tag bit
<mellum> Oh well.
<kuribas> The layout of Bigarray is the same as in C, so it should be possible...
smimou has quit ["?"]
<mrvn> or strings
<mrvn> for <= 134217728 bit
Herrchen has quit ["bye"]
paisa has joined #ocaml
<paisa> hola
paisa has left #ocaml []
KrispyKringle has quit ["Get MacIrssi - http://www.g1m0.se/macirssi/"]
kuribas has quit ["Leaving"]
__DL__ has quit ["Bye Bye"]
SyntaxNinja has quit ["home"]
mwc has joined #ocaml
fab__ has joined #ocaml
monochrom has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
mwc has quit ["Leaving"]
gim has quit []
tintin` is now known as tintin
tintin has quit [Read error: 110 (Connection timed out)]
tintin has joined #ocaml
arjanb has quit ["zzz"]
drewr has joined #ocaml
vezenchio has quit ["Greenspun's Tenth Rule of Programming: any sufficiently complicated C or Fortran program contains an ad hoc informally-specifi"]
KrispyKringle has joined #ocaml
mlh has quit [Client Quit]
drewr has quit ["zzz"]
monochrom has quit ["Few people understand "understanding"."]
fragbot has quit [Read error: 60 (Operation timed out)]
monochrom has joined #ocaml
monochrom has quit [Client Quit]
KrispyKringle has quit ["Get MacIrssi - http://www.g1m0.se/macirssi/"]
vincenz has quit [Read error: 110 (Connection timed out)]
vincenz has joined #ocaml
zzorn has joined #ocaml
zzorn is now known as zzorn_away
det has quit ["leaving"]
det has joined #ocaml
Submarine has joined #ocaml
Submarine has quit ["Leaving"]
pango has quit ["Client exiting"]
Herrchen has joined #ocaml
Submarine has joined #ocaml
shawn has quit ["Leaving"]
pango has joined #ocaml
tintin has quit [Remote closed the connection]
tintin has joined #ocaml
m3ga has joined #ocaml
shawn has joined #ocaml
mrsolo has quit ["Leaving"]
mrvn_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
mbh has quit [Read error: 110 (Connection timed out)]
m3ga has quit ["Client exiting"]
smimou has joined #ocaml
smimou has quit ["?"]
mlh has joined #ocaml
mlh has quit [Client Quit]
Submarine_ has joined #ocaml
det has quit [Read error: 104 (Connection reset by peer)]
mrvn has joined #ocaml
det has joined #ocaml
mrvn_ has quit [Read error: 110 (Connection timed out)]
det has quit [Remote closed the connection]
det has joined #ocaml
Smerdyakov has joined #ocaml
drewr has joined #ocaml
tintin has quit [Read error: 104 (Connection reset by peer)]
<det> wow, I pasted a link here once to an otherwise completely unreachable url and it got put on the web as IRC logs and MSN search engine read those logs and spidered that page
<det> confused me as to htf MSNBot got the URL
tintin has joined #ocaml
vezenchio has joined #ocaml
tintin has quit [Read error: 54 (Connection reset by peer)]
CosmicRay has joined #ocaml
mbh has joined #ocaml
mellum has quit [Read error: 104 (Connection reset by peer)]
mellum has joined #ocaml
<mellum> Hi. I'm trying to write a function that returns a pair of a random element of a list and the rest of the list. I can come up only with complicated ways, though, can somebody think of something elegant?
<Smerdyakov> Do you even have problems doing this given the index of the element to choose?
<mellum> Well, I don't exactly have problems. I have a working function, it just looks ugly
<mellum> WHat I currently do is:
<mellum> let draw l =
<mellum> let p = Random.int (List.length l) in
<mellum> let x = List.nth l p in
<mellum> let rec del_nth p accu = function
<mellum> [] -> List.rev accu
<mellum> | x :: xs -> del_nth (pred p) (if p = 0 then accu else x :: accu) xs
<mellum> in
<mellum> x, del_nth p [] l
<mellum> (that's also pretty inefficient, but I don't care)
<Smerdyakov> let rec removeNth n pre post = match post with [] -> failwith "Argh" | h::t -> if n = 0 then (h, List.revAppend pre post) else removeNth (n-1) (h::pre) t
<Smerdyakov> Now: let draw l = let p = Random.int (List.length l) in removeNth p [] l
fragbot has joined #ocaml
<Smerdyakov> Gotta run
Smerdyakov has quit []
<mellum> Just for the record, here's what I'm going to use:
<mellum> let draw l =
<mellum> let rec remove_nth n pre = function
<mellum> [] -> failwith "Argh"
<mellum> | h::t -> (if n = 0 then (h, List.rev_append pre t)
<mellum> let p = Random.int (List.length l) in
<mellum> remove_nth p [] l
<mellum> ;;
<mellum> argh. blody tabs
<mellum> there's a missing else remove_nth (pred n) (h :: pre) t) in
Submarine has quit ["Leaving"]
Smerdyakov has joined #ocaml
lodewijk has quit [Read error: 110 (Connection timed out)]
<judge> when i do a pattern match like let f = function a b -> ...
<judge> ocaml complains
<Smerdyakov> Yup. You can't do auto-currying with function.
<judge> can sml do that?
<pnou> use fun instead of function
<judge> oh
<Smerdyakov> No. SML never does auto-currying with anything but fun.
<judge> i was using function to pattern match arguments
<judge> is my way out of this to to do let f a b = match (a,b) with ... ?
<judge> or is there a more appropriate solution?
<Smerdyakov> That's how I'd do it.
<judge> thanks
<judge> neeed more syntax candy
<judge> :)
Smerdyakov has quit ["brb"]
pango has quit ["Leaving"]
gim has joined #ocaml
monochrom has joined #ocaml
pango has joined #ocaml
KrispyKringle has joined #ocaml
humasect has joined #ocaml
Smerdyakov has joined #ocaml
smimou has joined #ocaml
det_ has joined #ocaml
det has quit [Read error: 104 (Connection reset by peer)]
mrvn_ has joined #ocaml
Herrchen has quit ["bye"]
mrvn has quit [Read error: 110 (Connection timed out)]
CosmicRay has quit [Read error: 60 (Operation timed out)]
monochrom has quit ["Few people understand "understanding"."]
lodewijk has joined #ocaml
lmbdwr has joined #ocaml
<lmbdwr> yop
<humasect> =o
drewr has quit ["ERC Version 4.0 $Revision: 1.719 $ (IRC client for Emacs)"]
Smerdyakov has quit []
humasect has quit [Read error: 110 (Connection timed out)]
mellum_ has joined #ocaml
rnooner has joined #ocaml
<rnooner> I'm writing regular expression to use with the Str module and am having trouble escaping reserved characters. If I write let group_def = Str.regexp "\[+.\]" I get an Illegal backslash excape in string. What am I missing? Thanks in advance.
<mbh> there is no character '\[' and '\]'
<mbh> if you're trying to match a + or ., you can just do Str.regexp "[.+
<mbh> ]"
<rnooner> So to match a [, I would use [[] ?
gpciceri has joined #ocaml
gpciceri has quit [Remote closed the connection]
<rnooner> I tried it and it works. Thanks!
Herrchen has joined #ocaml
lodewijk has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
mlh has joined #ocaml
zxy____ has joined #ocaml
<KrispyKringle> i have to say, i really find the orielly book nice.
qwe has joined #ocaml
xqw has quit [Read error: 60 (Operation timed out)]
zxy_ has quit [Read error: 110 (Connection timed out)]
monochrom has joined #ocaml
drewr has joined #ocaml
Smerdyakov has quit ["your head explode"]
drewr has quit ["ERC Version 4.0 $Revision: 1.719 $ (IRC client for Emacs)"]
Submarine_ has quit ["Leaving"]
Smerdyakov has joined #ocaml