alej has quit [Read error: Connection reset by peer]
q66 has quit [Remote host closed the connection]
ollehar has quit [Ping timeout: 256 seconds]
BiDOrD_ has quit [Ping timeout: 258 seconds]
alxbl has joined #ocaml
alxbl has quit [Changing host]
alxbl has joined #ocaml
mcclurmc has quit [Ping timeout: 258 seconds]
mikurubeam has joined #ocaml
BiDOrD has joined #ocaml
travisbrady has quit [Quit: travisbrady]
ontologi1e has quit [Ping timeout: 264 seconds]
cdidd has quit [Ping timeout: 255 seconds]
travisbrady has joined #ocaml
BiDOrD has quit [Quit: No Ping reply in 180 seconds.]
BiDOrD has joined #ocaml
eikke has joined #ocaml
paddymahoney has joined #ocaml
BiDOrD has quit [Ping timeout: 245 seconds]
tane has quit [Quit: Verlassend]
BiDOrD has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
eikke has quit [Ping timeout: 264 seconds]
travisbrady has quit [Quit: travisbrady]
ahokaomaeha has joined #ocaml
mikurubeam has quit [Ping timeout: 260 seconds]
ahokaomaeha is now known as mikurubeam
clintnewsom has quit [Quit: clintnewsom]
clintnewsom has joined #ocaml
clintnewsom has quit [Client Quit]
yacks has joined #ocaml
paddymahoney has quit [Remote host closed the connection]
beckerb has joined #ocaml
Kakadu has joined #ocaml
Cyanure has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Remote host closed the connection]
Yoric has joined #ocaml
adotbrown has quit [Ping timeout: 260 seconds]
ahokaomaeha has joined #ocaml
mikurubeam has quit [Ping timeout: 240 seconds]
ahokaomaeha is now known as mikurubeam
Cyanure has quit [Remote host closed the connection]
lihaitao has joined #ocaml
Pantoufle has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
weie_ has joined #ocaml
weie has quit [Ping timeout: 255 seconds]
yacks has quit [Read error: Operation timed out]
adotbrown has joined #ocaml
yacks has joined #ocaml
chambart has joined #ocaml
cdidd has joined #ocaml
adotbrown has quit [Ping timeout: 245 seconds]
chambart has quit [Ping timeout: 246 seconds]
lihaitao has quit [Quit: Ex-Chat]
hkBst has joined #ocaml
adotbrown has joined #ocaml
ttamttam has joined #ocaml
fayden has quit [Read error: Operation timed out]
Yoric has joined #ocaml
adotbrown has quit [Ping timeout: 264 seconds]
fayden has joined #ocaml
thomasga has joined #ocaml
eikke has joined #ocaml
cago has joined #ocaml
anderse has joined #ocaml
hkBst has quit [Read error: Connection reset by peer]
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
mika1 has joined #ocaml
anderse has quit [Quit: anderse]
chambart has joined #ocaml
cago has quit [Ping timeout: 256 seconds]
anderse has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
mcclurmc has joined #ocaml
anderse has quit [Quit: anderse]
SanderM has joined #ocaml
cago has joined #ocaml
chambart has quit [Remote host closed the connection]
chambart has joined #ocaml
rixed has quit [Ping timeout: 252 seconds]
Snark has joined #ocaml
wormphlegm has quit [Ping timeout: 248 seconds]
wormphlegm has joined #ocaml
ontologiae has joined #ocaml
ontologiae has quit [Read error: Connection reset by peer]
ontologiae has joined #ocaml
rixed has joined #ocaml
leoncamel has quit [Quit: WeeChat 0.3.9.2]
leoncamel has joined #ocaml
ollehar has joined #ocaml
adotbrown has joined #ocaml
ontologi1e has joined #ocaml
thomasga has quit [Quit: Leaving.]
ontologiae has quit [Ping timeout: 252 seconds]
Kakadu has quit [Remote host closed the connection]
Kakadu has joined #ocaml
eikke has quit [Ping timeout: 256 seconds]
chambart has quit [Ping timeout: 258 seconds]
rwmjones has quit [Quit: Terminated with extreme prejudice - dircproxy 1.2.0]
adotbrown has quit [Ping timeout: 276 seconds]
mikurubeam has quit [Ping timeout: 276 seconds]
rwmjones has joined #ocaml
ggole has joined #ocaml
eikke has joined #ocaml
SanderM has quit [Ping timeout: 245 seconds]
mikurubeam has joined #ocaml
mikurubeam has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
mikurubeam has joined #ocaml
tane has joined #ocaml
mikurubeam has quit [Ping timeout: 256 seconds]
mikurubeam has joined #ocaml
mikurubeam has quit [Client Quit]
chambart has joined #ocaml
cago has quit [Read error: Operation timed out]
chambart has quit [Ping timeout: 260 seconds]
mikurubeam has joined #ocaml
chambart has joined #ocaml
cago has joined #ocaml
ttamttam has quit [Quit: ttamttam]
cago has quit [Quit: Leaving.]
cago has joined #ocaml
eikke has quit [Ping timeout: 260 seconds]
eikke has joined #ocaml
cago1 has joined #ocaml
cago1 has quit [Client Quit]
cago1 has joined #ocaml
ulfdoz has joined #ocaml
Uvs has joined #ocaml
cago has quit [Ping timeout: 256 seconds]
chambart has quit [Ping timeout: 258 seconds]
cago1 has quit [Client Quit]
q66 has joined #ocaml
clintnewsom has joined #ocaml
ulfdoz has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
SanderM has joined #ocaml
tane has quit [Quit: Verlassend]
darkf has quit [Quit: Leaving]
ttamttam has joined #ocaml
cago has joined #ocaml
travisbrady has joined #ocaml
cago has quit [Quit: Leaving.]
travisbrady has quit [Client Quit]
travisbrady has joined #ocaml
cago has joined #ocaml
mika1 has quit [Quit: Leaving.]
clintnewsom has quit [Quit: clintnewsom]
mika1 has joined #ocaml
Yoric has joined #ocaml
Uvs has quit [Ping timeout: 256 seconds]
tane has joined #ocaml
cago has quit [Quit: Leaving.]
cago has joined #ocaml
cago has quit [Ping timeout: 252 seconds]
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
hkBst has quit [Ping timeout: 240 seconds]
cago has joined #ocaml
clintnewsom has joined #ocaml
protecta has joined #ocaml
<protecta>
Bonjour
<thelema>
salut
<protecta>
J'aurais besoin d'aide pour une fonction en CAMl
<thelema>
en anglais ici
<thelema>
ou #ocaml-fr
<protecta>
oh ok, i need help to complete a function in CAML
<protecta>
Can someone help me ?
<thelema>
yes, just ask your question
<protecta>
ok, here is my function :
<protecta>
let cbc = fun e c0 liste -> let rec aux = fun k acc c-> if k=(List.length liste) then acc else aux (k+1) ((permute e (xor_liste (List.nth liste k) c))::acc) (List.nth acc k) in aux 0 [] c0;;
<protecta>
my problem is in the part "(List.nth acc k"
<thelema>
because acc starts off empty
<protecta>
yes
<thelema>
you should try to use matching instead of k
<thelema>
actually; how does acc ever become non-empty?
protecta_ has joined #ocaml
<protecta_>
got disconnected, sorry
<protecta_>
you mean a pattern matching ?
<thelema>
actually; how does acc ever become non-empty?
<thelema>
yes.
<thelema>
or higher level functions
<protecta_>
acc becomes non empty with "((permute e (xor_liste (List.nth liste k) c))::acc)"
<thelema>
(like map or fold)
<protecta_>
but as i do in the same time, it doesn't work
<thelema>
ah, I see now, I had miscounted argument position
<protecta_>
as i do it*
<thelema>
so how is c supposed to be computed?
<thelema>
is c supposed to be the result of permute ...?
<protecta_>
c must be the new list created in the acc
<thelema>
ok
<protecta_>
i'm working on the cbc crypting
<protecta_>
for a school test
<protecta_>
so i'll try what you said
<protecta_>
thanks
protecta has quit [Ping timeout: 245 seconds]
<thelema>
let aux k c acc = if ..length.. then acc else let c = permute e (xor_liste (List.nth liste k) c) in aux (k+1) (c::acc) c
protecta has joined #ocaml
<thelema>
It looks like you want a stateful map...
<protecta_>
got disconnected again u_u
smondet has joined #ocaml
<thelema>
let f c0 e = let c = ref c0 in fun l -> c := permute e (xor_liste l !c); !c in
<thelema>
let cbc e c0 l = let g = f c0 e in List.map l g
<protecta_>
woha, sorry it's hard to understand (i'm not an familiar with ocaml)
<protecta_>
so you want me to do many more functions
<protecta_>
?
<thelema>
what you're doing is transforming a list of things into another list of things of the same length
<protecta_>
i'm mean, splitting my code in many functions instead of one
<protecta_>
yes it is
<thelema>
the transformation at each step depends on the result of the last step
<protecta_>
exactly
<protecta_>
it depends of the c
<protecta_>
the user give the first c
<protecta_>
(parameter c0)
<thelema>
so `f c0 e` returns a function that takes l (one thing) and does permute/xor_liste to get the result
cago has left #ocaml []
<thelema>
and it saves a copy of that result in a local reference c
<protecta_>
ok but i lose the recursive form of my function, no ?
<thelema>
Yes, that recursion is hidden inside the List.map
<protecta_>
let aux k c acc = if ..length.. then acc else let c = permute e (xor_liste (List.nth liste k) c) in aux (k+1) (c::acc) c
<protecta_>
let f c0 e = let c = ref c0 in fun l -> c := permute e (xor_liste l !c); !c in
<protecta_>
let cbc e c0 l = let g = f c0 e in List.map l g
<protecta_>
written like that, it's correct ?
<thelema>
those are two different things; the second and third lines are one reimplementation of cbc
<thelema>
and the first line is a reimplementation of your aux function, to be used inside your cbc function
<protecta_>
can you just put them in the good order please, in order to understand the thing
<protecta_>
(sorry..)
<thelema>
solution 1: lines 2 and 3 (f and cbc)
<thelema>
solution 2: your code with 'aux' replaced by line 1
<protecta_>
ok thanks !
thomasga has joined #ocaml
<protecta_>
thanks for your help, have a nice day
<protecta_>
=)
<thelema>
protecta_: you too
protecta_ has left #ocaml []
* thelema
realizes that all one recursive function is easiest for this problem
amaloz has quit [Remote host closed the connection]
<protecta>
hum i tried thelema, but it isn't working
<protecta>
sorry for disturbing
<protecta>
the problem is that k is never initialize
<protecta>
initialized
<protecta>
nor acc
<protecta>
so i have the syntax error thing
<thelema>
protecta: I assume you're trying solution 2
<protecta>
yes
<thelema>
from what you're saying, you have removed the "in aux 0 [] c0;;"
<protecta>
hmm
<protecta>
let aux k c acc = if ..length.. then acc else let c = permute e (xor_liste (List.nth liste k) c) in aux (k+1) (c::acc) c
<protecta>
i took this
<protecta>
there is "in aux (k+1) (c::acc) c"
<thelema>
yes, that's the recursive call, still within the definition of aux
hkBst_ has quit [Quit: Konversation terminated!]
<thelema>
just like you have "aux (k+1) (...::acc) (...)"
<protecta>
yes
<protecta>
i need t put an another ?
<protecta>
to*
<thelema>
you need to keep the "first" call to aux that happens after its definition
<companion_cube>
thelema: do you think I should move stuff to Gen?
oriba has joined #ocaml
<companion_cube>
and then have lightweight wrappers for restartable gens ?
<thelema>
companion_cube: ok. Maybe simpler would be a function that takes two sequences and merges them
<protecta>
i guess it about [] and c0
<thelema>
companion_cube: no, after further consideration, I like the code as is
<companion_cube>
I prefer to go with the most general
<protecta>
at the end
<companion_cube>
thelema: ah, cool :)
<companion_cube>
also, things like partition or unzip are much more complicated with gens than with restartable gens
<companion_cube>
(because in the second case you can have distinct generators)
<thelema>
companion_cube: the infix thing is just that users should be able to do Gen.(--) to get --, instead of Gen.Infix.(--), but they should also be able to do 'open Gen.Infix'
<companion_cube>
ah, ok
<protecta>
Is it that ?
<thelema>
protecta: I see a missing "in"
<protecta>
if i put the last in, i have the following message "unbound value aux"
<companion_cube>
thelema: also, I'm looking for a better name than 'Enum'
<thelema>
companion_cube: yes, unzip is much more complex, as you only get one chance to take the values for unzip
<thelema>
BatGen?
<companion_cube>
yep
<companion_cube>
BatGen should be the name in Batteries
<thelema>
protecta: ok, that's just because I forgot the 'rec' on aux
travisbrady has joined #ocaml
<companion_cube>
(btw I think the n-way merge_sorted is cool for things like on-disk sorting)
<protecta>
Yahoo, working
<protecta>
Sorry if i'm totally newbie
<thelema>
companion_cube: I'd prefer just a 2-way implementation at this point, and letting users implement n-way
<protecta>
and for losing your time
<protecta>
thanks man !
<companion_cube>
thelema: I can provide both
<thelema>
companion_cube: I'd appreciate the 2-way
<companion_cube>
sur
<companion_cube>
sure*
<thelema>
companion_cube: also, line 26: "consumable generators" -> "restartable generators"
<companion_cube>
oh yes, sure
<companion_cube>
thanks
<companion_cube>
most code was pretty fun to write with this system
<thelema>
yes, having control of program flow is very convenient
* ggole
mumbles something about continuations
<thelema>
companion_cube: I'd appreciate the 2-way
<thelema>
err... ignore that
<thelema>
btw, I appreciate flatMap
<companion_cube>
:)
<thelema>
ggole: exactly
<ggole>
Continuations are a bit sledgehammery though
<thelema>
min/max should probably take comparison functions; it doesn't fit in well to have an lt function, but compare is everywhere
<thelema>
better explanation of 'merge' would be useful; pick fairly doesn't say much
<companion_cube>
thelema: yes, but min/max do not require a total order
<companion_cube>
actually they should take a min/max binary function, for general lattices
<thelema>
yes, that would be reasonable.
<thelema>
You don't have a reduce function, do you?
<thelema>
i.e. like fold, but uses element 0 as inital acc
<thelema>
and fails on empty enum
<companion_cube>
oh
<companion_cube>
I can add it
<vbmithr>
Hi
<thelema>
companion_cube: then min/max become just reduce min g/reduce max g
<companion_cube>
I'm not sure about the correctness of for_all2, fold2 and so on, because unlike the std lib I don't fail when enum have different lenghts
<thelema>
companion_cube: instead of copy/paste for Infix, you can just "include Infix" in the .ml
<ggole>
That failure always makes me a bit nervous
<thelema>
companion_cube: you stop when they have different lengths, right?
<companion_cube>
thelema: at stop once one of the enums is exhausted
<companion_cube>
rather than raising Invalid argument
<thelema>
yes, that's good. It should be documented, but that's the behavior I'd expect.
<companion_cube>
but I think that allows to use infinite sequences with finite ones
ttamttam has quit [Remote host closed the connection]
mikurubeam has joined #ocaml
chambart has quit [Ping timeout: 272 seconds]
awm22 has joined #ocaml
ccasin has quit [Ping timeout: 245 seconds]
awm22 has quit [Read error: Operation timed out]
awm22 has joined #ocaml
ccasin has joined #ocaml
Ptival has quit [Quit: leaving]
Ptival has joined #ocaml
<oriba>
hello, I want to learn Lambda calculus. The "classical" book on that topic seems to be: Henk Barendregt "Lambda Calculus. Its Syntax and Semantics". Is it good as introductional book, or is it rather advanced stuff? Or asking more general: what book on lambda calculus, do you think, is a good introduction?
thelema_ has joined #ocaml
thelema has quit [Read error: Connection reset by peer]
beckerb has quit [Ping timeout: 245 seconds]
ollehar1 has quit [Ping timeout: 256 seconds]
rwmjones has joined #ocaml
Kakadu has quit [Read error: No route to host]
Kakadu has joined #ocaml
travisbrady has quit [Quit: travisbrady]
<companion_cube>
oriba: I don't know about your book; a rather advanced one is "types and programming languages" by Pierce
travisbrady has joined #ocaml
<zorun>
iirc, Bardendregt is one of the founder of lambda calculus
Pantoufle has quit [Read error: Operation timed out]
_andre has quit [Quit: leaving]
ulfdoz has quit [Ping timeout: 255 seconds]
Jenza has joined #ocaml
Snark has quit [Quit: Quitte]
mcclurmc has joined #ocaml
smondet has quit [Ping timeout: 252 seconds]
Kakadu has quit []
travisbrady has quit [Quit: travisbrady]
clintnewsom has quit [Quit: clintnewsom]
smango_ is now known as smango
mikurubeam has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
amaloz has joined #ocaml
sivoais has quit [Ping timeout: 252 seconds]
sivoais has joined #ocaml
troydm has quit [Read error: Operation timed out]
troydm has joined #ocaml
adotbrown has joined #ocaml
mikurubeam has joined #ocaml
Neros has quit [Read error: Connection reset by peer]
Cyanure has joined #ocaml
Cyanure has quit [Remote host closed the connection]
eikke has joined #ocaml
Cyanure has joined #ocaml
awm22 has quit [Quit: Leaving.]
adotbrown has quit [Ping timeout: 260 seconds]
tane has quit [Quit: Verlassend]
ulfdoz has joined #ocaml
tobiasBora has joined #ocaml
<tobiasBora>
Hello !
<tobiasBora>
I'm on Linux and I'd like to remove a folder with ocaml
<tobiasBora>
Is it possible without using Sys.command which isn't very proper...
<tobiasBora>
thanks, but the problem with Unix.rmdir is that the folder must be empty...
<tobiasBora>
And this function won't work on windows ?
cdidd has quit [Ping timeout: 264 seconds]
<orbitz>
tobiasBora: with a module name like 'Unix', I would wager it doesn't
mcclurmc has quit [Ping timeout: 260 seconds]
<tobiasBora>
orbitz: And there is not a "universal" solution ?
Cyanure has quit [Remote host closed the connection]
<orbitz>
tobiasBora: I don't know, I doubt there is one in teh stdlib, if there is one it is a separate library
Yoric has quit [Ping timeout: 245 seconds]
<tobiasBora>
orbitz: ok... For the moment I don't need a portable code so I can do it only in linux. And how could I "translate" a command from int to unit without doing somethink like let tmp=fction; ?
<orbitz>
what do you mean? Ocaml doesn't ahve 'commands', it has values, and functions (which are values I guess)
<bitbckt>
ignore is probably what you're looking for.
<orbitz>
indeed
<tobiasBora>
great thanks !
<zorun>
most functions in Unix also work on Windows, I think
<zorun>
unless those that explicitely state they don't
mikurubeam has quit [Quit: +1 (Yes). -1 (No). i (WTF?).]
thomasga has quit [Quit: Leaving.]
leoncamel has quit [Ping timeout: 256 seconds]
derek_c has joined #ocaml
<oriba>
tobiasBora, that the rmdir'ed dir must be empty is NOT OCaml specific. It's also the case in the system call "rmdir" (rmdir(2)
<oriba>
So you need to remve all stuff below the dir by yourself
<oriba>
man 2 rmdir
<oriba>
ENOTEMPTY
<tobiasBora>
oriba: ok thans !
<tobiasBora>
*thanks
<tobiasBora>
zorun: with the same module ?
notk1 has joined #ocaml
<notk1>
hello
<notk1>
is it possible to use map-réduçè in Ocaml ?
<orbitz>
sure?
<orbitz>
it's just a map and a fold
<notk1>
last I heard OCaml garbage collector is single-threaded
<orbitz>
what does that have to do with map-reduce?
sysop_fb has quit [Read error: Connection reset by peer]
<notk1>
so without some sort of native library you can't implicitly parallelize Ocaml code
sysop_fb has joined #ocaml
<orbitz>
map-reduce doesn't require parallism
<notk1>
isn't that what it was made for?
<orbitz>
no
<notk1>
hm
<notk1>
distributed computing?
<orbitz>
It's a model for performing computations
<notk1>
yes it's a model, but the idea is that for the same code, map can be easily parallelizeable, so it can scale better
<orbitz>
the model allows for paralleism, it doesn't require it
<notk1>
right, but that is the main advantage of it
<orbitz>
is it?
<notk1>
that's why google created it for no?
<orbitz>
Googles use case invovles parallelism
<orbitz>
To say google created map-reduce is a bit of an exageration though, it's a fairly old technique
mikurubeam has joined #ocaml
<notk1>
I am not talking about the fonctions map and reduce
<orbitz>
googles specific implementation makes use of distribtued computing, but that is because the model allows for it
<notk1>
I am talking about their implementations that are made to be parralel
<orbitz>
which is an advantage
<orbitz>
i know nothing of googles map-reduce implementation. I have used Hadoop though
<notk1>
I was talking more of client-side parralel map