gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
<thelema_> flux: if you want a more easily parsable 'available package' list, just request http://oasis.ocamlcore.org/dev/odb/stable/pkg/info/00list directly
<Drakken> thelema_ there are two problems. The first is that the function specifically operates on options,
<Drakken> but "filter" and "map" don't indicate that.
<thelema_> yes, the length of the output when we get more packages in oasis-db was the reason for using space instead of \n. I guess I could use \t or more complex formatting in columns like ls
<thelema_> Drakken: ?? all the filter_map functions are ('a -> 'b option) -> 'a <foo> -> 'b <foo>
<thelema_> whether <foo> is map or list or set or enum or queue or whatever
<Drakken> thelema_ I didn't say anything about 'a and 'b
<thelema_> this is just the standard way this function works; how would you describe ('a -> (bool * 'b))?
<thelema_> for map, you need ('a -> 'b), for filter, you need ('a -> bool), filter_map is both - ('a -> (bool * 'b))
<Drakken> I would write a function called "somes" that does the filtering, and just use map for mapping.
<thelema_> and filter map does both in a single step
<thelema_> so you can combine the logic for filtering and mapping and not examine the value twice
<Drakken> maybe if it were in an Option module it would be more obvious.
<thelema_> This is a different conversation, and I kind of agree that the Enum functions shouldn't be in the pervasives namespace
<thelema_> but removing them will break more code than it's worth
<thelema_> (including a bunch of my own code)
<thelema_> There's not just one filter_map function, there's a different one for every data structure that's filterable and mappable
<thelema_> so it definitely doesn't belong in option.
<Drakken> and you said they're all specific to mapping and filtering options, but neither the module name nor the function name indicates that.
<thelema_> filter_map doesn't take in ('a option list), nor return ('b option list)
<thelema_> it uses option to concisely represent the two possible outcomes of filtering and mapping: Some x or None
<Drakken> thelema_ maybe there's some theoretical basis for it that I don't understand.
<Drakken> Judging only from the name, and not being a CS guru, I would expect the signature to be more like ('a -> 'b) -> ('b -> bool) -> 'a t -> 'b t
osa1 has quit [Quit: Konversation terminated!]
<Drakken> I don't understand how mapping to options is more special or significant than other kinds of mappings.
<Drakken> oops. I meant to say earlier "I didn't say anything about t"
<Drakken> <foo>
<thelema_> ('a -> 'b) + ('a -> bool) = ('a -> 'b option)
<dsheets> None of 'b?
<Drakken> dsheets the type of None is 'b option, for any 'b.
<Drakken> thelema_ you mean 'b -> bool ?
<dsheets> isn't the type function corresponding to bool, Either (Left 'b or Right 'b)? With Maybe you lose information in the false branch?
<dsheets> ('a -> 'b) * ('a -> bool) = ('a -> ('b * bool))
<Drakken> well, maybe I was wrong. So the point is that the option is the obvious way to combine the two functions together.
<Drakken> dsheets but the purpose of the bool is to filter out 'b values, so I guess wrapping the 'b in an option is just as good.
<dsheets> Drakken: that makes sense
<Drakken> now that thelema has explained it :)
<Drakken> dsheets would you like a programming exercise to work on?
<dsheets> Drakken: ?
<Drakken> I was thinking about how to define the function that filter_map takes in terms of the two functions I thought it should take.
<Drakken> It's not very hard. Just a one-liner.
avsm has quit [Quit: Leaving.]
<Drakken> Maybe it's too boring. Maybe I should find something more useful to do.
madroach has quit [Ping timeout: 265 seconds]
madroach has joined #ocaml
K_F has quit [Ping timeout: 240 seconds]
iago has quit [Quit: Leaving]
K_F has joined #ocaml
sepp2k has quit [Remote host closed the connection]
Mnabil has quit [Ping timeout: 245 seconds]
patronus has joined #ocaml
patronus_ has quit [Ping timeout: 245 seconds]
rwmjones has quit [Ping timeout: 268 seconds]
rwmjones has joined #ocaml
ousado_ has joined #ocaml
adrien_o1w has joined #ocaml
milosn_ has joined #ocaml
ousado has quit [Read error: Connection reset by peer]
rwmjones has quit [Ping timeout: 268 seconds]
milosn has quit [Ping timeout: 268 seconds]
rwmjones has joined #ocaml
adrien_oww has quit [*.net *.split]
yezariaely has quit [*.net *.split]
mal`` has quit [*.net *.split]
yezariaely has joined #ocaml
mal`` has joined #ocaml
emmanuelux has quit [Ping timeout: 268 seconds]
ankit9 has joined #ocaml
funeral has joined #ocaml
funeral has quit [Client Quit]
thelema has joined #ocaml
patronus_ has joined #ocaml
thelema_ has quit [Read error: Connection reset by peer]
patronus has quit [Ping timeout: 260 seconds]
sgnb` is now known as sgnb
<flux> drakken, well, a two-function filter_map would seem pretty useless to me. have you actually found use for that?-o
<flux> some example uses of filter_map from my code: let intersections = BatList.filter_map (intersect_u_float x) bounds in ..
<flux> BatList.filter_map (fun (z_offset, aos) -> match BatList.Exceptionless.find (similar_angle_offset base_angle) aos with | None -> None | Some (_, offset) -> Some (z_offset, offset)) data <- yeah, I suppose this could be done better
<flux> let offsets = Array.of_list (BatList.filter_map (fun (angle', offset) -> if similar_angle angle angle' then Some offset else None) aos) in ..
pango is now known as pangoafk
patronus_ has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
alexey has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ftrvxmtrx has quit [Ping timeout: 244 seconds]
<cacho> parsing parsers is awesome
<cacho> kidding, is sick
madroach has quit [Ping timeout: 265 seconds]
jave has quit [Read error: No route to host]
jave has joined #ocaml
eni has joined #ocaml
hkBst has joined #ocaml
Yoric has joined #ocaml
beckerb has joined #ocaml
thomasga has joined #ocaml
mika1 has joined #ocaml
cago has joined #ocaml
eikke has joined #ocaml
jave has quit [Read error: Connection reset by peer]
fpz has quit [Ping timeout: 248 seconds]
jave_ has joined #ocaml
fpz_ has joined #ocaml
madroach has joined #ocaml
ftrvxmtrx has joined #ocaml
eni has quit [Ping timeout: 265 seconds]
<fasta_> Why doesn't fetching utop work? http://paste.lisp.org/+2T4G
<flux> fasta_, maybe darcs requires some argument to accept that certificate
<flux> fasta_, btw, works with plain http
<fasta_> flux: darcs is just user unfriendly then.
<fasta_> flux: thanks
<flux> if there is a switch to accept that certificate, I don't know what it is
<fasta_> Can anyone explain why hacks such as odb and godi are preferred over Nix packages?
<flux> I don't know really what Nix are, but godi might predate Nix
<fasta_> Nix already has 20 or so OCaml packages and they are much more solid in their dependency specification.
<flux> and odb can leverage (?) ocamlfind, which I doubt Nix can
<adrien> simple: I don't run nix
<flux> I don't anymore really make use of godi except perhaps in rare circumstances, because it requires its own ocaml compiler
<fasta_> adrien: you don't have to run the OS.
<adrien> ok, second thing: I fucking hate dependency tracking in packages =)
<fasta_> adrien: you can install it on any Linux distribution.
<adrien> and I'm not going to add anotherpackage manager for my /
<flux> fasta_, well, sounds like an argument for godi, because it too has dependency specifications and it has much more than 20 packages
<adrien> (ocaml packags don't relocate)
<fasta_> flux: but godi depends in a million ways on 'the environment'.
patronus has joined #ocaml
<fasta_> flux: and you cannot depend on C libraries.
<fasta_> flux: Nix is the result of about 10+ man years of work.
<fasta_> flux: and the outcome of a PhD project.
<flux> fasta_, how does Nix depend on C libraries?
<flux> can I use it in Solaris with libraries wherever and expect it to work?
<fasta_> flux: you just define a function which takes as input (libffi,libblah) for example.
<fasta_> flux: I think so.
<fasta_> flux: there is at least someone using it on Solaris.
<fasta_> flux: the way I see it is that the OCaml, Haskell, Ruby, etc. communities are just using the wrong tool for the job.
<fasta_> flux: it's a massive waste of time.
<fasta_> flux: same for Debian and Gentoo packages, basically.
<fasta_> Nix is technically simply more flexible than any other existing package system.
<fasta_> flux: and you can install multiple versions of OCaml easily side by side.
<fasta_> flux: so, you don't need no stinking 'ocamlbrew'.
<flux> I suppose I should look it up, but I seriously doubt Nix will help me set up a new Ocaml environment on Rpi more easily than ocamlbrew
<fasta_> flux: the pattern is basically that for every individual task some programmer has implemented a 'hack for language X' which doesn't always work, has bad error messages, is slow, etc., while a good generic solution is already available.
<fasta_> flux: Rpi?
<flux> raspberry pi
<flux> I agree that much of software wouldn't exist if the developers just knew about existing alternatives
<flux> however, another reason is that the existing solutions are either not flexible enough or are _not documented properly_.
<flux> maybe Nix is better.
<fasta_> flux: running NixOS on Rpi is a topic people talk about and cross-compilation is also something people have done.
<fasta_> flux: but I don't recommend it for the Rpi at this point.
<fasta_> flux: it's just a C++ program which is fairly well written.
<fasta_> flux: Nix is documented godo enough, because there are thousands of package specifications, papers and mailing list questions by actual users over a period of years.
<fasta_> good*
<fasta_> Is there some recent paper on how Ocaml4.00.0 works?
<fasta_> "Moreover, the memory manager is incremental: it runs in parallel with the application, so that garbage collection does not cause noticeable delays."
<fasta_> These French guys are funny.
<fasta_> It's concurrent, not parallel, right?
<flux> I don't know what that could even mean.
<flux> in reality that is
<companion_cube> fasta_: parallel GC and concurrent GC have different meanings, afaik
Yoric has quit [Ping timeout: 252 seconds]
Yoric has joined #ocaml
<Ptival> fasta_: indeed the wording may be poor
<Ptival> if "it runs in parallel with the application", then it's concurrent
<Ptival> parallel would mean "it runs in parallel with itself" I believe
<Ptival> that is, the algorithm itself can be dispatched on multiple cores, but this might be while the world is stopped (so, not concurrent with the application)
ocp has joined #ocaml
<flux> I don't think, though, that any kind of concurrency or parallellism is occurring in ocaml gc?
Kakadu has joined #ocaml
<Ptival> flux: I don't know :\
<Ptival> not sure what that sentence means
garrigue has joined #ocaml
<garrigue> Trying access using camlirc
<garrigue> Test succeeded
<garrigue> bye
garrigue has left #ocaml []
<Ptival> meh
<Ptival> pretty sure Jacques could have answered :)
<adrien> hahaha
<Ptival> I will be able to tell the answer in about 2 hours I believe ;)
<Ptival> (if someone doesn't have a faster way of finding it)
<adrien> I think the GC is not done in parallel even when the worl dis stopped because it would make mono-threaded applications quite a lot slower
<adrien> and most of the time there is no need for speed in the GC
<adrien> many GC runs are very short
<adrien> anyone know the state of the "mediawiki" plugin in the ocaml forge?
<flux> gc is typically pretty fast, but then there are single-threaded apps that take 50% in GC
<flux> although the default are a bit more modern these days I think, so perhaps such situations are rare
Yoric has quit [Ping timeout: 246 seconds]
Yoric has joined #ocaml
Mnabil has joined #ocaml
ankit9 has quit [Ping timeout: 246 seconds]
<Ptival> thizanne had a run with 80% GC or something I believe :)
<Ptival> but it was not a real-world example, just benchmarking a data structure
ankit9 has joined #ocaml
<nicoo> adrien: Actually, concurrent GC isn't necessarily much slower; I'm currently toying around with a concurrent GC algo., but no working prototype yet ;)
thomasga has quit [Ping timeout: 246 seconds]
<adrien> nicoo: not much slower but 10% would already be quite a lot ;-)
Yoric has quit [Ping timeout: 260 seconds]
mfp has quit [Read error: Connection reset by peer]
josch has joined #ocaml
<josch> hi, how would i get an in_channel from a string? I dont want to create a file but have the contents in memory and pass it to a function that expects an in_channel (ocamllex).
mfp has joined #ocaml
<flux> josch, sadly you don't. ocamllex can however use some other object objects, however?
<flux> s/however // :-)
<josch> hmm... my mentor suggested to get a channel from a string using the IO module of extlib - though i dont see any function providing that functionality
<josch> though, yes there is Lexing.from_string...
<josch> oh great - I think problem is solved
<josch> there was just a confusion between Pervasives.in_channel and IO.input
ousado_ is now known as ousado
ousado has quit [Changing host]
ousado has joined #ocaml
paolooo has joined #ocaml
paolooo has quit [Client Quit]
paolooo has joined #ocaml
<fasta_> Ptival: I had real-world code which spent 90% in GC, albeit in Haskell.
<fasta_> Ptival: GC is slow when you are running near memory limits.
<fasta_> (and where generational GC has absolutely no use)
<fasta_> Lots of applications don't have that property.
ankit9 has quit [Quit: Leaving]
eni has joined #ocaml
eikke has quit [Ping timeout: 244 seconds]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 246 seconds]
eikke has joined #ocaml
jamii has quit [Ping timeout: 246 seconds]
cdidd has quit [Ping timeout: 272 seconds]
<Ptival> fasta_, flux : ok, so what was meant was "it runs interleaved with" rather than "in parallel", will be fixed soon
<fasta_> Ptival: great (I knew what it was supposed to say)
sepp2k has joined #ocaml
eikke has quit [Ping timeout: 240 seconds]
eikke has joined #ocaml
<paolooo> hi @all, is there any nice tutorial for ocaml?
Progster has joined #ocaml
Yoric has joined #ocaml
cacho has quit [Ping timeout: 252 seconds]
cacho has joined #ocaml
smondet has joined #ocaml
<hcarty> paolooo: There are a few. The first chapter of the official manual provides a nice introduction. Jason Hickey's book is useful as well: www.cs.caltech.edu/courses/cs134/cs134b/book.pdf
<paolooo> hcarty: Thanks
<hcarty> paolooo: You're welcome. For a quick overview, this page is nice as well - http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html
<hcarty> paolooo: Those should at least help you get started :-)
<paolooo> hcarty: Thank you :)
eni has quit [Ping timeout: 244 seconds]
<paolooo> hcarty: have you created an application from ocaml?
<hcarty> paolooo: Yes, several
<paolooo> hcarty: awesome... can you show me one? :)
<hcarty> paolooo: I have some libraries publicly released. Most of the applications I've written are internal, for my job.
<hcarty> thelema: I agree regarding |?
<paolooo> hcarty: ah I see... why did you use OCaml instead of other languages like C or Java?
<hcarty> thelema: I'll leave it alone and address |? again when -ppx is available and supported/stable.
<hcarty> paolooo: Safety (vs C and somewhat Java), speed, expressiveness
<hcarty> I was primarily using Perl and C before OCaml. I still use both Perl and C a fair amount, but these days OCaml tends to be what I reach for first.
<companion_cube> paolooo: ocaml is fast enough, and can make the programmer much more productive than, say, C
<hcarty> companion_cube: Well said
<paolooo> hcarty: companion_cube I see... what about ruby vs Ocaml? Ruby is really popular nowadays. Why is it OCaml isn't popular as other language?
<hcarty> Type inference in a language with static types has spoiled me vs languages like Ruby/Python/Perl.
<companion_cube> paolooo: ruby isn't typesafe nor fast
<companion_cube> but granted, it's more popular because many people don't like functional programming
<hcarty> paolooo: Marketing and to a lesser extent perceived ease of getting something out quickly
<hcarty> While it's getting better slowly, OCaml doesn't have the friendly outward face that any of Perl/Ruby/Python have.
<paolooo> hcarty: I see. Thanks for the nice info.
<paolooo> hcarty: companion_cube: I just found this one. I think this is a good start as well : http://try.ocamlpro.com/
<hcarty> paolooo: Ah yes, sorry! I should have pointed that one out too :-)
<hcarty> It's a wonderful tool for experimenting and the lessons are helpful too.
<paolooo> hcarty: yeah :) thanks.
cago has quit [Quit: Leaving.]
cago has joined #ocaml
cago has quit [Client Quit]
Kakadu has quit [Quit: Page closed]
<Drakken> hcarty I take back everything I said yesterday about filter_map.
<Drakken> thelema explained how it works, and it makes sense to me now.
mika1 has quit [Quit: Leaving.]
eikke has quit [Ping timeout: 245 seconds]
eikke has joined #ocaml
eikke has quit [Ping timeout: 252 seconds]
eikke has joined #ocaml
iratsu has joined #ocaml
Anarchos has joined #ocaml
hkBst has quit [Quit: Konversation terminated!]
eni has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<jonafan> ocaml suffers a lot from a lack of centralized authority
<jonafan> perl/ruby/python have better built in libraries and defacto ways to install more stuff
<jonafan> ocaml has a pretty abysmal standard library and no consensus on anything
<companion_cube> there is Batteries, though
<flux> Batteries and OcamlNet cover a whole lot of things.
<jonafan> there is no consensus that batteries is a standard though
<jonafan> and batteries is kind of a pain to get if you don't use godi, right?
<flux> I don't think so.. basically compile and go?
<jonafan> i guess the situation has improved since i started using godi
iratsu has quit [Remote host closed the connection]
Mnabil has quit [Read error: Operation timed out]
<hcarty> Drakken: Very cool.
iratsu has joined #ocaml
<hcarty> jonafan: odb.ml makes installing Batteries quite simple, under GODI or otherwise. Between odb/oasis-db and opam we are gradually winding toward something we can point to and say, "Here. All OCaml things should be placed here by developers and installable from here by users"
<hcarty> We aren't done yet, but odb provided a simple and usable tool that was sorely missed up to its release.
eikke has quit [Ping timeout: 245 seconds]
ftrvxmtrx has quit [Quit: Leaving]
<jonafan> well, i hope people use it
avsm has joined #ocaml
<hcarty> Some do. thelema's work on odb got something usable in place; gildor added oasis-db support on the server side; ocamlbrew shows that you can go from no OCaml to OCaml + a basic suite of libraries without a lot of fuss
pangoafk is now known as pango
sepp2k has quit [Read error: Connection reset by peer]
Mnabil has joined #ocaml
sepp2k has joined #ocaml
Yoric has quit [Ping timeout: 256 seconds]
ocp has left #ocaml []
Mnabil has quit [Ping timeout: 240 seconds]
<flux> mfp, are you still using ocamlmq?
ftrvxmtrx has joined #ocaml
paolooo has quit [Ping timeout: 245 seconds]
Anarchos has joined #ocaml
<flux> maybe not, the stomp client library from 2009 seems not to be quite up-to-date
<flux> ah, very little change was required: open_in and open_out in mq_concurrency.ml needed type in_channel/out_channel t
<flux> ..but then there is no META-file
Mnabil has joined #ocaml
Mnabil has quit [Ping timeout: 244 seconds]
eikke has joined #ocaml
<flux> gaah, I just had not updated my repository for two years :-)
<flux> mfp, how much of a fan of batteries are you? I have a version that uses it instead of ExtLib in ocaml-stomp
eikke has quit [Ping timeout: 240 seconds]
eni has quit [Ping timeout: 248 seconds]
cdidd has joined #ocaml
beckerb has quit [Ping timeout: 245 seconds]
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
Yoric has joined #ocaml
ocp has joined #ocaml
Yoric has quit [Ping timeout: 248 seconds]
Yoric has joined #ocaml
Yoric1 has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
ocp has quit [Read error: Operation timed out]
avsm has quit [Quit: Leaving.]
_andre has quit [Quit: leaving]
<flux> mfp, also, do you know what's the point of transactions in STOMP?-) to me they seem utterly useless, but there must be a reason why they exist..
Yoric1 has quit [Ping timeout: 256 seconds]
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
<mfp> flux: regarding the use of extlib in ocaml-stomp > there's one reason not to change to batteries until 2.0 is released: the dep on camomile (which forces you to redistribute its data files AFAIK)
Yoric has joined #ocaml
<mfp> flux: as for transactions in STOMP, I never implemented them, because I found the specs ambiguous at the time
osa1 has joined #ocaml
<mfp> I guess they could be of use if e.g. you wanted to move things from one queue to another transactionally (but there were some limitations in how transactions work I've forgotten since that might even make them useless for that?)
<mfp> hmm all I can find is http://docs.codehaus.org/display/STOMP/Transaction+Handling which is far from specifying anything with much detail; I believe I read somewhere long ago that ACKs in ABORTed transactions wouldn't cause messages to be redelibered (i.e., couldn't be used as NACK) and that there were some other limitations I've forgotten
ocp has joined #ocaml
skeq has joined #ocaml
Yoric has quit [Ping timeout: 240 seconds]
ocp has quit [Ping timeout: 246 seconds]
skeq has left #ocaml []
avsm has joined #ocaml
Progster has quit [Ping timeout: 240 seconds]
smondet has quit [Quit: leaving]
Progster has joined #ocaml
Progster has quit [Ping timeout: 244 seconds]
bzzbzz has quit [Read error: Connection reset by peer]
bzzbzz has joined #ocaml
eikke has joined #ocaml
eikke has quit [Ping timeout: 252 seconds]
emmanuelux has joined #ocaml
emmanuelux has quit [Read error: Connection reset by peer]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
emmanuelux has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
emmanuelux has joined #ocaml
emmanuelux has quit [Read error: Connection reset by peer]
emmanuelux has joined #ocaml