<mrvn>
or the docs: file:///usr/share/doc/ocaml/docs/ocaml.html/libref/Pervasives.html#VALreally_input
<mrvn>
also available somewhere online.
<mfp>
also, man Pervasives at least on Debian
<steg>
mfp: oh, awesome, i had no idea you could do that
<mrvn>
wow, didn't know about those.
<steg>
(it works on OS X too btw)
<mfp>
just realized they are installed by default yesterday
<mfp>
you can also generate 1 page per function
<mfp>
if the same func is defined in several modules, they are merged into the same manpage
<steg>
that sounds useful
<mfp>
that's not installed by default, though (on Debian again), but can be generated with ocamldoc
<mfp>
ocamldoc -d /dest/dir -man *.mli
<mfp>
hmm that'd mean I could switch to using K in vim instead of inspecting the sigs in a toplevel
<mfp>
this Frama-C thing is seriously cool -> {values, effects, dependency, impact} analysis++
<mfp>
the obvious followup Q is: is there anything similar *for* OCaml? (and not only *in* OCaml)
ppsmimou has quit [Read error: 104 (Connection reset by peer)]
willb has quit [Read error: 110 (Connection timed out)]
Waleee has joined #ocaml
itouch has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
ppsmimou has joined #ocaml
Walee has joined #ocaml
s4tan has quit []
s4tan has joined #ocaml
Waleee has quit [Connection timed out]
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb` has joined #ocaml
ikaros has joined #ocaml
AxleLonghorn has joined #ocaml
sgnb` has quit [Read error: 104 (Connection reset by peer)]
AxleLonghorn has left #ocaml []
vpalle_ has joined #ocaml
willb has joined #ocaml
vpalle has quit [Connection timed out]
s4tan has quit []
_zack has quit [Read error: 110 (Connection timed out)]
gim_ has joined #ocaml
gim has quit [Read error: 104 (Connection reset by peer)]
ppsmimou has quit [Read error: 110 (Connection timed out)]
ppsmimram has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]>
hi
Amorphous has quit [Read error: 104 (Connection reset by peer)]
Stefan_vK1 has joined #ocaml
_zack has joined #ocaml
sgnb has joined #ocaml
Amorphous has joined #ocaml
Stefan_vK has quit [Read error: 110 (Connection timed out)]
robocop has joined #ocaml
robocop is now known as joel
joel has left #ocaml []
hkBst has joined #ocaml
nacsucauz has joined #ocaml
<nacsucauz>
hi all
<nacsucauz>
can you tell me what's the difference between closures and delegates? do you know?
<nacsucauz>
?
alexyk has joined #ocaml
<alexyk>
hi guys -- I'm trying to define: open Printf; let eprintf = fprintf stderr ... but using eprintf instead of printf complains on the format... Why?
<hcarty>
I'm not entirely clear on all of the details. But if you type it in the toplevel you can see the type difference between the two definitions
<hcarty>
Glad to help. It's an easy thing to be bitten by.
<alexyk>
also -- is there a way to redefine it further to always call flush stderr in the end?
<alexyk>
should be not trivial because of the random number of arguments...
<hcarty>
let print_debug format s = printf format s; flush_all ()
<hcarty>
Or something along those lines, adjusted for the function(s) and surrounding output you want
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros_ has joined #ocaml
<Yoric[DT]>
alexyk: shameless plug: Batteries' Printf module is easier to extend.
tar_ has joined #ocaml
<alexyk>
hcarty: will this make s a single argument, so I'd have to define many? or printf makes s a magic variable argument?
<hcarty>
Yoric[DT]: How stable is the Batteries API at this point? I can compile it on 3.11 now, and while it's still missing a few 3.11-isms (unsafe set and get for Bigarrays at least) it seems to be getting nicer by the day
<alexyk>
Yoric: will check out that Printf too
<Yoric[DT]>
hcarty: thanks.
<Yoric[DT]>
We're trying to get Alpha 3 out these days.
<hcarty>
alexyk: print_debug would work just like printf, except that it flushs all output streams on each call
<Yoric[DT]>
Hopefully, it's the last Alpha and there won't be any API change until our release.
<Yoric[DT]>
(well, except a few additions as needed)
<alexyk>
is Godi updated to 3.11? I couldn't get half stuff to work manually for 3.11...
<alexyk>
so Batteries compile attempt died somewhere in between deps...
<hcarty>
Yoric[DT]: Very nice! I'll try to start working it in to some of my code over the next few weeks
Snark has joined #ocaml
<Yoric[DT]>
hcarty: great :)
<hcarty>
alexyk: godi has support for 3.11, though I don't know which packages are not ported yet
<hcarty>
Yoric[DT]: If I get time to make up a Batteries patch for the 3.11 Bigarray missing pieces -- how do you handle the .mli and documentation? Do you just copy directly from the stdlib?
<Yoric[DT]>
Yes.
<hcarty>
Ok, thanks
<mfp>
hcarty: let print_flush fmt = printf (fmt ^^ "%!")
<hcarty>
I'll hopefully get a chance to look at that
<alexyk>
hcarty: printf_debug with two arguments fails complaining of too many -- I'm afraid one s doesn't cover x y
<hcarty>
mfp: Oh, right! I saw something about that recently. On the mailing list possibly.
<hcarty>
mfp: Thanks, that's much cleaner
<Yoric[DT]>
(and now that we've embedded pa_optcomp, we should be able to obtain a release compatible with 3.10 but taking advantage of 3.11isms where available).
<mfp>
for some reason I failed to see Pervasives.(^^) for a long time
<alexyk>
mfp: this looks like magic, nice! how doe sit work?
<alexyk>
does it
<mfp>
pa_optcomp? sounds interesting, wonder what it is (optimized <| |> or something?) /me reads log
<mfp>
alexyk: (^^) concatenates two "formats"
<alexyk>
ah sure
<tar_>
let a = (ref 0);; let b = (ref 0);; a != (ref 0);; a = b;; wha?
<alexyk>
so %! is just the specifier to flush
<hcarty>
mfp: There is an example in pa-do for optimized ( <| ) and friends
<hcarty>
tar_: Maybe you want ( <> ) rather than ( != )?
<alexyk>
in the great French tradition, I call it leprintf: let leprintf format = eprintf (format ^^ "%!")
* mfp
realizes optcomp probably means "optional compilation" or something like that
<mfp>
heh leprintf
<tar_>
hcarty: well, same results
<hcarty>
a <> ref 0)
<tar_>
oh oh, missed that one
<mrvn>
# a <>(ref 0);;
<mrvn>
- : bool = false
<mrvn>
Why is that false?
<tar_>
it's true here
<hcarty>
!= gives true, <> gives false here
<hcarty>
mrvn: both a and (ref 0) have the same contents, but they are distinct entities. I think that's the correct way to phrase it...
<tar_>
clearly I should rely on another comparison method for my unit tests :D
<hcarty>
tar_: <> is to != as = is to ==
<mrvn>
ahh, references are equal if their contents are equal.
<tar_>
hcarty: I'm still looking for documentation on = vs ==
<mrvn>
tar_: It is in man Pervasives
<mfp>
alexyk, hcarty: an alternative (less "magic") way to do that let print_flush fmt = Printf.kprintf (fun s -> print_endline s) fmt;;
<hcarty>
I think, given that the given link is from the author's home institution, it's probably ok
alexyk has quit []
<hcarty>
mrvn: That works as well or better... and doesn't have the problem of getting out of sync with your local installation
jonafan_ is now known as jonafan
Mr_Awesome has joined #ocaml
alexyk has joined #ocaml
Smerdyakov has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
Guest35936 has joined #ocaml
<Guest35936>
(just starting with ocaml) - is there a source/import/whatever feature for the toplevel shell?
<Guest35936>
grrr
<flux>
you mean #use "foo.ml";; ?
Guest35936 is now known as astronut
<astronut>
thanks
<astronut>
and yes
alexyk has quit []
<astronut>
(for any followup questions: yes, i'm doing homework, no i don't expect anyone to do it for me, but i am still having trouble with syntax)
<astronut>
why does let rec foo(a:int, b:int) : int = .... not seem to work
alexyk has joined #ocaml
<vixey>
don't write :int
<astronut>
do i have to do foo((a,b):(int*int)?
<vixey>
don't write :(int*int)
<astronut>
vixey: we're supposed to turn in something explicitly typed
<vixey>
don't
<flux>
astronut, let rec foo((a:int), (b:int)) : int = .. works
<astronut>
ah
alexyk has quit [Client Quit]
<flux>
although, I often prefer using this: let rec foo : int * int -> int = fun (a, b) -> ..
<flux>
it has the added benefit of being copypasteable to an interface definition
alexyk has joined #ocaml
<mfp>
astronut: do they want you to use uncurried functions?
<astronut>
hmmm - the lecture today was on curried functions, but the homework is covering last weeks lectures mainly
alexyk has quit [Client Quit]
<astronut>
still really shakey on this ocaml stuff - the syntax and such seems really unintuitive - but then again, the new paradigm is exepcted to be i guess
<jonafan>
well it helps when you aren't required to type things yourself
<astronut>
heh
* Yoric[DT]
was just teaching curried functions today.
<mfp>
Yoric[DT]: what's the usual approach, using uncurried and then curried?
<Yoric[DT]>
I don't know about the "usual approach".
<Yoric[DT]>
I was showing them that functions are just values like any others, which may be bound and returned.
<mfp>
(I thought it'd be easier to just use curried without telling them ;) and then use tuples and say ... "all this time we've been using curreid funcs")
<astronut>
Yoric[DT]: well, assuming your ircname is accurate, you're at least not my teacher
<Yoric[DT]>
astronut: yep, my ircname is accurate
<vixey>
when I started ocaml I wasn't sure if you should normally curry or not
<Yoric[DT]>
Then I had them explain to me how I could invoke the function returned by the first function.
<Yoric[DT]>
We then proceeded to toy around with this.
<astronut>
Yoric[DT]: where do you teach?
<Yoric[DT]>
Not putting all arguments, etc.
<Yoric[DT]>
astronut: in France.
<astronut>
sounds like a small class
<astronut>
what level?
<Yoric[DT]>
Yep, only 8 students.
<Yoric[DT]>
Second year of University.
<Yoric[DT]>
(and yes, it's in a weird small college of a large university, college which only keeps on existing despite the lack of students by the virtue of local politics)
<astronut>
ah, ok
peper has joined #ocaml
<peper>
hey folks
<Yoric[DT]>
hi
tar_ has quit []
sporkmonger_ has joined #ocaml
sporkmonger__ has joined #ocaml
sporkmonger has quit [Read error: 104 (Connection reset by peer)]
sporkmonger__ is now known as sporkmonger
pierre- has quit [Read error: 60 (Operation timed out)]
Snark has quit ["Ex-Chat"]
sporkmonger_ has quit [Read error: 60 (Operation timed out)]
<astronut>
hmm... i'm banned from using List.flatten to reimplement it - i wonder if List.concat is availble...
<astronut>
*shrug* - did it like that in a comment and reimplemented it properly
<astronut>
*shrug*
vpalle__ has joined #ocaml
alexyk has joined #ocaml
vpalle_ has quit [Read error: 110 (Connection timed out)]
jeremiah has joined #ocaml
<alexyk>
mfp: thanks for kprintf tip! I'm sticking to leprintf and le big mac[bookpro] anyways :)
alexyk has quit []
_zack has quit ["Leaving."]
* Yoric[DT]
is simultaneously attempting to find out if all the dependencies of Batteries are working in GODI 3.11 and attempting to prepare tomorrow morning's lecture on relational algebra.
* Yoric[DT]
is getting ready for a nice headache.
<mfp>
Yoric[DT]: re: 1st class modules, there's a compiler patch for that from lexifi
* mfp
gtg
<Yoric[DT]>
mfp: nice
_zack has joined #ocaml
_zack has quit [Client Quit]
rwmjones_ has joined #ocaml
sporkmonger has quit []
rwmjones_ has quit [Client Quit]
<peper>
is there something like min and max int?
<Yoric[DT]>
min_int and max_int, iirc
<Yoric[DT]>
Confirmed.
<peper>
thanks, i actually asked a friend earlier whether there is something like min_int and max_int :)
<Yoric[DT]>
:)
<Yoric[DT]>
Mmmmhh.... all the dependencies of Batteries seem to compile under OCaml 3.11 .
<Yoric[DT]>
Guess it's time to check Batteries themselves.
ikaros_ has quit [".quit"]
_zack has joined #ocaml
<Yoric[DT]>
_zack: ping
<_zack>
Yoric[DT]: hi
<Yoric[DT]>
How do you do?
<_zack>
not too bad
<_zack>
coming to the meeting?
<Yoric[DT]>
The OCaml Developer Days?
<Yoric[DT]>
Of course.
<_zack>
cool, I'll be there too
<Yoric[DT]>
Good, I'll finally be sure of what you look like :)
<_zack>
(not JFLA though)
<_zack>
ah ah, right :)
<_zack>
what happened to your frequent PPS visits?
<Yoric[DT]>
Lack of time, I guess.
<Yoric[DT]>
Well, that and the fact that I'm currently switching job.
<_zack>
o_O ?
<_zack>
no university any more?
<Yoric[DT]>
Well, détachement.
<Yoric[DT]>
If I manage to get it.
<_zack>
mmmhh, I'm not sure I know the bureaucratic meaning of that word...
<_zack>
something like part-time?
<_zack>
part research / part extra stuff?
<Yoric[DT]>
It means that I keep my status as researcher but I have a few years to try something... provided it's also research :)
<_zack>
ah ok, more like sabbatical then
<Yoric[DT]>
Yeah, something like this.
<Yoric[DT]>
I'm currently getting crazy in Bourges.
<_zack>
what's there?
<Yoric[DT]>
about 3h each way from home to teaching, 45 minutes from teaching to team, 1h from teaching or team to lab...
<Yoric[DT]>
Well, there's my college (Faculté des Sciences de Bourges), there's my team (ENSI de Bourges) and, perforce, there's me.
<_zack>
eh :)
cads has joined #ocaml
<cads>
hello
<_zack>
sound like a traveling salesman problem ...
<cads>
I am not!
<cads>
I only provide these products *lays out his wares*
<cads>
things most housholds could not do without!
<cads>
sure I am not a travelling salesman so much as I am a travelling provider of necessities for a fee.
<_zack>
cads: I was not referring to you
<cads>
and coming up with my route between all these cities is tough, just so you know :D
<Yoric[DT]>
_zack: yeah.
<cads>
hehe, _zack, I know, I was just moking a joke
<cads>
.. making*
<Yoric[DT]>
And unfortunately, all of that is to attempt to do some research in a team which a) I'm not interested in b) is not interested in me c) works in Linux kernel security.
<_zack>
Yoric[DT]: well, time to bed for me, unless you have something specific to discuss
<cads>
I actually came here to ask about ocaml, and whether monads play an important role in ocaml programs as they do in haskell
<_zack>
too bad :/
<Yoric[DT]>
_zack: I just wanted to mention that I'm currently preparing the Alpha 3 release, for OCaml 3.10 and 3.11 both.
<_zack>
cads: way less than in haskell, but you can use them nevertheless
<_zack>
Yoric[DT]: indeed, nothing against, I was just making a point that in the long run caring about 3.10 is probably not worth
<Yoric[DT]>
sure
<Yoric[DT]>
It was just about adding one line to the documentation, though.
<_zack>
but if it is relatively cheap, why not
<Yoric[DT]>
i.e. "this doesn't work in OCaml 3.10"
<_zack>
no problem then
<_zack>
thanks for clarifying
<Yoric[DT]>
my pleasure
Smerdyakov has quit [Read error: 60 (Operation timed out)]
<cads>
can you guys suggest a code listing of some good example ocaml code for someone wanting to get a bit of the feel of the syntax?
_zack has left #ocaml []
<Yoric[DT]>
Well, depends on whether you want to go mainstream OCaml or you want to join the current attempt at revolution :)
<cads>
I've seen some practical ocaml code and it was extremely dense and opaque to me, but I can expect that from a new functional language
<cads>
what kind of revolution?
slash_ has joined #ocaml
<cads>
if it's a love revolution...
kg4qxk has joined #ocaml
<Yoric[DT]>
OCaml Batteries Included
<Yoric[DT]>
It's an attempt at modernizing both the standard library and the syntax.
<Yoric[DT]>
cads: and, to answer your earlier query on monads, no, we don't use monads quite as often as in Haskell.
<cads>
batteries included would be a good thing
<Yoric[DT]>
Well, I'm pushing for it.
<Yoric[DT]>
And there seems to be much interest in Batteries, which is a good thing, too.
<cads>
so there are actual batteries you guys are conceptualizing/
<cads>
?
<Yoric[DT]>
What do you mean?
<cads>
what are 'Batteries'?
<cads>
oh, I see
<Yoric[DT]>
OCaml Batteries Included
<cads>
reading about it now
<cads>
that looks like a combination of haskell and a object oriented scripting language :D
<hcarty>
Yoric[DT]: Is there a decision on ( **> ) and ( <** ) vs ( <| ) and ( |> )?
<vixey>
"the syntax" .. of ocaml?
<vixey>
But you do this /and/ refuse to use camlp4?
<vixey>
hcarty, I have a decision on it but nobody agrees with me
<Yoric[DT]>
vixey: who are you talking to?
<vixey>
Yo
<vixey>
You
<Yoric[DT]>
vixey: then I have no clue what you're saying.
<vixey>
about batteries, you said you are changing the syntax of ocaml ?
<vixey>
but I heard it will not use any camlp4
<Yoric[DT]>
vixey: where did you hear that?
<Yoric[DT]>
We use it pervasively.
<vixey>
in #ocaml
<Yoric[DT]>
hcarty: well, we want <| and |> but we don't quite support it yet because we don't want to duplicate the work on pa-do.
<Yoric[DT]>
hcarty: whenever we start supporting pa-do, we will take advantage of it to get both <| and |> .
<Yoric[DT]>
vixey: well, obviously, there was an error somewhere.
<vixey>
ok
marmotine has quit ["mv marmotine Laurie"]
vpalle__ has quit [Read error: 60 (Operation timed out)]
<Yoric[DT]>
cads: where do you see object oriented scripting?
<cads>
in "r = lowercase (String.map (fun c -> if Char.is_letter c || Char.is_digit c then c else '_') name) " .map, .is_letter, .is_digit, are reminiscent of instance methods in a language like ruby
vpalle has joined #ocaml
<cads>
oh wait
<cads>
those are modules
<Yoric[DT]>
Well, String and Char are just module names.
<Yoric[DT]>
Yup.
<Yoric[DT]>
There are objects in OCaml, but the notation is confusing enough that they don't make OCaml look like an object oriented scripting language :)
<cads>
yeah, all I've read about ocaml's object system is that it's not usually used much
<Yoric[DT]>
Yeah.
<cads>
which makes me feel like it's not a completely reliable source that I read that from; if they weren't useful why would they be there?
<Yoric[DT]>
It's powerful but not very used.
<Yoric[DT]>
Well, it's only useful in a few advanced cases.
jlouis has quit [Remote closed the connection]
<hcarty>
My experience with objects in OCaml is that they can be very simple and easy for simple tasks. Their complexity seems to scale with the complexity of the task at hand more quickly than a comparable module-based implementation
<Yoric[DT]>
« Fatal error: exception Sys_error("_none_: No such file or directory") »
<Yoric[DT]>
Does this sound familiar to anyone?
<Yoric[DT]>
I have this error message when linking files with OCaml 3.11.
<Yoric[DT]>
I don't have it with 3.10.2 .
<kig>
to caricaturize a bit, objects are mostly about hiding state-mangling, fp is mostly about not doing state-mangling and making it explicit when done.
<Yoric[DT]>
ok, problem fixed
hkBst has quit [brown.freenode.net irc.freenode.net]
Guest13894 has quit [brown.freenode.net irc.freenode.net]
Asmadeus has quit [brown.freenode.net irc.freenode.net]
trisiak has quit [brown.freenode.net irc.freenode.net]
Guest13894 has joined #ocaml
hkBst has joined #ocaml
Asmadeus has joined #ocaml
trisiak has joined #ocaml
trisiak has quit [brown.freenode.net irc.freenode.net]
Asmadeus has quit [brown.freenode.net irc.freenode.net]
hkBst has quit [brown.freenode.net irc.freenode.net]
hkBst has joined #ocaml
Asmadeus has joined #ocaml
trisiak has joined #ocaml
vpalle has quit [Read error: 145 (Connection timed out)]