smimou changed the topic of #ocaml to: OCaml 3.08.3 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | 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/
smimou has quit ["gn"]
araujo has joined #ocaml
monochrom has quit ["me!"]
mrvn_ has joined #ocaml
mrvn__ has joined #ocaml
mrvn has quit [Read error: 60 (Operation timed out)]
mrvn_ has quit [Read error: 110 (Connection timed out)]
Gueben has quit ["WiNdOz R0xOr dA w0R1d"]
cjohnson has joined #ocaml
cjohnson has quit [Read error: 131 (Connection reset by peer)]
zeeble has joined #ocaml
Herrchen_ has joined #ocaml
ulfdoz has joined #ocaml
zeeble has left #ocaml []
Herrchen has quit [Read error: 110 (Connection timed out)]
ulfdoz_ has quit [Read error: 145 (Connection timed out)]
vezenchio has joined #ocaml
mlh has quit ["ni!"]
<ulfdoz> re
vodka-goo has joined #ocaml
_shawn has joined #ocaml
__DL__ has joined #ocaml
shawn_ has quit [Read error: 110 (Connection timed out)]
mrvn__ is now known as mrvn
Snark has joined #ocaml
pango has quit [Read error: 54 (Connection reset by peer)]
<Snark> slt
pango has joined #ocaml
_shawn has quit ["Leaving"]
shawn_ has joined #ocaml
smimou has joined #ocaml
<slashvar[lri]> Hi
<araujo> hello
<araujo> Can someone give a brief definition about functional programming?
<mellum> mrvn_: no, replaced some weird manual rendering code with a memcpy
<mellum> whoops.
araujo has quit ["Programs must be written for people to read, and only incidentally for machines to execute"]
shammah has joined #ocaml
haakonn_ has joined #ocaml
_JusSx_ has joined #ocaml
haakonn has quit [Read error: 110 (Connection timed out)]
<vincenz> Can you reraise an exception?
<mflux> try .... with e -> raise e ?
<mflux> or maybe (SomeEx foo) as e -> raise e
<vincenz> no reraise, hmm?
<mflux> not one I've seen
<mflux> is that raise not ok?
<mflux> I have a distinct feeling it doesn't break the trace
<vincenz> break the trace?
<mflux> OCAMLRUNPARAM=b
<mflux> what do you need reraise for, if with .. raise works just as well?
<vincenz> imagine having a set of different exceptions
<mflux> ok..
<vincenz> you'd have to "as " em all
<mflux> true
<mflux> like, 7 letters per exception
<mflux> I can see that can become a problem
<mflux> if you have like 10 exceptions
<mflux> ;)
Herrchen_ has quit ["bye"]
vodka-goo has quit [Read error: 104 (Connection reset by peer)]
mrpingoo has joined #ocaml
mrpingoo is now known as vodka-goo
<vodka-goo> mflux: sorry I was disconnected, but I'd like to hear the end of your discussion
<vodka-goo> for me reraise is useless...
<mflux> what was the last thing I said? (I ignore joins/parts/quits)
<mflux> well, I didn't say much
<vincenz> vodka-goo: why is reraise useless?
<mflux> mostly that I didn't agree with that (..) as e -> .. raise e would be significant code overhead
<vodka-goo> <mflux> if you have like 10 exceptions
<vodka-goo> <mflux> ;)
<mflux> that was it ;)
<vincenz> that's the last he said
<vodka-goo> try ... with _ as e -> raise e
<vodka-goo> _ matches them all
<vincenz> euhm
<mflux> oooh, so that was the problem?
<vincenz> vodka-goo: that's not the idea
<slashvar[lri]> vodka-goo: try ... with e -> raise e, works also
<mflux> no, it wasn't :)
<vincenz> try ... with A -> do blabla; reraise | B -> do blibli; rerais
<vodka-goo> slashvar[lri]: yeah, better :) I was sticking to the old expr too much
<mflux> vincenz just has loads of different, certain exceptions he wants to catch and handle each one separately
<mflux> and then reraise
<vincenz> I don't but it's foreseeable
<vodka-goo> vincenz: seeing you're metavariables, I can tell you're french...
<vincenz> I am not
<vodka-goo> eh :(
<vincenz> nor is french my first language
<vincenz> or second or third for that matter
<vodka-goo> vincenz: do you want to reraise them all ?
<vincenz> it's my fourth
<vincenz> vodka-goo: I don't personally want to do anything
<vincenz> I just think reraise might be interesting
<vodka-goo> you speak lots of languages... blabla and blibli and often our foo and bar :)
<vodka-goo> vincenz: for avoiding "as e" ?
* vincenz shrugs
<vincenz> just think that if you're in an exception context...
<vincenz> I mean...
<vodka-goo> explain me. for now, I still believe it's just a matter of little p4 hacking
<vincenz> try ... with Plop -> call_some_log_fun_that_might_that_it_needs_to_reraise | Pleep -> call_that_same_fun
<vodka-goo> you can give your long-named fun the exception as an argument
<slashvar[lri]> vincenz: exception can be matched with a pattern matching
<vincenz> when you call those funcs you're still in the "exception context" so possibly you could reraise it there, I don't know, by keeping the exception until the with block is finished, one could possibly request the local exception
<vincenz> "what exception am I in"
<mflux> I don't think 'exception context' means much in ocaml?
<vodka-goo> I don't think your long-named fun should know it's in that context
<vincenz> sure it does
<vincenz> until the with -> blablabla finishes you're in an exception context
<slashvar[lri]> so try ... with e -> (match e with A -> ...| ...) ; raise e
<vincenz> yick
<vincenz> anything can be done the long way
<vincenz> in fact, you dont need let's
<mflux> exception Foo let handler e = raise e in try raise Foo with e -> handler e ?
<mflux> for the reraising-from-function
<vincenz> I just saw reraise in an ocaml extension and it looked neat
<vincenz> flowcaml
<slashvar[lri]> oh
<slashvar[lri]> ;)
* slashvar[lri] has read many time Vincent Simonet's thesis ;)
<vincenz> You nkow what I think we need? A community feeling like #haskell, that would project it forward
<slashvar[lri]> (it's actualy on my desk ;)
<slashvar[lri]> you talk about the propagate keyword in flowcaml ?
<vincenz> yip
<slashvar[lri]> flowcaml has a different exception mechanism
<slashvar[lri]> exception are second class value, and raise need an explicite exception name to work
<slashvar[lri]> so, in flowcaml you can't write try ... with e -> ... ; raise e
<slashvar[lri]> this is why propagate was added
<vincenz> ah
<slashvar[lri]> (taken from Vincent's phd thesis)
<slashvar[lri]> but reraise was in the old caml (the one based on the CAM)
<smimou> CAM = Categorical Abstract Machine ?
<slashvar[lri]> yes
<ulfdoz> Does Ocaml use nptl for threads?
Isumi has joined #ocaml
cjohnson has joined #ocaml
cjohnson has quit [""We live like penguins in the desert...""]
araujo has joined #ocaml
<araujo> Hello.
<araujo> Can anybody gives a brief definition about what functional programming is about?
<mauke> using functions as first class values
<mflux> having functions that have their return value defined by their input values
<mflux> isn't that about it?-)
<araujo> hah...
<mflux> I bet the net has many more or less good definitions for FPL's
<araujo> That's why i ask, every book i read gives a slightly different definition
<mauke> mflux: that doesn't really help if all your values are integers :-)
<mflux> mauke, I meant in addition to yours
<araujo> I was considering functional programming like: "applying functions to arguments to return a value"
<araujo> Though im not sure if it is too general.
<araujo> The functions as first class values is also a good point.
<mrvn> everything is a function, there are only functions.
<mauke> lambda calculus!
p has joined #ocaml
<araujo> hah, yeah, i also refer to lambda calculus when i want to talk about functional p.
<araujo> we probably might say that there exist two kind of languages (paradigms) for programming, those descendants from the Turing machine and the opthers from the lambda calculus...
<mrvn> I think the most noticeable thing are higher level functions.
pango has quit ["Leaving"]
mrvn has left #ocaml []
mrvn has joined #ocaml
vezenchio has quit [""Under democracy one party always devotes its chief energies to trying to prove that the other party is unfit to rule—and both"]
pango has joined #ocaml
* araujo dind't knwo the beautiful array notation of Ocaml
<mellum> (Array.get a b)?
<Snark> [|foo; bar|] ?
<araujo> expr.(1).(4) for example...
<araujo> i like pretty much the .()
smimou has quit ["↓"]
<Snark> good night
Snark has left #ocaml []
cjohnson has joined #ocaml
Isumi has quit [Remote closed the connection]
vodka-goo has quit []
__DL__ has quit [Remote closed the connection]
carrumba has joined #ocaml
carrumba has left #ocaml []
vincenz has quit ["leaving"]
vincenz has joined #ocaml
<araujo> i can't modify a value field in a record right?
<vincenz> unless you make it mutable
<araujo> Yeah.
<araujo> So, it is like the non-mutable records are for read-only right?
<vincenz> yes
<vincenz> nono
<araujo> thanks.
<araujo> ?
<vincenz> the non-mutable record FIELDS
<araujo> Yeah.
<vincenz> you can ahave both in a record
<araujo> yes, you mean, both mutable and non-mutable?
<vincenz> yes
<araujo> Right.
* araujo slowly grasping at this
<vincenz> type t = { a: int; mutable b : int}
<vincenz> a is non mutable, b is
<araujo> Get it.
<araujo> Right.
<vincenz> let a = {a=1;b=1};;
<vincenz> a.b <- 2;;
<vincenz> # a.a <- 2;;
<vincenz> The record field label a is not mutable
<araujo> vincenz, could you please explain me something from this example also:
<araujo> let moveto p dx dy =
<araujo> let () = p.xc <- p.xc +. dx
<araujo> in p.yc <- p.yc +. dy ; ;
<araujo> What is the let () = ?
<vincenz> woah
<vincenz> that doesn't make sense
<araujo> Really?
<TeXitoi> let moveto p dx dy =
<vincenz> I guess you can do that if you're sure it returns a unit and you don't care about it
<TeXitoi> p.xc <- p.xc +. dx;
<araujo> I read it from the Ocaml book.
<vincenz> I've never seen let ()
<TeXitoi> p.yc <- p.yc +. dy ; ;
<vincenz> it's useless
<TeXitoi> that's the same
* vincenz nods
<vincenz> never seen the match () th
<araujo> Yeah, first time i see it also....
<vincenz> well makes sense
<vincenz> you're matching what that statement returns against unit
<araujo> hah.. though i have just a few weeks with ocaml :-)
<vincenz> and it is unit
<vincenz> I typically use the ; syntax
<vincenz> or let _
<araujo> mm.. i see.. it is like casting or type checking?
<vincenz> no
<vincenz> it's pattern matching
<vincenz> just like you have
<vincenz> can't think of a good example
<araujo> mm.. i see.. TeXitoi the ; syntax is for sequences of instructions?
<TeXitoi> araujo: yes
<araujo> Good.
<TeXitoi> sequence of unit instructions
<araujo> vincenz, like pattern matching, but.. p.xc <- p.xc +. dx won't always return () ?
<TeXitoi> except the last
<araujo> I see.
<TeXitoi> araujo: this exp is always unit
<araujo> Right.
<vincenz> it will always return ()
<araujo> I just don't get what it is the let () used.
<vincenz> or you'd get a warning on the fact you're not matching all patterns
<vincenz> araujo: take this
<vincenz> let a::b = somelist
<vincenz> you pattern match a list with head a and tail b
<vincenz> now you're pattern mathcing a unit
<mrvn> let _ = ... would be better
<vincenz> mrvn: well this way you're certain it's a unit
<araujo> mm.. i see...
<vincenz> instead of messing up
<mrvn> true
<vincenz> in fact it's safer than ;
<vincenz> which only warns
<vincenz> just atypical
<vincenz> a
<araujo> Get it!
<araujo> I see now , it is a pattern matching
<mrvn> Isn't it all?
<araujo> i also think, it is used to make sure the function returns unit
<araujo> :-)
angagon has left #ocaml []
_JusSx_ has quit ["leaving"]