ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
pango_ has joined #ocaml
thedracle has joined #ocaml
thedracle has quit [Read error: 104 (Connection reset by peer)]
pango has quit [Read error: 110 (Connection timed out)]
treeee has quit [Read error: 104 (Connection reset by peer)]
ski__ has joined #ocaml
bzzbzz has quit ["leaving"]
<KrispyKringle>
Er, what's the endian-nes of write_byte?
ski_ has quit [Read error: 113 (No route to host)]
batdog|gone is now known as batdog
Revision17 has joined #ocaml
demitar_ has joined #ocaml
demitar__ has quit [Read error: 110 (Connection timed out)]
sebell has joined #ocaml
<sebell>
labgtk2 newbie here... attempting to run the threaded toplevel as per the readme yields "cannot find file +threads." any insight?
joshcryer has quit [Read error: 104 (Connection reset by peer)]
<sebell>
I should mention that running the examples works fine
joshcryer has joined #ocaml
sebell has quit ["leaving"]
ulfdoz has quit [brown.freenode.net irc.freenode.net]
joshcryer has quit [brown.freenode.net irc.freenode.net]
Raziel has quit [brown.freenode.net irc.freenode.net]
bacam has quit [brown.freenode.net irc.freenode.net]
Schmurtz has quit [brown.freenode.net irc.freenode.net]
Bigb[a]ng has quit [brown.freenode.net irc.freenode.net]
juri has quit [brown.freenode.net irc.freenode.net]
demitar_ has quit [brown.freenode.net irc.freenode.net]
pango_ has quit [brown.freenode.net irc.freenode.net]
TaXules has quit [brown.freenode.net irc.freenode.net]
skylan has quit [brown.freenode.net irc.freenode.net]
vincenz has quit [brown.freenode.net irc.freenode.net]
kubano has quit [brown.freenode.net irc.freenode.net]
pnou_ has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
haelix has quit [brown.freenode.net irc.freenode.net]
shammah has quit [brown.freenode.net irc.freenode.net]
Oatmeat|umn has quit [brown.freenode.net irc.freenode.net]
noj has quit [brown.freenode.net irc.freenode.net]
flux__ has quit [brown.freenode.net irc.freenode.net]
joshcryer has joined #ocaml
demitar_ has joined #ocaml
pango_ has joined #ocaml
Raziel has joined #ocaml
TaXules has joined #ocaml
skylan has joined #ocaml
vincenz has joined #ocaml
Schmurtz has joined #ocaml
haelix has joined #ocaml
Bigb[a]ng has joined #ocaml
bacam has joined #ocaml
ulfdoz has joined #ocaml
flux__ has joined #ocaml
juri has joined #ocaml
Oatmeat|umn has joined #ocaml
Hadaka has joined #ocaml
kubano has joined #ocaml
pnou_ has joined #ocaml
shammah has joined #ocaml
noj has joined #ocaml
batdog is now known as batdog|gone
batdog|gone is now known as batdog
<KrispyKringle>
Is there a convenient way to print out the type and value of something as is done at the toplevel?
<KrispyKringle>
For debugging, that is...
<flux__>
I think the type information is removed during compilation..
<flux__>
and wouldn't it endianess be a non-issue with write_byte?
<KrispyKringle>
flux__: Why would endianness not be an issue? Doesn't that affect bit order as well as byte order?
<KrispyKringle>
Or is that hidden by the hardware?
<KrispyKringle>
It appears NOT to be an issue for me, but I wanted to make sure that whatever I was doing would work in the future.
<Smerdyakov>
No, endianness has nothing to do with "bit order."
<KrispyKringle>
Smerdyakov: byte order only?
<KrispyKringle>
OK. I couldn't remember offhand.
<KrispyKringle>
The spec I was reading referred to "big-endian format, with the most significant bits first," which made me think I was misremembering endianness.
<KrispyKringle>
I guess I wasn't.
<KrispyKringle>
Anyway, I'm off. Thanks for the help.
shirogane has quit [Remote closed the connection]
vezenchio has quit ["\\o sora wa hate shinai, kokoro no kagami dakara ne \o/ mainichi iro wo kaeteku utsushidasu you ni o//"]
pango_ has quit ["Client exiting"]
pango has joined #ocaml
ppsmimou has joined #ocaml
pingoo has joined #ocaml
pingoo is now known as vodka-goo
revision17_ has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
Schmurtz has quit [Remote closed the connection]
Skal has joined #ocaml
<haakonn>
hmm, where do i go for a heap-like data structure?
vodka-goo has quit [Read error: 110 (Connection timed out)]
<haakonn>
found something in the humps
gim has joined #ocaml
vezenchio has joined #ocaml
vodka-goo has joined #ocaml
batdog is now known as batdog|gone
wolfbeck has joined #ocaml
joshcryer has quit [Read error: 110 (Connection timed out)]
wolfbeck has quit ["Leaving"]
Raziel has quit ["Yo soy goma. Tú eres cola."]
Schmurtz has joined #ocaml
<mellum>
Isn't there some function that randomly shuffles a list?
ppsmimou has quit ["Leaving"]
<Schmurtz>
mellum, no
<mellum>
Hmm. What would be a good idea to implement it? Prepend a random number, sort by it, and throw it away?
<Schmurtz>
but I've written one
<mellum>
ah :) would you mind sharing?
<Schmurtz>
yes, just way ;)
<Schmurtz>
(* shuffle the list l *)
<Schmurtz>
let shuffle l =
<Schmurtz>
let len = List.length l in
<Schmurtz>
<Schmurtz>
(* the algorithm is based on many swapping of two elements, so using a table is more efficient *)
<Schmurtz>
let table = Array.init len (fun i -> i) in
<Schmurtz>
for i=0 to (len-1) do
<Schmurtz>
let j = Random.int len in
<Schmurtz>
let tmp = table.(j) in
<Schmurtz>
table.(j) <- table.(i);
<Schmurtz>
table.(i) <- tmp;
<Schmurtz>
done;
<Schmurtz>
<Schmurtz>
let rec func r n =
<Schmurtz>
let r' = (List.nth l table.(n))::r in
<Schmurtz>
if n < len-1 then func r' (n+1) else r'
<Schmurtz>
in func [] 0
<Schmurtz>
;;
<mellum>
Urgh. That has O(n^2) complexity
<Schmurtz>
yes
<Schmurtz>
er, I'm not sure
<mellum>
well, list.nth is O(n) already
<Schmurtz>
it's 0(n)
<Schmurtz>
yes, you're right
<mellum>
Oh well. It's probably still fast enough for me :)
<Schmurtz>
IIRC, one can prove that each order has the same probability
<Schmurtz>
so, it's a good shuffle algorithm
<mellum>
actually, I think I'll just go with
<mellum>
let shuffle l =
<mellum>
let l = List.map (fun x -> (Random.bits (), x)) l in
<mellum>
let l = List.sort (fun (i, _) (j, _) -> compare i j) l in
<mellum>
List.map snd l
<mellum>
;;
smimou has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
vezenchio has quit ["\\o sora wa hate shinai, kokoro no kagami dakara ne \o/ mainichi iro wo kaeteku utsushidasu you ni o//"]
Snark has joined #ocaml
vezenchio has joined #ocaml
Raziel has joined #ocaml
__DL__ has joined #ocaml
Bigb[a]ng is now known as Bigbang
pango has quit ["Leaving"]
pango has joined #ocaml
<flux__>
mellum, wouldn't compare work directly on the tuples? (and correctly too)
<flux__>
so it becomes just List.sort compare l in ..
<flux__>
btw, and that's a great example of using rebinding, to those naysayers :P
_fab has quit []
Bigbang is now known as Bigb[a]ng
Snark has quit ["Parti"]
qknight has joined #ocaml
<qknight>
hey
<qknight>
how can i print out a list of lists?
<qknight>
val tt : (string * int) list list
<qknight>
a list of lists of an association paris
<mellum>
well, you iter over the list, and print each element. Where's the problem?
exa has joined #ocaml
vodka-goo has quit []
vodka-goo has joined #ocaml
<qknight>
mellum: it's working now
<qknight>
mellum: but i needed to write a lot of code :p
__DL__ has quit [Remote closed the connection]
<pango>
# let print_tuple (s, i) = Printf.sprintf "(%s, %d)" s i and
<pango>
print_list f l = Printf.sprintf "(%s)" (String.concat ", " (List.map f l)) in
<pango>
you don't need to build the whole string representation, the trick is that print_list takes the function to print elements as parameter
mikeX has joined #ocaml
<mikeX>
is there a reason why there isn't a function in Buffer to modify it's contents (like String.set)?
<pango>
strings have immutable length and mutable content, Buffers have mutable length and immutable content :)
<pango>
or immutable, in "append only", at least
<mikeX>
well, why is that?
<pango>
since internally it's implemented using a string, it's a choice
<mikeX>
I see, guess I'll have to copy the Buffer module and implement there : P, cause getting the contents, changing them, clearing the buffer and reappending them (what I have to do now) seems lame : /
<mikeX>
or is there a better approach?
<pango>
maybe the way you're using buffers is not appropriate
<pango>
use it like you would to write to a stream : no turning back...
<pango>
or use several Buffers, and only copy to the main one once you have the end result, or something
<mikeX>
hmmm, guess I want both of two worlds
<pango>
at least, you don't want Buffers
<pango>
as they're defined
<mikeX>
I used a buffer cause it's supposed to be faster to append to it
<mikeX>
than normal strings
<pango>
it is
<pango>
it uses geometric reallocation
<mikeX>
well that's what I want, a string that grows one char in a for loop, and then gets reset, and starts all over again, only in a particular case, I would like to replace it's last char
<mikeX>
it's actually a custom split function, that handles escapes
<mikeX>
now I want it to replace escaped characters found, with the character itself
<pango>
Then delay the add of chars to Buffer 'til you sure it won't change
<mikeX>
I guess i'll try doing that, if it's not more of a mess
<mikeX>
thanks pango
<pango>
np
qknight has quit ["Lost terminal"]
smimou has quit ["bli"]
<mikeX>
I think it's better to stick with my old approach, finding escaped delimiters should be a rare occurrence, while the other approach adds overhead to each char processed