<flux>
well, Not_found can't really be improved, because exceptions cannot be polymorphic
<flux>
so it can't have the original data structure, it can't have the value you were looking for, it can't even have a string, because you'd need to be able to convert an arbitrary datastructure into one
<flux>
so we're stuck with it :)
<flux>
but I don't think that writing touches the more general problem with exceptions: they can leak..
<flux>
oh, it has a separate part on exceptions
<flux>
right, it has some of the ideas that would be interesting to see in real life.
<flux>
I just wish someone(TM) took ocamlexc and updated it to work with current camls )
<flux>
:) even
sOpen has joined #ocaml
<palomer>
hrmph
* palomer
is tempted to go into the wonderful world of ocamlp4
<jli>
if I have some type like type sometype = Something of char * bool, is the only way to access the char and bool to use pattern matching?
<hcarty>
jli: I think all of the methods involve pattern matching of some sort
<jli>
hcarty: hm, okay. seems like using records would make the code more concise while still allowing pattern matching. is that true, or am I missing something?
<hcarty>
jli: Depends on the data you are using. If there is only one "Something" then it is likely to be cleaner to use a record
<jli>
hm, why does the number of instances make a difference?
<hcarty>
jli: If you have more than one then you would likely need a variant of some sort
robocop has left #ocaml []
<hcarty>
You could use both if you want (variant with each constructor having its own associated record type)
<jli>
oh, you mean if there is only one constructor called "Something"?
Ariens_Hyperion has joined #ocaml
<hcarty>
jli: Yes
love-pingoo has quit ["Connection reset by pear"]
alexyk has quit []
ofaurax has joined #ocaml
_andre has quit ["Lost terminal"]
vithos_ has joined #ocaml
* palomer
is looking at pa_sexp_conv and is quite confused
ofaurax has quit ["Leaving"]
vpalle has quit [Read error: 104 (Connection reset by peer)]
ofaurax has joined #ocaml
xerxes has joined #ocaml
vithos has quit [Connection timed out]
<palomer>
looks like I'm going to have to read and understand chapter 7
<jli>
of what?
<palomer>
tha camlp4 tutorial
vithos has joined #ocaml
<hcarty>
palomer: I don't think that the manual is up to date with the changes in camlp4 in 3.10 and later
<hcarty>
palomer: There are tutorials on ocaml-tutorial.org as well as links to other information to get you started
<jli>
what is the point of, say, "type age = int"?
bombshelter13_ has quit []
<palomer>
hrmph
<palomer>
jli, so we can do type age = bigint later without having to change all our type annotations
<hcarty>
jli: You can use that with module signatures to make the age type opaque to outside users
<palomer>
that too
<palomer>
hcarty, won't the private keyword do the same?
<jli>
ah, right. okay, thanks!
<palomer>
anyone tried compiling sexplib 4.2.7?
<palomer>
im getting the error:
<palomer>
File "pa_sexp_conv.ml", line 118, characters 11-28:
<palomer>
This function is applied to too many arguments,
<hcarty>
And more of a lack of installed dependencies
<Camarade_Tux>
well, mlgmp
<palomer>
so...who wants to help me polish a package before I release it to the wild?
* palomer
looks at flux and hcarty and Camarade_Tux
<hcarty>
Camarade_Tux: Interesting. I didn't know non-stdlib libraries were fair game for use in the shootout
<Camarade_Tux>
hcarty, gmp is one of the two exceptions
alexyk has joined #ocaml
<Camarade_Tux>
palomer, haha, almost no time
<Camarade_Tux>
hcarty, looks like mlgmp is not abandonned (even though its makefile looks like it has been made for gcc3 [which is what made me overreact]) :)
<Alpounet>
Camarade_Tux, it is awesome, you should take the time !
komar_ has quit [Read error: 54 (Connection reset by peer)]
komar_ has joined #ocaml
Yoric[DT] has joined #ocaml
vithos has quit [Connection timed out]
<jli>
palomer: what package?
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<Yoric[DT]>
hi
<palomer>
jli, it's a gui toolkit, sort of
<palomer>
Yoric[DT], wanna help me polish my library?
<Yoric[DT]>
In general, I'd like to.
<Yoric[DT]>
But not before this week-end :)
* Yoric[DT]
still needs to recover a bit from his wife's PhD.
<Camarade_Tux>
Yoric[DT], hi :)
<Yoric[DT]>
(that and I have lots of work late)
<Yoric[DT]>
Camarade_Tux: hi
<Camarade_Tux>
btw, it seems that xz is the winner for the lzma libs : used in the kernel (option) and slackware's packages are being migrated to a .tar.xz format
<Camarade_Tux>
will have to bind it now :)
<Yoric[DT]>
:)
<Camarade_Tux>
palomer, could you give the link ? I won't have time for it tonight but tomorrow should be ok :)
kaustuv has joined #ocaml
<palomer>
Camarade_Tux, you'll probably have trouble compiling it
<Camarade_Tux>
palomer, why ?
<jli>
is the only way to go from a character to a string to use Char.escaped?
<palomer>
Camarade_Tux, you need a boat load of libraries and you'll need to install my custom version of ocamlsdl
<kaustuv>
jli: Printf.sprintf "%c"
<Camarade_Tux>
or make a 1-character string initialized with it
<Camarade_Tux>
palomer, ok, that would be too long for today but I hope tomorrow will be ok
<Camarade_Tux>
and I fear no compilation ;)
<palomer>
:P
sporkmonger has quit [Connection timed out]
<Alpounet>
moreover, it needs either ocaml 3.10 or 3.11 CVS
jeanbon has quit [Read error: 110 (Connection timed out)]
<Camarade_Tux>
hmm, vanilla 3.11 won't work ?
* Camarade_Tux
has rm'ed his /ocaml310 last week
<palomer>
gah!
<palomer>
3.11 pre feb 13 has a bug in it
<Camarade_Tux>
no prob, as I said, I fear no compilation (besides gnome and X), I compile new kernels for breakfast and am used to compile everything by myself :)
sOpen has quit [Read error: 110 (Connection timed out)]
smimou has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]>
jli: with Batteries included, [Char.to_string] or [String.of_char] .
<kaustuv>
Yoric[DT]: any chance of getting libre to replace Str in Batteries?
<Yoric[DT]>
I personally can't stand Str, so I'd be tempted to say yes :)
<Yoric[DT]>
However, nothing such will happen before 1.0
<kaustuv>
Yeah, post-1.0 obviously.
<Alpounet>
like monadic stuffs :)
slash_ has joined #ocaml
* Camarade_Tux
has still not understood the use for String.matched_string, why not return the matched string immediately ?
* Alpounet
has seen (everywhere) many weird ways of working with strings... More than with ropes.
<Alpounet>
(everywhere in OCaml, here)
ofaurax has quit ["Leaving"]
<Alpounet>
gn
Alpounet has quit ["Ex-Chat"]
komar_ has quit [Read error: 54 (Connection reset by peer)]
komar_ has joined #ocaml
alexyk has quit [Read error: 60 (Operation timed out)]
<hcarty>
Yoric[DT]: Is the Batteries build-plan to move away from ocamlbuild?
<Yoric[DT]>
Well, Jérémy had ideas.
<Yoric[DT]>
But from what I can remember, he still intended to use ocamlbuild.
<hcarty>
Yoric[DT]: Ah, ok. Just curious.
monadic_kid is now known as elsuive_snk_kid
elsuive_snk_kid is now known as monadic_kid
sOpen has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
alexyk has joined #ocaml
<Ariens_Hyperion>
Does the usage of batteries impact perforca in anyway?
<Ariens_Hyperion>
performance*
<Yoric[DT]>
Launching the interpreter is much slower (about 1-2 seconds slower).
<Yoric[DT]>
I/O is marginally slower.
<Yoric[DT]>
(but much more powerful)
<Yoric[DT]>
Everything else should be as fast, if not faster.
<Ariens_Hyperion>
thanks!
<Yoric[DT]>
General caveat: that's from the top of my mind -- no actual testing.
<Yoric[DT]>
'night everyone
Yoric[DT] has quit ["Ex-Chat"]
smimou has joined #ocaml
m3ga has joined #ocaml
Ariens_Hyperion has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
<jli>
if I want to use lists to build bigger data structures in a functional way, when I want to "modify" a list element, do I just List.filter that element out, then List.find and manipulate it, and cons the result back onto the filter result?
<jli>
apologies for the nonconcision :)
<kaustuv>
jli: Take a look at List.map.
<kaustuv>
For example, to replace "hello" with "hi" in a list of strings,
<jli>
though for more complicated structures, it seems like it could become ungainly
<kaustuv>
Unless your problem is really trivial, you generally shouldn't use lists to encode data structures.
<jli>
yeah, it's a book exercise :)
<thelema>
jli: if you want lists with mofifiable issues, use a list of refs
xevz_ has joined #ocaml
<jli>
how do I give type hints for the result of a function?
<kaustuv>
let f : t1 -> t2 -> t3 = fun x y -> z ;;
xevz has quit [Read error: 54 (Connection reset by peer)]
xevz_ is now known as xevz
<thelema>
let increment (i:int) : int = i + 1
<kaustuv>
But the right answer almost always is: don't give type hints
<thelema>
kaustuv is right. why do you want to give type hint?
<jli>
because the interpreter figures out that it's a ('a * 'a list) list, but I want it to know that more specfically it's an 'a graph
<jli>
should I just not bother?
<kaustuv>
For such things you should compile the .ml file with the -i option, such as:
<kaustuv>
% ocamlc -i foo.ml > foo.mli
<kaustuv>
then edit the .mli and replace the types with ones to your liking (and deleting the entries you don't want exposed)
<jli>
why is that better?
<kaustuv>
With the .mli you can hide the implementation of 'a graph, for one. Thus, any code that uses your graph functions will still work if you change the implementation later.
<kaustuv>
But if this is too much bother for your assignment, just do as thelema says
<thelema>
yes, do as I say. muhuhahaha!
<jli>
kaustuv: would an alternative way to hide the implementation be to use the module system?
<thelema>
jli: that's exactly what he suggested.
<jli>
oh.
<jli>
I thought the module system involved sigs and structs and stuff
<jli>
does ocamlc -i generate that?
slash_ has quit [Client Quit]
<thelema>
it does. ocamlc -i generares the sig
<thelema>
and the module framework is assumed by the compiler as part of separate compilation
Kerris7 has quit ["Don't even think about saying Candlejack or else you wi"]