Alpounet changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
Pimm has quit [Read error: 60 (Operation timed out)]
<palomer> mfp, what does that do?
<mfp> palomer: it will add the options specified with -ppopt to the camlp4o cmdline
<mfp> in response to <palomer> camlp4o -I /usr/lib/ocaml/type-conv pa_type_conv.cmo pa_seditable.cmo test.ml <-- how do I write this in ocamlfind?
<palomer> oh, I see
<palomer> ocamlfind: When using -syntax, the META variable 'preprocessor' must be set <-- I still get the same error
<palomer> I think ocamlfind ocamlc -syntax camlp4o is not the same as camlp4o
<palomer> I think ocamlfind ocamlc -syntax camlp4o compiles an ocaml source file with some syntax extensions
<palomer> and camlp4o simply outputs the processed source
<mfp> <palomer> ocamlfind: When using -syntax, the META variable 'preprocessor' must be set <-- I still get the same error -> if pa_type_conv doesn't set preprocessor, you can try with -package camlp4,pa_type_conv
<mfp> camlp4o detects when its stdout is redirected to a pipe and writes a serialized representation of the parse tree in that case
<mfp> otherwise, it'll output the preprocessed, pretty-printed code
<mfp> indeed, ocamlfind ocamlc -syntax camlp4o -c compiles; AFAIK you cannot output the processed code directly via ocamlfind
Regenschein has quit [Nick collision from services.]
Regenschein has joined #ocaml
<palomer> right
<palomer> so I can't use ocamlfind in this case
<mfp> you can get the -I option with ocamlfind query
Regenschein has quit [Client Quit]
<mfp> $ ocamlfind query -i-format type-conv.syntax
<mfp> -I /usr/lib/ocaml/type-conv
<palomer> oh, I see
<palomer> combined with `
<mfp> yes
<palomer> cool!
<mfp> camlp4o $(ocamlfind query -i-format -r sexplib.syntax) pa_type_conv.cmo pa_sexp_conv.cmo foo.ml works for me
<mfp> -r includes sexplib's dependencies (type-conv, in this case)
ikaros has quit ["Leave the magic to Houdini"]
CcSsNET_ has joined #ocaml
ccasin has joined #ocaml
CcSsNET has quit [Connection timed out]
bogen has joined #ocaml
CcSsNET_ has quit [Read error: 104 (Connection reset by peer)]
CcSsNET has joined #ocaml
joewilliams has quit [Remote closed the connection]
CcSsNET has quit [Client Quit]
zhijie has joined #ocaml
zhijie has quit [Read error: 104 (Connection reset by peer)]
zhijie has joined #ocaml
pad has joined #ocaml
ski_ has quit ["Lost terminal"]
flux has quit [Remote closed the connection]
ski_ has joined #ocaml
mjsor has joined #ocaml
valross has quit ["Ex-Chat"]
maskd has quit [Remote closed the connection]
mjsor has quit []
Tianon has quit [Read error: 113 (No route to host)]
Tianon has joined #ocaml
_unK has quit [Remote closed the connection]
joewilliams has joined #ocaml
pad has quit [Remote closed the connection]
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
jeddhaberstro has quit [Client Quit]
bogen has quit ["Leaving."]
ccasin has quit ["Leaving"]
joewilliams has quit [Remote closed the connection]
DWyatt has joined #ocaml
DWyatt has quit [Client Quit]
DWyatt has joined #ocaml
DWyatt has quit [Remote closed the connection]
DWyatt has joined #ocaml
DWyatt has quit [Client Quit]
DWyatt has joined #ocaml
DWyatt_II has joined #ocaml
<DWyatt_II> I'm fairly new to OCaml and am trying to understand the syntax of that snippet.
EliasAmaral has joined #ocaml
DWyatt has quit [Read error: 110 (Connection timed out)]
DWyatt_III has joined #ocaml
DWyatt_II has quit [Read error: 104 (Connection reset by peer)]
DWyatt_III has quit [Read error: 54 (Connection reset by peer)]
DWyatt_III has joined #ocaml
DWyatt_III has quit [Read error: 110 (Connection timed out)]
_zack has joined #ocaml
tmaeda is now known as tmaedaZ
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
demitar has joined #ocaml
yakischloba has quit ["Leaving."]
flux has joined #ocaml
WuJiang has quit [Read error: 60 (Operation timed out)]
WuJiang has joined #ocaml
palomer has quit [Read error: 110 (Connection timed out)]
thrasibule has joined #ocaml
ksson has joined #ocaml
Yoric has joined #ocaml
ygrek has joined #ocaml
thrasibule has quit [Read error: 113 (No route to host)]
Associat0r has quit []
Associat0r has joined #ocaml
ttamttam has joined #ocaml
Associat0r has quit [Success]
_unK has joined #ocaml
ttamttam has quit ["Leaving."]
rwmjones_ has joined #ocaml
rwmjones_ is now known as rwmjones-home
_zack has quit ["Leaving."]
maskd has joined #ocaml
Pimm has joined #ocaml
ikaros has joined #ocaml
drunK_ has joined #ocaml
_unK has quit [farmer.freenode.net irc.freenode.net]
gildor has quit [farmer.freenode.net irc.freenode.net]
diml has quit [farmer.freenode.net irc.freenode.net]
safire_ has quit [farmer.freenode.net irc.freenode.net]
infoe_ has quit [farmer.freenode.net irc.freenode.net]
ygrek has quit [farmer.freenode.net irc.freenode.net]
Pimm has quit [farmer.freenode.net irc.freenode.net]
smimou has quit [farmer.freenode.net irc.freenode.net]
schme has quit [farmer.freenode.net irc.freenode.net]
patronus has quit [farmer.freenode.net irc.freenode.net]
BigJ has quit [farmer.freenode.net irc.freenode.net]
willb has quit [farmer.freenode.net irc.freenode.net]
Pimm has joined #ocaml
ygrek has joined #ocaml
smimou has joined #ocaml
schme has joined #ocaml
patronus has joined #ocaml
BigJ has joined #ocaml
infoe_ has joined #ocaml
gildor has joined #ocaml
safire_ has joined #ocaml
willb has joined #ocaml
diml has joined #ocaml
safire_ has quit [SendQ exceeded]
safire_ has joined #ocaml
drunK_ has quit [Remote closed the connection]
_unK has joined #ocaml
cloudhead has joined #ocaml
Narrenschiff has joined #ocaml
eclugtesting has joined #ocaml
<eclugtesting> salut
ulfdoz has joined #ocaml
<Camarade_Tux> hi
ksson has quit [Read error: 60 (Operation timed out)]
tmaedaZ is now known as tmaeda
<Camarade_Tux> hmmm, it's not possible to tell ocamlbuild to use a file instead of "_tags", right?
Yoric has quit [Read error: 110 (Connection timed out)]
Yoric has joined #ocaml
ksson has joined #ocaml
Narrenschiff has quit []
ttamttam has joined #ocaml
Smerdyakov has joined #ocaml
Yoric has quit [Read error: 110 (Connection timed out)]
_JFT_ has joined #ocaml
Yoric has joined #ocaml
ttamttam has quit ["Leaving."]
Yoric has quit [Read error: 54 (Connection reset by peer)]
Yoric has joined #ocaml
<Gertm> is there a HTTP library for OCaml? Something that will allow me to download urls?
<mrvn> I think there are some curl bindings
<Camarade_Tux> yes, and ocamlnet can probably do that too
<Gertm> ah, nice, thanks
joewilliams has joined #ocaml
Abs_T has joined #ocaml
<Gertm> I installed the curl library (easy in debian, luckily) but I can't do 'open Curl;;' in the interactive mode, what am I missing?
<orbitz> did you install the ocaml curl library too?
<Camarade_Tux> Gertm: try: #use "topfind";;
<Camarade_Tux> and then: #require "curl";;
<Camarade_Tux> (not sure it's called "curl" though)
<Gertm> cool, that works
<Gertm> so what is this topfind thing?
<Gertm> (I've just started learning OCaml today, forgive my newbness)
<Camarade_Tux> it loads a more convenient way to find packages
<Gertm> kinda like asdf but for ocaml then?
<Camarade_Tux> the #use directive tells the toplevel to read a file and execute it: you actually have a file called "topfind" on your computer (it's ocaml although it doesn't have the .ml extension)
<Camarade_Tux> (dunno what asdf is)
<Gertm> np
<orbitz> i thought asdf was more pacakge management than finding
<Gertm> so I can use those 2 directives in my source files aswell?
<orbitz> asdf being closer to cabal
<Gertm> ah, thanks orbitz :)
<orbitz> but i haven't used asdf
<Gertm> it's the default package handler in common lisp
<Gertm> the commands are similar
<Gertm> anyway, can I use those #use and #require directives in my source files aswell?
<Gertm> or do I tell the compiler to include the correct libs?
<Camarade_Tux> no, this only works in the toplevel
<Gertm> ah ok
<Camarade_Tux> for your source files, you can use: ocamlfind ocamlc -package curl your_file.ml
<Camarade_Tux> this will compile to bytecode, use "ocamlopt" or "opt" instead of "ocamlc" to compile to native code
<orbitz> on a side note, playing around with curl might not be the best starting point in learnign Ocaml.
<Gertm> I just need to get a file downloaded so I can process it, the example on the curl lib page is enough for me, I already got it working.
eclugtesting1 has joined #ocaml
Yoric has quit []
<ksson> is there a reason that most packages include a "make doc" command instead of putting the documentation directly inside the tarball?
<EliasAmaral> it may be generated from sources
<EliasAmaral> or it may output .html and/or .pdf from latex files
CcSsNET has joined #ocaml
<Camarade_Tux> the doc is most often generated through ocamldoc, it's pretty fast and putting the doc in the tarball would make them bigger
<ksson> hm ok
<Camarade_Tux> plus ocamldoc can output to html, tex, and several other formats, you'd have to put them all in the tarball then
eclugtesting has quit [Read error: 60 (Operation timed out)]
<EliasAmaral> ocamldoc looks inside the source code? it generates the standard library reference right? (all this time and i never used a in-source documentation except the day the professor compelled me to)
<ksson> fair enough
<ksson> it's just that my doc building process is a bit complicated and might break on user's systems
<ksson> i guess i have simplify it
<Camarade_Tux> EliasAmaral: yeah, afaik it's like doxygen for C/C++: you make comments like (** foooooo *) and they will be turned into doc
<Camarade_Tux> (note the two stars)
<EliasAmaral> actually i had to use doxygen all the semester. with bogus exercises in C++
<ksson> n
<ksson> s/have/have to
ccasin has joined #ocaml
<EliasAmaral> hm
<EliasAmaral> Camarade_Tux, yeah i have seen that (** before. it is useful for library writers (and maybe for large programs... but i cant imagine a well-written program that would benefit. maybe i haven't lived enough..)
Narrenschiff has joined #ocaml
<Camarade_Tux> well, (** ... *) usually goes into the .mli files which means it's pretty lightweight
<EliasAmaral> :) maybe i am just too lazy
<mrvn> I still hate that ml and mli files are seperate.
<EliasAmaral> ... i am just too lazy to write .mli files, actually
<EliasAmaral> (and to keep them up to date as well)
<ksson> ? how would you do without .mli files, mrvn?
<mrvn> and 90% of them are plain copies of the ml file
<ksson> EliasAmaral: it's really useful for abstract types
<EliasAmaral> ksson, they can be autogenerated
<mrvn> ksson: with keywords.
<Camarade_Tux> well, ocamlc -i works quite well when creating .mli files
<EliasAmaral> in fact they maybe should
<mrvn> EliasAmaral: That only makes sense as first draft that you then edit.
<ksson> no, autogenerated mli files are useless
<EliasAmaral> i usually "draft" with the interpreter
<ksson> maybe they spare some typing in the beginning
* Camarade_Tux uses ocamlc -i as a starting point
<EliasAmaral> Hum.
<ksson> but an mli file is only useful when it is *different* from ocamlc -i :)
<mrvn> The ml file should declare types and cvalues as public or private (except private is already used) and then the cmi file would only get the public parts.
<mrvn> s/cvalues/values/
<EliasAmaral> ksson, ok I have no idea why an mli should (or even could) be different, aside from the comments
<EliasAmaral> ah.
<mrvn> EliasAmaral: to hide things that users of a module should not see
<EliasAmaral> yes, but i usually don't have private global things
<EliasAmaral> but, yes, then it's useful
<mrvn> EliasAmaral: Often you have "type foo = int" in .ml and "type foo" in .mli. That way the actual type of foo remains hidden from the user and you can change it if you rewrite the module.
<EliasAmaral> Hmmmmmm.
<mrvn> Or helper functions that are not part of the API.
<EliasAmaral> didn't knew that :)
<ksson> mrvn: indeed, that could work
<ksson> something like
<ksson> private type t = ...
<ksson> and
<ksson> abstract type t = ...
<EliasAmaral> maybe there should be a new keyword for that.. but, then, why to pollute the namespace with something that we can already do? the language designer asks
<EliasAmaral> hmm
<mrvn> ksson: private type t = ... and type t = private ... maybe.
<EliasAmaral> abstract can be used inside .ml?
<flux> eliasamaral, also .mli-files are useful in the presense of separate compilation
<EliasAmaral> and private
<EliasAmaral> flux, how?
<flux> eliasamaral, is you have files that dependon Foo, they only need to be recompiled if foo.mli changes, not when foo.ml changes
<mrvn> EliasAmaral: Because now you have to edit 2 files every time you change the API.
<flux> ..well, with byte code compilation anyway..
<EliasAmaral> flux, hmmmmmmmmm.
<mrvn> flux: so generate mli files from ml automatically.
<flux> mrvn, great.. so when the .ml-file changes the .mli-file changes also.. ?-)
<mrvn> flux: only when the contents changes if you aren't dumb. :)
<flux> well, add some magic and you can hook that decently into your build process
<EliasAmaral> mrvn, so one couldn't use abstract/private in .ml files?
<flux> I sometimes even write .mli-files up front, to design what the module should look like
<mrvn> flux: some camlp4 preprocessor could.
<flux> mrvn, I was thinking something much more simpler
<flux> mrvn, like, generate new .mli-file if it differs from the original .mli-file, replace it
<mrvn> flux: you need a little bit of extra syntax to declare private and abstract types and values.
<flux> mrvn, actually now that I think of it again, I'm not sure how it'd work with make
<flux> (it'd work easily if it's ok to run make multiple times)
<EliasAmaral> shell script can do also. ocamlc -i to a temporary file, then diff, then move if different (but it will fail if not normalized)
<flux> in any case, I like .mli-files as something simple I can browse to see how to use the module
<flux> the .ml-file is needlessly low-level
<flux> perhaps others prefer to user the ocamldoc-generated files
<EliasAmaral> flux, maybe ocamldoc is better?
<EliasAmaral> hm
<mrvn> flux: sure. But do I need to manually write them :)
<EliasAmaral> ocamldoc could just output to... mli :)
<flux> (it's easy to switch to the implementation too, if you're in the .mli-file)(
<ksson> EliasAmaral: no, .mli is more than documentation (abstract types, hiding functions, etc)
<mrvn> flux: The IDE (if you use one) could also easily hide the details in the ml file and only leafe the parts from the mli file.
<ksson> .mli as documentation is fine
<ksson> ocamldoc (html output at least) has the slight advantage of clickable types, identifiers etc
<EliasAmaral> ksson, but if you don't use abstract/hiding, then it is..
<flux> emacs + otags :)
<flux> and there was this other thing too that worked even beter
<ksson> EliasAmaral: ok, but you really should :)
<mrvn> If the type is abstract then you do not need to know as user.
<ksson> flux: yes, but sometimes i like to look at the interface of a library without downloading it
<mrvn> and it is still clickable.
<flux> in principle there indeed could be additional keywords (say, camlp4-implemented, as mrvn suggested) that would allow to easily expose what you want
<flux> and that would allow generating .mli-files from .ml-files
<EliasAmaral> i really don't like that acm ask me to pay to read papers :( and they have a 'code of ethics'
<EliasAmaral> i suppose that it must be very expensive to run acm
<flux> ksson, but in that case you're not really developing, you're just interested. yes, I really like when libraries put the ocamldocified mli-files online too :)
<EliasAmaral> the 'code of ethics' of them says one must follow copyright, but then says it's ok to break laws if they are unethical
<flux> eliasamaral, maybe the question is that does ACM turn in a lot of profit or not
<flux> eliasamaral, I'm thinking not
<flux> (but that's just guessing, no idea really)
<EliasAmaral> this compels me to search bugmenot :)
<EliasAmaral> flux, hmmm
<mrvn> EliasAmaral: For americans that is not only ok, it is a duty
<Camarade_Tux> ACM's membership is _quite_ expensive iirc, they'd probably have more members with lower fees
<flux> hmm, really, how much is it?
<flux> I thought it was relatively affordable
<flux> of course, I can (atleast for a while still..) access the papers through my university
<mrvn> maybe you should start a free-acm.org
<ksson> flux, mrvn : ok, i agree with you that it could be nice to put the same information into the .ml file directly
<flux> I imagine similar services exist already
<flux> people collecting white papers
<flux> of course, running servers isn't free either :P
<ksson> but i think you wouldn't type less in total
<mrvn> ksson, flux: That is actually the only part I like about java.
<flux> ksson, I don't personally mind having to maintain a separate .mli-file
<mrvn> ksson: I would cut&paste less.
<flux> but I can see the advantage
<flux> in my experience it is quite a small amount of work
<ksson> mrvn: but what do you cut and paste?
<ksson> the types from ocamlc -i?
ttamttam has joined #ocaml
<mrvn> ksson: ocamlc -i output, comments
<ksson> hmm
<flux> I sometimes use emacs' type information feature to extract the type
<mrvn> I like my ml file to be commented too so I kind of end up with the same comment in the mli and ml files.
<ksson> i put comments for users of the interface in the .mli directly
<ksson> in the .ml file, there will be only comments concerning how things are done
<mrvn> The ml files has more comments though
<flux> or if I've written the signature beforehands, I just copy it into the .ml-file and write let foo : 'a -> ('a -> bool) -> bool = fun x f -> ..
<Camarade_Tux> flux: $50 for students and $100 otherwise, it's not really expensive but it's not very cheap either
<Camarade_Tux> especially when most papers are probably available somewhere else
<mrvn> Finding a free source for a paper is a pain though
<ksson> scholar.google.com works really well for finding (more recent) papers
<Camarade_Tux> plus, I don't believe even 10_000 downloads a year cost ACM $50 or $100
<mrvn> *bookmarking*
<Camarade_Tux> mrvn: definitely
<ksson> hmm, the .mli file seems to be really a matter of taste
<Camarade_Tux> I was looking for papers about r-trees last year, it has been a pain and I finally found enough info in ENS' library (through a friend)
<ksson> i don't always write one either
bzzbzz has quit ["leaving"]
<ksson> only if i have a well defined interface in my head
<Camarade_Tux> (actually, I had to use several sources to get enough infos)
<ksson> then i can basically write it before implementing the .ml file
EliasAmaral has quit [Read error: 60 (Operation timed out)]
<mrvn> ksson: doesn't work. Try to search for "work stealing deque" and the first hit just gives you the ACM portal.
<ksson> mrvn: indeed, but look at the nice "all 22 versions" link
<mrvn> and then I have to click through 22 links to find the one that is free.
<ksson> mrvn: yes, but it's easy to see
<ksson> basically, if it's springer or acm, it's not free :)
<ksson> mrvn: i don't know of any better solution, if you find one, let me know :)
<mrvn> I'm missing the "only free sources" button.
<ksson> it's not that hard, for that paper, the last one on the first page works
<ksson> it was the second link i clicked (some broken link first)
<mrvn> Still sucks if you are looking for something. The first few papers it finds might not even be the right ones and then you have more and more clicks.
<ksson> mrvn: what are you expecting? :)
<mrvn> An AI that finds the right paper for me. :)
<ksson> mrvn: how do you currently search for papers?
<mrvn> ksson: like this, with a lot of time.
yakischloba has joined #ocaml
<ksson> before, i had to click through several different sites of libraries etc
<Smerdyakov> Anything recent in the ICFP sort of community is going to be on authors' web sites.
<ksson> Smerdyakov: yes, and linked by google scholar :)
EliasAmaral has joined #ocaml
_JFT_ has quit []
_JFT_ has joined #ocaml
_JFT_ has left #ocaml []
Smerdyakov has quit ["byebye"]
joewilliams has quit ["Leaving..."]
demitar has quit ["Ex-Chat"]
joewilliams has joined #ocaml
Abs_T_ has joined #ocaml
Abs_T_ has quit [Client Quit]
eclugtesting1 has quit [No route to host]
ksson has quit [Read error: 113 (No route to host)]
BiDOrD has quit [Read error: 60 (Operation timed out)]
* thelema will deal with the merge conflicts merging aaa into batteries master this afternoon
<EliasAmaral> aaa?
Abs_T has quit [No route to host]
ski_ has quit ["Lost terminal"]
<EliasAmaral> i am happy that batteries is being actively developed :)
_JFT_ has joined #ocaml
_JFT_ has left #ocaml []
BiDOrD has joined #ocaml
marteo has joined #ocaml
Elive_user7_fr has joined #ocaml
Elive_user7_fr has quit [Client Quit]
CcSsNET has quit [Success]
<mfp> thelema: don't forget to tag batteries (master branch) in its current state before the merge
<mfp> so we can recover the stuff that was omitted in aaa easily
<EliasAmaral> batteries use svn? or something else?
<mfp> git
<EliasAmaral> :)
palomer has joined #ocaml
Associat0r has joined #ocaml
<palomer> hrmph.
<palomer> I wonder if lazy x is the same as lazy (Lazy.force (lazy x))
<EliasAmaral> no, it's not
<EliasAmaral> it will evaluate x
<EliasAmaral> and it's not the same object (in == sense)
<palomer> which will evaluate x?
<EliasAmaral> and i guess they could not be forced into the same object (because of side-effects)
<EliasAmaral> lazy (Lazy.force (lazy x))
<EliasAmaral> it will call Lazy.force so it will evaluate x
<palomer> but the outermost lazy will stop lazy.force from evaluating x
<EliasAmaral> ... o.o
<EliasAmaral> really?
<EliasAmaral> Hmmmmmm...
<EliasAmaral> forcing lazy (Lazy.force (lazy x)) will eval x twice?
<EliasAmaral> i guess it will not
<EliasAmaral> maybe lazy (Lazy.force (lazy x)) don't have the same (internal) structure as lazy x, but..
<mrvn> (Lazy.force (lazy x)) evaluates and the lazy around then just stores the value.
<mrvn> when the outher lazy gets evaluated
<palomer> so, disregarding ==, they are the same
<mrvn> useless waste of memory imho
<mrvn> afaik that is comparable to fun () -> (fun () -> x) () )
<mrvn> # let a = lazy (Lazy.force (lazy (Printf.printf "Evaluating\n")));;
<mrvn> val a : unit lazy_t = <lazy>
<mrvn> # Lazy.force a;;
<mrvn> Evaluating
<mrvn> - : unit = ()
<EliasAmaral> hmm in fact one could use fun () -> .. to implement lazy
<palomer> EliasAmaral, not quite
<palomer> mrvn, I'm doing it so I can use let rec
<palomer> let rec foo = bar foo won't work, but let rec foo = lazy (Lazy.force (bar foo)) works
<mrvn> type ['a] lazy = { mutable cache : 'a option; fn : unit -> 'a } let make fn = { cache = None; fn = fn; } let force x = x.cache <- x.fn (); x.cache
<palomer> bar foo is of type 'a lazy
<palomer> the let rec restriction is really annoying
<palomer> I mean, if the rhs is of type 'a Lazy.t or 'b -> 'c, then it should be legal
<mrvn> # let rec foo = fun () -> bar foo;;
<mrvn> val foo : unit -> 'a as 'a = <fun>
<mrvn> # let rec foo = (fun () -> bar foo) ();;
<mrvn> Error: This kind of expression is not allowed as right-hand side of `let rec'
<mrvn> why is that actually?
<palomer> why is what?
<mrvn> That the second isn
<mrvn> 't allowed
<palomer> I never quite understood
<EliasAmaral> there should be a ocaml bot here
<palomer> but I think it has something to do with the order of evaluation
<EliasAmaral> :)
<mrvn> I thought it was due to rectypes but even with ocaml -rectypes it fails
<palomer> it's not a typing thing
<EliasAmaral> let rec a = 1 :: a works
<mrvn> ahh, right. because foo is a simple value and not function
<palomer> 1 :: a is a value
<mrvn> # let rec foo () = bar (foo ());;
<mrvn> val foo : unit -> 'a = <fun>
<palomer> functions are values :O
<palomer> in that case it was the application which was illegal
<mrvn> But a isn't passed to a function
rwmjones-home has quit [Read error: 104 (Connection reset by peer)]
<palomer> # let rec foo = (fun () -> bar foo) ();; <--application = bad
<mrvn> You can't pass a value to a function that isn't evaluated yet
<mrvn> a non function value
<palomer> let rec foo = a b <-- does not work if a and b are actually recursive in foo
<mrvn> palomer: unless they return a function
<palomer> even if they do
<palomer> try it out
<mrvn> anyway, the answere is to use let rec foo () =
Amorphous has quit [Read error: 110 (Connection timed out)]
<palomer> eta expansion
Amorphous has joined #ocaml
tmaeda is now known as tmaedaZ
EliasAmaral is now known as dark
<dark> Wooho.. I finally have this nick. It was maybe my dream maybe 5 or 7 years ago (but that was on another network..)
<dark> but now it seems to be .. lame
<dark> what if nobody know i am EliasAmaral? (I have changed my nick before, from dark_light to EliasAmaral)
ikaros has quit ["Leave the magic to Houdini"]
<Gertm> does ocaml have list comprehensions? I read something about OCaml Batteries Included..
<mfp> Gertm: batteries does have generalized comprehensions (not only lists)
<Gertm> so what's batteries?
<Gertm> a library?
<mfp> yes
<mrvn> a collection of modules
<Gertm> I assume it's not in the standard distribution?
<Gertm> oh debian has a package, how convenient :)
<mfp> it's not shipped with the compiler
<mrvn> we wished it were
<mrvn> .oO(What does debian not have? )
<palomer> what are generalized comprehensions?
<palomer> (as opposed to list comprehensions)
<mfp> note that the currently active branch (AAA, soon to be merged into master, thelema will tell you) differs a bit from the one packaged in Debian
<mfp> you can find the latest release here > http://github.com/thelema/AAA-batteries/downloads
<Gertm> oh, so better use that then?
<mfp> yes
<Gertm> argh I'll have to uninstall the debian one then
<mfp> atm. it's named Batteries AAA, but it's going to be renamed to "Batteries" (replacing the old codebase) soon
<mfp> the ocamlfind packages are named aaa.*
<mfp> you can install both at a time
<mfp> until the AAA -> Batteries renaming is performed
<Gertm> I'll just use the latest release
<mfp> palomer: you can choose the src/destination containers
<mfp> e.g. # [? Array : (x, y) | x <- 0--2; y <- 1--2 ?];;
<Gertm> how do I add it to the ocaml search path, or do I just install it in /usr/lib/ocaml ?
<mfp> - : array (int * int) = [|(0, 1); (0, 2); (1, 1); (1, 2); (2, 1); (2, 2)|]
<palomer> that's pretty cool
<mfp> Gertm: it'll install using ocamlfind to /usr/local/lib/ocaml/ ...
<palomer> only arrays and lists?
<palomer> haskell used to have something called "monadic comprehensions", I believe
<mfp> Gertm: then you can use it as explained in README
<mfp> palomer: any module with a few functions like filter_map (this is documented somewhere)
ccasin has quit [Read error: 110 (Connection timed out)]
<mfp> the dst container can be anything with .of_enum
<mfp> # [? (x, y) | x <- 0--2; y <- 1--2 ?];; => - : Batteries.Enum.t (int * int) = <abstr>
<palomer> cool
<palomer> though I must say, during my whole haskell career, I never once used comprehensions
<palomer> though they certainly have that cool factor
<mfp> the src module needs to have either enum (which returns an enum) or map, filter & concat
<mfp> in the latter case, the syntax extension seemingly performs some optimizations
<palomer> either?
<palomer> how do they accomplish that?
<mfp> [? (x,y) | x <- 0--2; y <- List : l ?] uses List.map, filter & concat
<mfp> [? (x,y) | x <- 0--2; y <- List.enum l ?] uses an intermediate enum
<palomer> oh, two different syntax
<palomer> I thought they had camlp4 analyze the module
Narrenschiff has quit []
yakischloba has quit [farmer.freenode.net irc.freenode.net]
diml has quit [farmer.freenode.net irc.freenode.net]
gildor has quit [farmer.freenode.net irc.freenode.net]
infoe_ has quit [farmer.freenode.net irc.freenode.net]
ygrek has quit [farmer.freenode.net irc.freenode.net]
ulfdoz has quit [farmer.freenode.net irc.freenode.net]
_unK has quit [farmer.freenode.net irc.freenode.net]
Pimm has quit [farmer.freenode.net irc.freenode.net]
willb has quit [farmer.freenode.net irc.freenode.net]
smimou has quit [farmer.freenode.net irc.freenode.net]
BigJ has quit [farmer.freenode.net irc.freenode.net]
schme has quit [farmer.freenode.net irc.freenode.net]
patronus has quit [farmer.freenode.net irc.freenode.net]
Associat0r has quit []
wormphlegm has joined #ocaml
_unK has joined #ocaml
Pimm has joined #ocaml
ygrek has joined #ocaml
smimou has joined #ocaml
schme has joined #ocaml
patronus has joined #ocaml
BigJ has joined #ocaml
willb has joined #ocaml
yakischloba has joined #ocaml
infoe_ has joined #ocaml
gildor has joined #ocaml
diml has joined #ocaml
<Gertm> hmm I have camlp4o but not camlp4of, where can I find that?
<palomer> how does camlp4 differentiate between <- and :=?
<palomer> Gertm, using debian?
<palomer> if so, camlp4-extras or somesuch
CcSsNET has joined #ocaml
<palomer> what's the assignment operator in camlp4?
<palomer> := gets translated to <-
sgnb` has joined #ocaml
sgnb has quit [Read error: 54 (Connection reset by peer)]
<Gertm> palomer: thanks
derenrich has joined #ocaml
CcSsNET has quit [Remote closed the connection]
ygrek has quit [Remote closed the connection]
jonafan_ has joined #ocaml
mjsor has joined #ocaml
mjsor has quit [Client Quit]
jonafan has quit [Read error: 60 (Operation timed out)]
yakischloba has quit ["Leaving."]
<thelema> mfp: Tagging the old mainline is the easy part. Merging is ugly - I think I'm going to skip the merge and rename the branches to get the desired effect.
<maskd> so aaa is a full replacement?
<thelema> There's some things that batteries did that aaa doesn't do now.
<thelema> Most of this requires additional dependencies, and I'm still hoping to avoid that as much as possible.
Alp_ has joined #ocaml
<palomer> additional dependencies = too much hassle
Alp has quit [Read error: 54 (Connection reset by peer)]
<thelema> my plan for ocaml domination involves others adding dependency on batteries.
<palomer> muhahahahaha
* palomer thinks someone should make a quick tutorial on creating debs for ocaml libraries
* palomer looks at thelema
<mrvn> take other library, rename project, replace source files, build
<mrvn> someone could write a dh-make-ocaml though.
<palomer> so you're saying I can use the diff in the source deb for any project?
<palomer> someone should make a cononical diff for a standard ocamlfind project then:O
<thelema> palomer: I've never created a deb in my life
<julm> palomer: apt-src install a deb and copy :>
<palomer> hrmph, ok, ill give it another shot
* palomer runs into the value restriction
<palomer> I've run into every restriction possible!
* palomer is off to celebrate the new year
<julm> Happy GNU year :)
thrasibule has joined #ocaml
ttamttam has quit ["Leaving."]
thrasibule has quit [Remote closed the connection]
thrasibule has joined #ocaml