mrsolo has quit [Read error: 104 (Connection reset by peer)]
lispy` is now known as lispy
bacam has quit [Read error: 110 (Connection timed out)]
chs_ has quit [Read error: 104 (Connection reset by peer)]
batdog is now known as batdog|gone
batdog|gone is now known as batdog
threeve has quit []
threeve has joined #ocaml
twobitsprite has joined #ocaml
twobitsp1ite has quit [Read error: 104 (Connection reset by peer)]
batdog is now known as batdog|gone
descender has quit [Remote closed the connection]
descender has joined #ocaml
threeve has quit []
ski has joined #ocaml
exa has joined #ocaml
aegray_ has joined #ocaml
aegray has quit [Nick collision from services.]
aegray_ is now known as aegray
UziMonkey has joined #ocaml
vodka-goo has joined #ocaml
chs_ has joined #ocaml
Schmurtz has joined #ocaml
Submarine has joined #ocaml
twobitsprite has quit [Read error: 104 (Connection reset by peer)]
twobitsprite has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
pango_ has quit ["Client exiting"]
_fab has joined #ocaml
pango has joined #ocaml
vodka-goo has quit []
UziMonkey has quit [Remote closed the connection]
Skal has joined #ocaml
vezenchio has joined #ocaml
avlondono has quit [Read error: 110 (Connection timed out)]
revision17_ has joined #ocaml
avlondono has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
ppsmimou has joined #ocaml
Snark has joined #ocaml
ramkrsna has quit [No route to host]
m3ga has joined #ocaml
gim has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
threeve has joined #ocaml
Boojum is now known as Snark
ski has quit [Read error: 104 (Connection reset by peer)]
ski_ has joined #ocaml
ski_ is now known as ski
Smerdyakov has quit [Read error: 110 (Connection timed out)]
batdog|gone is now known as batdog
twobitsp1ite has joined #ocaml
twobitsprite has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has joined #ocaml
twobitsprite has joined #ocaml
twobitsp1ite has quit [Read error: 104 (Connection reset by peer)]
CLxyz has quit [Connection timed out]
__DL__ has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
ChipsterOne has joined #ocaml
UziMonkey has joined #ocaml
UziMonkey has quit [":q"]
__DL__ has quit [Read error: 104 (Connection reset by peer)]
twobitsp1ite has joined #ocaml
twobitsprite has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
<aegray>
i'm stupid - I'm trying to write a function using only fold_right, fold_left, map, and possibly reverse that calculates the rolling sum [1; 3; 5]->[0; 1; 4; 9]. I try List.fold_right (fun x y -> (x + (List.fold_right (+) y 0))::y) [1;3;5] [];; but its backwards (which I can fix) and the numbers are [14 8 5] which isn't right (ie 14 = 8+5+1 instead of the result it should be: 5+3+1) - any help on what i'm doing wrong with fold_rig
<aegray>
ht?
<mellum>
aegray: the problem is that you are using fold_right. It's just not appropriate.
CLxyz has joined #ocaml
<aegray>
What would be more appropriate?
<mellum>
fold_left.
<aegray>
i'm kinda lost on what the difference is other than that it goes the other direction
<mellum>
well, that is about the difference.
<aegray>
so would it be List.fold_left (fun x y -> (y + (List.fold_left (+) 0 x)::x) [] [1;3;5];;?
<mellum>
Why can't you just pass the sum within the outer fold?
<aegray>
how do you mean? (sorry i'm pretty confused with ocaml)
<pango>
List.rev (List.fold_left (fun acc e -> List.hd acc + e :: acc) [0] list)
<mellum>
Or that.
<aegray>
so it would first be called with fun [0] list and at each step have the sum appended?
<aegray>
erm nm i get it
<aegray>
thanks
ChipsterOne has left #ocaml []
pango has quit ["brb"]
ppsmimou has quit ["Leaving"]
__DL__ has quit ["Bye Bye"]
pango has joined #ocaml
twobitsp1ite has quit [Read error: 104 (Connection reset by peer)]
twobitsprite has joined #ocaml
Schmurtz has quit [Read error: 104 (Connection reset by peer)]
Schmurtz_ has joined #ocaml
shirogane has joined #ocaml
Schmurtz_ is now known as Schmurtz
Schmurtz is now known as Schmurtz_
Schmurtz_ is now known as Schmurtz
Snark has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
twobitsprite has quit [Read error: 104 (Connection reset by peer)]
twobitsprite has joined #ocaml
smimou has joined #ocaml
menace has joined #ocaml
Hadaka has quit [Remote closed the connection]
Naked has joined #ocaml
Naked is now known as Hadaka
menace is now known as menace_
menace_ is now known as menace
menace is now known as irc
irc has quit []
exa has quit [Remote closed the connection]
shirogane has quit [Remote closed the connection]
<aegray>
god this is dumb - how do I take a number to a power? like x^y?
<smimou>
**
<smimou>
# 2. ** 3.;;
<smimou>
- : float = 8.
<aegray>
thanks
<gim>
doesn't exists with 'int's, does it ?
<smimou>
no
<smimou>
but common you know how to program that in one line gim
<gim>
one line and good performance ? tell me :)
<smimou>
:p
<Snark>
s/common/come on/
<smimou>
tssss
<Snark>
I was wondering what was meant...
<smimou>
sorry, I guess we'd better create #ocaml-fr :)
<gim>
took me some time also, but my english not better so i didn't say anything
ChipsterOne has joined #ocaml
<pango>
let power a b =
<pango>
let rec power_aux a b c = (* a^b * c *)
<pango>
if b=0 then c
<pango>
else power_aux (a * a) (b / 2) (if b mod 2 = 0 then c else c * a)
<pango>
in power_aux a b 1 ;;
<smimou>
heh
<gim>
does it work with small values of a and b ?
<gim>
if yes, that should work for any value :)
ChipsterOne has quit []
<pango>
b land 1 may be slightly faster if the compiler isn't smart enough with b mod 2
<pango>
that's the egyptian multiplication algorithm, adapted to power computation
<beschmi>
you can use the same algorithm for modular exponentation
<smimou>
they're the same modulo the modulo :)
Submarine has quit ["Leaving"]
Schmurtz has quit [Read error: 104 (Connection reset by peer)]
vezenchio has quit ["Free Tibet with each Asian nation of a lesser or equal value"]
threeve has quit []
chs_ has quit [Read error: 113 (No route to host)]
chs_ has joined #ocaml
<KrispyKringle>
Hey, so if I wish to call some existing C code from OCaml, I have to write a C wrapper function for it first that can be declared in my ocaml, right?
<KrispyKringle>
aha.
<KrispyKringle>
Dynamic linking still doesn't work on OSX?
Skal has quit [Remote closed the connection]
threeve has joined #ocaml
UziMonkey has joined #ocaml
Naked has joined #ocaml
Hadaka has quit [Read error: 104 (Connection reset by peer)]
Naked is now known as Hadaka
_fab has quit [Remote closed the connection]
threeve has quit []
smimou has quit ["?"]
twobitsp1ite has joined #ocaml
twobitsprite has quit [Read error: 104 (Connection reset by peer)]
Nutssh has joined #ocaml
pango_ has joined #ocaml
pango has quit [Read error: 145 (Connection timed out)]
twobitsprite has joined #ocaml
twobitsp1ite has quit [Read error: 104 (Connection reset by peer)]