gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
ankit9 has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 268 seconds]
lggr has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lopex has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
abeaulieu has quit [Ping timeout: 246 seconds]
abeaulieu has joined #ocaml
lggr has joined #ocaml
madroach has quit [Ping timeout: 265 seconds]
lggr has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
wtetzner has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
lopexx has quit []
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
Playground has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
Playground has quit [Ping timeout: 248 seconds]
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
Playground has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
mattrepl has quit [Quit: mattrepl]
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
Playground has quit [Quit: lag]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
Playground has joined #ocaml
lggr has joined #ocaml
cdidd has joined #ocaml
Ptival has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 268 seconds]
lggr has joined #ocaml
Ptival has quit [Quit: Quat]
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
tufisi has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
thelema_ has quit [Read error: Connection reset by peer]
jonafan has quit [Ping timeout: 264 seconds]
jonafan has joined #ocaml
thelema has joined #ocaml
lggr has quit [Ping timeout: 268 seconds]
othiym23 has quit [Ping timeout: 276 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
Playground has quit [Ping timeout: 244 seconds]
Playground has joined #ocaml
lggr has joined #ocaml
pqmodn_ has quit [Changing host]
pqmodn_ has joined #ocaml
pqmodn_ is now known as pqmodn
avsm1 has joined #ocaml
lggr has quit [Ping timeout: 268 seconds]
Playground has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
Playground has joined #ocaml
avsm1 has quit [Quit: Leaving.]
avsm has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
avsm has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
Playground has quit [Read error: Connection reset by peer]
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
eni has joined #ocaml
othiym23 has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
pango is now known as pangoafk
lggr has quit [Ping timeout: 252 seconds]
eni has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
Catnaroek has joined #ocaml
djcoin has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
ftrvxmtrx has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 272 seconds]
eni has joined #ocaml
ankit9 has quit [Read error: Connection reset by peer]
lggr has joined #ocaml
osa1 has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
ankit9 has joined #ocaml
ankit9 has quit [Client Quit]
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
ankit9 has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
Yoric has joined #ocaml
lggr has joined #ocaml
ontologiae has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
lggr has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
fasta has quit [Remote host closed the connection]
fasta has joined #ocaml
iZsh has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
err404 has joined #ocaml
ski has quit [Ping timeout: 260 seconds]
iZsh has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
lggr has quit [Ping timeout: 246 seconds]
ankit9 has quit [Ping timeout: 260 seconds]
ontologiae has joined #ocaml
lggr has joined #ocaml
ankit9 has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
joewilliams has quit [Remote host closed the connection]
lopex has quit [Remote host closed the connection]
bobry has quit [Write error: Broken pipe]
lggr has quit [Ping timeout: 244 seconds]
adrien has quit [Ping timeout: 268 seconds]
joewilliams has joined #ocaml
lggr has joined #ocaml
adrien has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
eni has quit [Ping timeout: 245 seconds]
ankit9 has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
bobry has joined #ocaml
ontologi1e has joined #ocaml
ontologiae has quit [Ping timeout: 255 seconds]
lggr has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
ontologi1e has quit [Read error: Connection reset by peer]
ankit9 has joined #ocaml
ontologiae has joined #ocaml
lopex has joined #ocaml
lggr has joined #ocaml
jathd has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
ankit9 has quit [Read error: Connection reset by peer]
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
err404 has quit [Remote host closed the connection]
_andre has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
larhat has quit [Quit: Leaving.]
lggr has joined #ocaml
sgnb`` is now known as sgnb
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
<hcarty> thelema: I have an untested patch to fix compilation of the Cairo bindings under OCaml 4.00.0
<hcarty> thelema: "untested" in that I it builds and installs, but I haven't tested the bindings yet
dwmw2_gone has quit [Ping timeout: 260 seconds]
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
larhat has joined #ocaml
gnuvince has quit [Ping timeout: 252 seconds]
<adrien> cairo "1"?
<hcarty> adrien: cairo2
<adrien> oh, only a bit surprised
<hcarty> adrien: It has a pretty heavily customized setup.ml so a 'oasis setup' with oasis 0.3.0 didn't do the trick as it might have otherwise.
<adrien> ah, yeah, not suprised for that :P
lggr has joined #ocaml
eni has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
sepp2k has joined #ocaml
tufisi has quit [Quit: ...]
lggr has joined #ocaml
tufisi has joined #ocaml
mnabil has joined #ocaml
dwmw2_gone has joined #ocaml
gnuvince has joined #ocaml
Snark_ has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
tufisi has quit [Quit: ...]
tufisi has joined #ocaml
lggr has quit [Ping timeout: 268 seconds]
lggr has joined #ocaml
tufisi has quit [Quit: ...]
tufisi has joined #ocaml
fraggle_laptop has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
Catnaroek has quit [Ping timeout: 268 seconds]
fraggle_ has quit [Ping timeout: 240 seconds]
ontologiae has quit [Ping timeout: 240 seconds]
jave has quit [Ping timeout: 244 seconds]
ontologiae has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
osa1 has joined #ocaml
lggr has joined #ocaml
Playground has joined #ocaml
gnuvince has quit [Ping timeout: 245 seconds]
gnuvince has joined #ocaml
jave has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
fraggle_ has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
Playground has quit [Quit: brb]
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
ontologiae has quit [Read error: Connection reset by peer]
ontologiae has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
fraggle_laptop has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
larhat1 has joined #ocaml
mattrepl has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
ftrvxmtrx has quit [Quit: Leaving]
Yoric has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
Snark_ is now known as Snark
fraggle_laptop has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
err404 has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
Ptival has joined #ocaml
Yoric has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
gnuvince has quit [Ping timeout: 255 seconds]
lggr has quit [Ping timeout: 260 seconds]
gnuvince has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
Ptival has quit [Read error: Connection reset by peer]
lggr has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
ontologiae has quit [Ping timeout: 252 seconds]
ulfdoz has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
eni has quit [Ping timeout: 256 seconds]
Cyanure has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
sepp2k1 has joined #ocaml
lggr has joined #ocaml
sepp2k has quit [Ping timeout: 264 seconds]
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
eni has joined #ocaml
osa1 has joined #ocaml
Ptival has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
pangoafk is now known as pango
fraggle_laptop has quit [Read error: Connection reset by peer]
lggr has joined #ocaml
ski has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
Ptival has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
eni has quit [Ping timeout: 272 seconds]
lggr has quit [Ping timeout: 248 seconds]
gnuvince has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
Ptival has joined #ocaml
Yoric has joined #ocaml
lggr has quit [Ping timeout: 272 seconds]
emmanuelux has quit [Quit: emmanuelux]
lggr has joined #ocaml
Snark has quit [Quit: Quitte]
lggr has quit [Ping timeout: 264 seconds]
gnuvince has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
emmanuelux has joined #ocaml
sivoais has quit [Read error: Connection reset by peer]
sivoais has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
fraggle_ has quit [Ping timeout: 250 seconds]
lggr has joined #ocaml
fraggle_ has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.7]
Yoric has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
larhat1 has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ocaml
Ptival has quit [Ping timeout: 248 seconds]
lggr has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
lggr has joined #ocaml
Anarchos has joined #ocaml
gnuvince has quit [Ping timeout: 246 seconds]
ftrvxmtrx has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
eni has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
gnuvince has joined #ocaml
lggr has joined #ocaml
_andre has quit [Quit: leaving]
lggr has quit [Ping timeout: 240 seconds]
larhat has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
chispita has joined #ocaml
<chispita> How do I translate an ocaml routine to Coq .v file?
lggr has joined #ocaml
<chispita> How do I translate an ocaml routine to Coq?
<chispita> (not .v file)
lggr has quit [Ping timeout: 272 seconds]
Xizor has joined #ocaml
lggr has joined #ocaml
Cyanure has quit [Remote host closed the connection]
<Anarchos> chispita can you explain ?
<Anarchos> ?
<Anarchos> with the Definition keyword maybe ?
<chispita> Anarchos: I have a simple function in OCaml, just a few lines. I'd like to send it to Coq for a formal proof.
<chispita> Anarchos: is there a translator from OCaml to Coq proofs?
<Anarchos> chispita it is a nonsense
<Anarchos> you have to make your need more precise
lggr has quit [Ping timeout: 244 seconds]
Ptival has joined #ocaml
<chispita> Anarchos: This function: http://rosettacode.org/wiki/Sorting_algorithms/Bubble_sort#OCaml I would like it to be a Fixpoint or Definition in Coq, so I can create my lists and test proofs with it
<chispita> Since I cannot write it in Coq(because I have been trying the past 4 weeks) I would like to translate the OCaml to Coq
<Anarchos> chispita i am not skilled enough to help you sorry
lggr has joined #ocaml
<chispita> In 4 weeks requesting help on these chat rooms, only one guy in the #coq room offered me help.
<Anarchos> chispita did you try the#coq channel ?
<chispita> Anarchos: yes, I remember you from there
<Anarchos> wops interlacing
<chispita> The single Coq book costs U$ 110. There is no help on these chat rooms. The language is very difficult and complicated. I should just give up and use something else.
<chispita> OCaml and Coq will never be mainstream this way
<Anarchos> chispita do you read french ?
<Anarchos> chispita coq is a vey different paradigm in which you can make logical construcive demonstration
<chispita> Anarchos: no French....
<Anarchos> chispita coq is not intended to be an IDE !
<chispita> Unfortunately.
<Anarchos> chispita the generation of the code from a proof is a side effect of curry-howard isomorphism
<chispita> But if I need to prove an external program with it, is it possible?
<Anarchos> chispita but going backwards is pretty undefined unless you tell what you want to do with the corresponding proof !
larhat has quit [Ping timeout: 240 seconds]
<Anarchos> chispita the very question is : what do you want to proove ?
<chispita> I would like to prove that a list nat -> listnat ->listnat is sorted after it is returned by that function.
<chispita> i have built sorted lists by hand, and proved it
<chispita> 1 :: 2 :: 3 :: 4 :: [] is sorted
<chispita> but i need a function that now takes 2 :: 5 :: 1 :: [] and returns 1 :: 2 :: 5 :: []
<chispita> i can't do that...
lggr has quit [Ping timeout: 240 seconds]
<Anarchos> chispita you will have to specify the logical formula meaning : list is sorted...
<chispita> i have that one!
eni has quit [Ping timeout: 245 seconds]
<Anarchos> the proof you want is a really difficult in coq for a beginner
<Ptival> chispita: what kind of sort did you write?
<Anarchos> Ptival help him cause i am unable ....
<Ptival> there are some sorts that will be hard to make Coq accept, for termination-checking reasons
<Ptival> I can probably help, and have nothing better to do at the moment :)
<chispita> Ptival: hopefully you can help me....i am unable to learn this unless i have a practical example...
<chispita> i have lists. i can prove those lists are sorted, equivalent, transitive
<chispita> so if i build a list by hand and Eval compute in LIST it works ok
<chispita> apply is_sorted.
<chispita> etc...
<chispita> now. given a list like 2 :: 5 :: 1 :: [] i need to specify a function that returns 1 :: 2 :: 5 :: []
<chispita> i thought i could import from OCaml, since my Coq language skills are limited
<Anarchos> chispita Definition f : fun nat list -> nat list := fun l => <sorted l to implement like in caml>
lggr has joined #ocaml
<chispita> Does Coq recognize the OCaml syntax?
<chispita> (Thanks, Anarchos, you Ptival and I think ziman from #coq were the only ones who helped me)
<Anarchos> chispita no for the syntax, but is really close
<Anarchos> chispita #coq is a low traffic channel :)
<chispita> Anarchos: my problem is not the logic, or the idea in Coq, it is the language
<Anarchos> chispita for the syntax you can find samples in english on google i guess
<chispita> Anarchos: yes, understood about #coq....unfortunately...i think this is a great technology that deserved more publicity
<Anarchos> chispita sure but not easy as it is so new for mainstream programmers
<Anarchos> chispita and language is very demanding to understand
<chispita> Anarchos: understood
<chispita> Anarchos: it is a bit frustrating in the beginning i guess?
<Anarchos> chispita yes it is, but when you begin to follow tutorials it is very addicting :)
<chispita> Anarchos: is there a bubblesort in coq somewhere?
<Anarchos> chispita no idea
<chispita> Anarchos: tutorial, i mean, so i can follow?
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
eni has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
ontologiae has joined #ocaml
cabbagebot has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
<Ptival> chispita: sorry, was afk, reading up :)
<chispita> Ptival: no problem. studying coq here in the meantime
<Ptival> chispita: do you have your OCaml code somewhere?
<chispita> i want to test this: give a function 2 :: 5 :: 1 :: [] then when i do Eval compute in myfunction 2 :: 5 :: 1 :: [] it gives me 1 :: 2 :: 5 :: []
<Ptival> there is a merge sort in the stdlib
<chispita> Ptival: i found that too. i'd like to write my own....so i can modify it and learn
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
<chispita> Ptival: basically i would like to understand how to translate my non-functional ideas to Coq
<chispita> Ptival: so for that, i need to get my head to understand Coq. if i use a library function(i have read it on coq.inria.fr) I would just be a user...i would like to understand it...
Xizor has quit []
wtetzner has quit [Read error: Connection reset by peer]
<Ptival> sure
<Ptival> chispita: http://coq.xelpaste.org/5877 here is my first try at making it "syntactically Coq"
wtetzner has joined #ocaml
<chispita> Ptival: nice! What is happening there?!
<chispita> understand this: let fix _bsort s :=
lggr has quit [Ping timeout: 248 seconds]
<chispita> in fact from match s with down i understand everything !
<chispita> i just don't understand this: Fixpoint bsort {t} eq (gt: t -> t -> bool) s :=
<chispita> Fixpoint declares a recursive function. bsord is the name. from {t} eq (gt: t -> t -> bool) s I don't get it :(
<Anarchos> fixpoint is like let rec
lggr has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 250 seconds]
cabbagebot has quit [Ping timeout: 272 seconds]
<chispita> let rec = let recursive?
lggr has quit [Ping timeout: 252 seconds]
<Anarchos> chispita let rec as in ocaml
<chispita> Anarchos: got it ;)
<chispita> If one knows OCaml then Coq becomes a lot easier, right?
<Anarchos> chispita right
<Anarchos> chispita but objects or imperative features are not needed, only the functional paradigm
<chispita> hmm.
<chispita> understood.
cabbageb1t has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
cabbageb1t has quit [Ping timeout: 248 seconds]
eni has quit [Quit: Leaving]
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
<Ptival> so
<Ptival> I just passed eq (the equality comparison) and gt (the comparison) as arguments to bsort
<Ptival> because there is no polymorphic comparison available in Coq
<Ptival> chispita: the problem is, Coq does not accept this definition because of how the recursive calls are done
<Ptival> so you would probably have to specify a termination argument
lggr has quit [Ping timeout: 252 seconds]
hongboz has joined #ocaml
lggr has joined #ocaml
<chispita> Ptival: I can't seem to compile the function you sent over :(
hongboz has quit [Remote host closed the connection]
<chispita> Recursive definition of _bsort is ill-formed.
<chispita> Recursive call to _bsort has principal argument equal to "x :: xs" instead of one of the following variables: "l" "xs".
ontologiae has quit [Ping timeout: 260 seconds]
<Ptival> yes
<Ptival> that's what I mentioned
<Ptival> the problem is, in Coq, you can only define recursive functions who recur in a structurally-decreasing fashion
<chispita> Ptival: hmm.
<chispita> I read about that, so they're not infinite
lggr has quit [Ping timeout: 255 seconds]
<Ptival> yes
<chispita> what does the " in " after the let fix do?
<Ptival> but in this case, unfortunately, you want recursion that is founded on some other argument
<chispita> Ptival: understood
<Ptival> oh, it's just the "in" that goes with the "let"
<chispita> yes but what is it? i don't understand that part of the let
<Ptival> to define _bsort as a local function
<Ptival> I don't understand what you don't understand
<chispita> :))
<Ptival> :d
<chispita> i am so lost, i am unable to explain myself lol
<Ptival> it's just like in OCaml
<chispita> let ..... in THIS HERE. what does the THIS HERE clause do?
larhat has joined #ocaml
<Ptival> THIS HERE is the actual term
<Ptival> (let foo = bar in 42) is 42
<Ptival> (let foo = bar in 42 + foo) is (42 + bar)
<Ptival> do you understand the OCaml bubble sort code you linked earlier?
<chispita> no ! is it too much trouble to ask for a brief explanation?
<Ptival> no it's not
<Ptival> you're learning OCaml too then?
<chispita> in reality, i am trying to learn Coq, but i understand zero of the language....
<chispita> the logic is ok.
<chispita> tactics = ok
<chispita> i have proved over 200 little exercizes
<chispita> but then the language....i am weak in functional programming...
<chispita> i assume OCaml is good to learn Coq?
<Ptival> it's very similar (for the definition of functions part)
<Ptival> so basically let is used to name things
<Ptival> let some_name = some_computation in something
<Ptival> something can refer to some_name whenever it wants to refer to the result of some_computation
lggr has joined #ocaml
<chispita> ok. farther down in the program, how do you employ some_name?
<chispita> or don't you?
<Ptival> you just write some_name
<chispita> when you write some_name. the return from that is something. right?
<Ptival> so for instance in that bsort code
<Ptival> first it defines a local _bsort function
<Ptival> that's all the lines from the first "let" to the first "in"
<Ptival> then the rest is
<Ptival> let t = _bsort s in (if t = s then t else bsort t)
<Ptival> so the three occurences of t inside the parentheses could be replaced by (_bsort s)
<Ptival> but the advantage of having the let is, first, that you type (_bsort s) only once, and only have to type t whenever you want to refer to it
<Ptival> and second, t is only computed once
<Ptival> while, if you had (if _bsort s = s then _bsort s else bsort (_bsort s))
Tobu has quit [Read error: Connection reset by peer]
<Ptival> then _bsort s would be computed twice
Tobu has joined #ocaml
<Ptival> once for the condition, and once again in the taken branch
<Ptival> for a simpler example
<chispita> following you
<Ptival> let fib10 = fib 10 in fib10 + fib10 (* computes fib 10 once *)
<Ptival> fib 10 + fib 10 (* computes fib 10 once *)
<Ptival> twice*
<Ptival> so you can name intermediate results using this let ... in ... syntax
<Ptival> and they will be computed once and for all
lggr has quit [Ping timeout: 252 seconds]
<Ptival> and you can give them nifty names that help simplifying the following code
<chispita> hmm
<chispita> you've made it so much clearer. re-reading the bsort function now starts to make sense
<Ptival> so the first "let" actually does not define a constant, but a local function
<Ptival> the syntax is let <name> <arg1> ... <argn> = <body> in <body of the whole thing which may call "name">
<chispita> the "immediate" thing that is executed is after IN right? the stuff between let ....HERE... in is the definition that the stuff after ... in ...HERE ... will use?
lggr has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<chispita> Ptival: time to go back to study this more! thanks for your help, this really cleared lots of things up!
<chispita> Anarchos: thanks as well for your help.
mattrepl has quit [Quit: mattrepl]
<Ptival> chispita: it depends on whether it's a let constant = ... or a let function x y = ...
<Ptival> if you write 'let blarg = computation1 in computation2' in OCaml
<Ptival> then computation1 is first executed
<Ptival> even if computation2 does not refer to blarg
<Ptival> (unless it's optimized away by the compiler, but I guess it's not since OCaml is not pure)
emmanuelux has quit [Ping timeout: 246 seconds]
<Ptival> but what the whole thing returns is the result of computation2
lggr has quit [Ping timeout: 252 seconds]
<Ptival> it's a bit different in another language called Haskell that is lazy
lggr has joined #ocaml