<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?