<Leonidas>
Smerdyakov: the problem is, that these Somes and Nones everywhere don't look very nice and maybe there's a better way to do it.
<Leonidas>
well, I guess I could fold_left it, but besides this, no idea.
<Smerdyakov>
I'm kind of confused. Does this code type-check?
ygrek has joined #ocaml
<Leonidas>
Smerdyakov: no, it doesn't. You need to use the version that is commented out.
<Leonidas>
I tried writing another, nicer version but didn't get very far.
Nepomuk has joined #ocaml
<Smerdyakov>
Isn't there a minimal value of the domain you're maximizing over, such that you can just start [acc] at that value?
<thelema>
mfp: great - should I start thinking about another release?
<Leonidas>
Smerdyakov: no, I don't think so. While I could construct some dummy entry like ({typ=CD; name="foo"; preis=0}, 0) which would be minimal, nobody would expect to get this as a result if the list is empty.
<thelema>
Leonidas: how about checking for an empty list and then priming your maxlist_tail with a value, similar to List.reduce
<Smerdyakov>
Leonidas, I definitely agree with the idea of using [fold_left].
<Smerdyakov>
Leonidas, you can also encapsulate the bothersome part in a higher-order function, such that you never need to write a functions that deals with both [option]s and your custom datatype.
ttamttam has quit ["Leaving."]
<thelema>
mfp: I like your changes to the build system - I'm still learning the OMake style of doing things, and produce very clunky omakefiles
<Leonidas>
thelema: the point is, I don't exactly know what the assignment really wants. I suppose a both solutions (optionals, empty checks) would be just fine.
middayc has joined #ocaml
<thelema>
Leonidas: make a solution that assumes an initial value, and a more general function that handles the [] case.
<thelema>
the more general function should call the initial value one to do most of the work
run has quit [Remote closed the connection]
<Leonidas>
thelema: but won't the matcher complain, that I don't handle the [] case?
<thelema>
Leonidas: you will handle the empty list case in your general function, and handle the end-of-list [] in your specific function
<Leonidas>
thelema: I'm seriously amazed how this got reduced down to a single match and a single fold :)
<thelema>
I don't see a way to make it better.
<Leonidas>
thelema: thank you :)
<thelema>
you're welcome.
<Nepomuk>
impressive :D
<thelema>
This is just how it's supposed to be.
<Leonidas>
and I thought my previous solution was 'ok'. I need to label that one 'awful' now.
valross has quit [Remote closed the connection]
Yoric has quit []
ua has joined #ocaml
ulfdoz has joined #ocaml
Associat0r has joined #ocaml
<mfp>
thelema: there are 3 other candidate extensions (4, if you include pa_batteries): pa_comprehension, pa_openin, pa_where --- what should I do about them?
<thelema>
I'm trying to figure out if the right thing to do with [syntax-exts] is to fold it into [aaa]
<thelema>
we're not going to have separate releases for aaa with extensions and aaa without...
<mfp>
I don't see any reason not to merge it into aaa --- the extensions are self-contained & completely optional
<Leonidas>
did I get it right? AAA is becoming the kind-of successor to batteries?
<thelema>
Leonidas: yes.
<thelema>
mfp: so how will people choose what to compile / install? I still don't get quite how omake deals with missing dependencies
<mfp>
thelema: there are no missing deps
<thelema>
although that doesn't seem a big problem for syntax extensions...
<Leonidas>
nice to see that batteries won't die. Python has taught me the value of an useful stdlib :)
<Camarade_Tux>
is it possible to specify the CC for use with ocamlbuild?
<mfp>
thelema: pa_strings depends on estring, which is included in that branch
<thelema>
mfp: yes, I saw the dependency included. Do we install our dependencies separately, or internal to aaa?
<mfp>
(I might enable auto-detection of estring someday; FTTB it just builds and installs it)
<mfp>
thelema: I included estring because it's not packaged anywhere AFAIK (not in Debian/GODI)
<mfp>
I'd say that whether to include or not is largely determined by the availability of the dep in packaged form
<mfp>
another factor being the size
<thelema>
for example, my next target is ocaml-fileutils
<mfp>
e.g., wouldn't consider including camomile
<thelema>
I agree that including camomile is... better avoided
<mfp>
fileutils is in Debian and GODI, so it's OK as an external dep
<mfp>
I assume it's also available in Fedora
<mfp>
it is
<thelema>
so it's an external dependency, but not like camomile, because camomile is required
<mfp>
you want to make it optional?
<thelema>
yes
<thelema>
I think
<thelema>
I want to provide it if it's not already present, I think.
<mfp>
what are you planning anyway? some sort of wrapper?
<thelema>
maybe I'm thinking of just absorbing the code.
excode has joined #ocaml
<mfp>
so, include it in the source tree & build only if needed / otherwise use the installed one?
<thelema>
yes
<thelema>
similarly camlzip
<thelema>
(which we've dropped as a prereq because I have no idea how to specify the different package names to omake)
<flux>
case in point: hashtbls, sets or maps don't get pretty-printed in the toplevel..
<thelema>
hmm, the toplevel keeps a linked list of printers and checks if the type of the printer is more general than the type of the value...
<thelema>
a simple linear search
<flux>
the problem is that you need to call the pretty printing function from your formatting function
<mfp>
typing/oprint.ml
<flux>
and it's unclear how to do that..
<thelema>
toplevel/genprintval.ml L129 - find_printer <- could rewrite this
<thelema>
would require something more than Ctype.moregeneral
<thelema>
and would require some infrastructure for nesting printers
<thelema>
like the current batteries printing infrastructure - List.print takes a printer for the contained type
<flux>
hmm.. so if you have type 'a foo, your pretty printing would get an additional function and be of signature Format.formatter -> 'a foo -> (Format.formatter -> 'a -> unit) -> unit ?
<thelema>
or some other order of arguments, but yes.
<thelema>
yup, we'd need to rewrite this infrastructure so that lists aren't handled specially
<thelema>
as it is, the printers installed by default are for int, float, char, string, int32, nativeint, int64
<thelema>
and everything else is special-cased
<flux>
I wonder how this would help pretty-printing for example Sets
<flux>
because that'd be awesome! ;)
<thelema>
maybe it'd be sufficient to special-case <abstr> to check for a function in the defining module Foo.to_string
<thelema>
hmm, has it always been reversed: - : Enum.t int = <abstr>
<thelema>
I expected [int Enum.t]
<flux>
hmm
<flux>
- : int list = [42]
<flux>
- : ('_a, '_b) Hashtbl.t = <abstr>
<thelema>
# 3 --^ 8 |> List.of_enum;;
<thelema>
- : list int = [3; 4; 5; 6; 7]
<thelema>
maybe it's the camlp4o
<flux>
likely that
<thelema>
stupid camlp4...
<thelema>
hmm, I am using Topfind.standard_syntax(), why am I getting revised types...
itouch has joined #ocaml
itewsh has quit [Success]
<thelema>
mfp: is there a reason to use "aaa.pa_comprehension.syntax" instead of just "aaa.pa_comprehension"?
<mfp>
.syntax is a convention other extensions seem to follow
<thelema>
well, can we have a [aaa.syntax] that loads all the child syntaxes?
Submarine has quit [Read error: 110 (Connection timed out)]
<mfp>
easy
<mfp>
hmmm /usr/bin/install: cannot overwrite directory `/usr/local/lib/ocaml/3.11.1/aaa' with non-directory
<thelema>
didn't I remove that from the OMakefile?
<mfp>
yes, it's from an older install
<thelema>
ok.
<mfp>
what about an ocaml script that does exec ocaml -I <path to aaa>
<mfp>
so that you can do ocamlfind aaa/ocaml
<thelema>
why not just recommend people copy our ocamlinit to ~/.ocamlinit?
<mfp>
s/an ocaml script/a shell script/
* thelema
is about to document that
<mfp>
no, actually, a shell script named "ocaml"
<thelema>
yes, I get your idea. why is ocamlinit not better?
<mfp>
they might not want to always use aaa?
<thelema>
of course they always want to use aaa - it's just better.
<thelema>
:)
<mfp>
hmm
<mfp>
you don't to use it when it conflicts with a module of yours
<mfp>
say you have a .cmo that uses extlib's IO and haven't recompiled against AAA
<thelema>
then you need to put an empty .ocamlinit in the current directory
<thelema>
~/.ocamlinit is only used if there's no ./.ocamlinit
<mfp>
or use -init bogus ok
bohanlon has quit [Broken pipe]
* thelema
moves src/syntax/estrings to lib/estrings
ttamttam has quit ["Leaving."]
<thelema>
I'm trying to figure out a good way to package extensions of camlzip to use IO.
<thelema>
I want to have an extended camlzip in libs/camlzip
<thelema>
but if camlzip is already installed, I only need to compile and install the extensions for aaa
<thelema>
and if it's not already installed - I guess I need to keep the extensions separate
<thelema>
I still don't know how to do an optional dependency
* thelema
reads up on "if" in omake
itouch has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
ulfdoz has quit [Read error: 110 (Connection timed out)]
slash_ has quit [Client Quit]
<thelema>
hmm, pa_comprehension's OMakefile refers to pa_strings a bunch
munga_ has quit [Read error: 113 (No route to host)]
<thelema>
and what happened to the all: target in batteries/OMakefile
robocop has quit [Remote closed the connection]
onigiri has joined #ocaml
creaux has joined #ocaml
valross has joined #ocaml
_unK has quit [Remote closed the connection]
ua has quit ["Lost terminal"]
<mfp>
thelema: each subdir defines its all: target when appropriate