2009-10-15

<hcarty> Wow... Lwt 2.0.0 provides a toplevel with line editing and no ledit or rlwrap required.

2009-10-14

<hcarty> thelema_: I hope that happens too. There are some very good ideas for restructuring Batteries on the list. I hope to be able to contribute to that effort soon.
<Camarade_Tux> hcarty: I haven't changed anything, but I think I have one other package that is non-godi and has no problem, so pretty weird (and I haven't spent much time on that)
<hcarty> My hope is still for success on the monolithic Batteries front though. I think that its improvements to OCaml are very important.
<hcarty> thelema_: I'm happy to test it out, though it will likely be a few days before I get a chance.
<hcarty> thelema: Does it work alongside Batteries?
<hcarty> Camarade_Tux: I use lots of non-GODI libraries with GODI, including React, and I haven't had any trouble with ocamlfind looking in the right place. Is it possible something got mixed up in the installation?

2009-10-12

<hcarty> IIRC, this is one of the ambiguities the revised syntax is/was meant to address.
<hcarty> It seems to work for the "else" portion as well.
<hcarty> thelema: That is rather strange.

2009-10-09

<hcarty> flux: CIL has an ugly build system from what I remember. It seemed very fragile.
<hcarty> mfp: Frontc perhaps... I think that builds on top of CIL but I'm not sure.
<mfp> hcarty: 2 more, one which is in GODI (don't remember the name) and Yacfe
<Camarade_Tux> hcarty: not really, it's pretty hard to use
<hcarty> CIL, Frama-C and I think at least one other.
<hcarty> CIL seems like it would be a good base for a FFI generator. But I thought the same about Frama-C and was told otherwise by folks who know more about this than me.
<Camarade_Tux> hcarty: he, simple types, you're lucky :)
<hcarty> Camarade_Tux: So it works well for this particular library. I've used it for HDF4 as well, and it was helpful there but I had to manually wrap more since it uses a lot of void*
<hcarty> Camarade_Tux: Almost everything in PLplot is one of : string, int, double or a pointer to one of these
<hcarty> flux: Much better than not having camlidl
<Camarade_Tux> hcarty: I've tried camlidl and I think there were some types it didn't play nicely with
<hcarty> flux: Ack... small keyboard! I've been happy with it overall.
<hcarty> flux: No, I
<flux> hcarty, and that's not that big a complaint IMO
<hcarty> Camarade_Tux: I don't think it handles (void *) very well
<hcarty> flux: My biggest complaint at this point is that it imposes an extra compile-time requirement
<Camarade_Tux> hcarty: aren't there some cases you can't use it?
<hcarty> flux: And it's easy enough to wrap the problem functions by hand
<hcarty> flux: It saves me a huge amount of time
<Camarade_Tux> hcarty: yeah, I've been there too ;)
<flux> hcarty, so you use camlidl for plplot? how was that?
<hcarty> Camarade_Tux: You should see the evil code used to prep the PLplot headers for consumption by camlidl - handling things like two-word types makes for some ugly regexps.
<hcarty> Though it can be forced
<hcarty> typing
<hcarty> No, no strong tying
<hcarty> mfp: It's superficially similar to Haskell, but from my limited experience it seems equidistant from both Haskell or OCaml
<hcarty> mfp: It's based on... I think term rewriting is the name
<mfp> hcarty: pure is like a simplified Haskell with a diff evaluation discipline and macros?
<hcarty> Although they "cheat" and let LLVM do the work.
<orbitz> hcarty: same, i prefer to explitily be able to ignore an error via a | _ -> then to not know that i am wtih an exception
<hcarty> orbitz: It brought me around to making my code "exceptionless" and I've been quite happy with the results
<orbitz> hcarty: cool
<hcarty> orbitz: All or almost all of the modules in Batteries have an "Exceptionless" sub-module which can be used to remove non-fatal exceptions from the module
<hcarty> I do not know how well it works for huge libraries with complex C-types though.
<hcarty> 've seen
<hcarty> The Pure FFI is one of the simplest I
<hcarty> Pure lets you call C directly from an interpreter session
<flux> hcarty, but when you hit the wall, you hit the wall hard
<hcarty> For (simple) C, camlidl produces fairly nice results.

2009-10-08

<hcarty> I have found the back traces in OCaml to be very useful.
<hcarty> I haven't used it
<hcarty> http://skydeck.com/blog/programming/more-stack-traces-in-ocaml -- this talks about the patch if you're interested
<hcarty> It certainly is
<hcarty> dodek_: You may be able to catch the exception and print the backtrace, but I don't think that would work here. Recent OCaml versions added support from printing backtraces from within a running OCaml program but I haven't used that functionality.
<hcarty> dodek_: There is a patch to enable this though.
<hcarty> dodek_: As far as I know, it's not possible. The toplevel does not produce debug symbols.
<hcarty> It's a very nice stdlib supplement/replacement
<hcarty> Whistles that is.
<hcarty> Now with Bells _and_ Whistes.
<hcarty> A super-duper library for OCaml
<hcarty> dodek_: Batteries has ( -- )
<hcarty> dodek_: I ran up against this recently. And the error message isn't very helpful when you don't understand the float * float vs (float * float) distinction.
<dodek_> hcarty: that's interesting
<hcarty> dodek_: "type t = A of (int * int) match A (1, 2) with A x -> ..." will work
<hcarty> dodek_: "type t = A of int * int match A (1, 2) with A x -> ..." won't work
<hcarty> dodek_: It matters when pattern matching
<hcarty> palomer: The LTU example I linked uses FRP for input
<hcarty> palomer: I used it, for example, to tie a slider to a map (Cairo canvas drawn with PLplot). The slider affects how the map zooms in and out.
<palomer> hcarty, so let's say a widget changes size, then the whole widget structure needs to be updated, right?
<hcarty> A second to kaustuv_'s recommendation. That's an excellent book.
<hcarty> palomer: Both. I've used it for propagating signals between widgets, which then determine the size/zoom/etc.
<palomer> hcarty, but in which aspect? signals? deciding the size of the widgets?
<hcarty> Camarade_Tux: Thought it would likely be a _better_ thing if some support modules were involved to make everyone play nicely together :-)
<hcarty> Camarade_Tux: For a project which requires/benefits from webkit, dbus, gtk, threading and FRP it probably is a good thing.
<hcarty> palomer: I'm not deep enough in to the library/libraries or the theory behind them to give a better response yet.
<hcarty> palomer: Making the code cleaner and easier to follow? I'm not sure how else to say it.
<hcarty> In my specific experience, of course.
<hcarty> palomer: I think the results of stringing multiple GUI elements together with FRP is cleaner than without.
<hcarty> palomer: Yes, I've found it to be very useful in GUIs in particular. I haven't had a need for it elsewhere.
<hcarty> palomer: Chris King did some very interesting work.
<hcarty> palomer: Which one? I agree on both :-)
<hcarty> The LTU one uses some camlp4 magic, but it's pretty cool even without it.
<palomer> hcarty, that's pretty cool
<hcarty> And this is what sparked my interest in the first place: http://lambda-the-ultimate.org/node/1918
<hcarty> rwmjones: This is the simplest example I found useful when trying to figure out how to use/apply FRP: http://codepad.org/SXfjuBjx
<hcarty> rwmjones: the React module is expected to be open'd here
<hcarty> rwmjones: It's an example, but not the cleanest - http://0ok.org/cgit/cgit.cgi/gtk-light/tree/toplevel.ml
<rwmjones> hcarty, do you have any example code using react / lablgtk etc?
<hcarty> Is readline the hip new thing in OCaml-land?? :-)
<Camarade_Tux> hcarty: check your inbox ;)
<hcarty> Camarade_Tux: core? Jane St. core?
<hcarty> I'm sure I'm not using the terminology correctly as my experience with FRP is entirely as a user and not a theorist.
<hcarty> So any call to "x ()" may set off a chain of other events, which result in the proper value of x being returned
<hcarty> But there is more magic going on ... 1 is mutable or somesuch.
<hcarty> My (very) limited understanding is that it's kind of like hiding a variable in a function ... "let x () = 1" rather than "let x = 1"
<hcarty> rwmjones: You can do this without FRP/React, but I've found the FRP approach to be cleaner
<hcarty> rwmjones: It's useful for sending signals between widgets, so that, for example, the slider can tell the text box and the Cairo widgets to update based on its value
<hcarty> rwmjones: A plot output window which would automatically adjust based on signals from other inputs (mouse clicks, resize the window, etc)
<hcarty> rwmjones: My most recent use was for glorified mutability
<hcarty> After being inspired by the FrGui project from Jane St's 2007 projects.
<rwmjones> hcarty how?
<Camarade_Tux> hcarty: thanks, I hadn't really looked at lwt before and it looks really nice :)
<hcarty> lablgtk2 that is
<hcarty> rwmjones: I've used React a bit with Gtk
<hcarty> And here for a short example: http://ocsigen.org/darcsweb/?r=lwt;a=headblob;f=/examples/ex_gtk.ml
<hcarty> See the Changelog on the right for 2.0.0
<hcarty> Camarade_Tux: :-) http://ocsigen.org/lwt/install
<hcarty> Parallel processing pieces, toplevel updates, Glib/Gtk integration. I'm impressed.
<hcarty> The (somewhat) new release candidate for Lwt looks very interesting

2009-10-06

<Alpounet> hcarty, heh
<hcarty> Too many degrees with too many egos attached :-)
<Alpounet> hcarty, it's not really animosity, but people are never nice with eachother :p
<hcarty> I haven't noticed any animosity on the list recently, but I haven't been following it very closely.
<hcarty> Alpounet: Which thread?

2009-10-04

<hcarty> Night
<hcarty> I've definitely hit some segfaults when working in OCaml, but they have all been due to issues with C.
<hcarty> Thirded. Whichever is appropriate.
<hcarty> Seconded!
<hcarty> And a fantastic rename.
<hcarty> flux: That seems to be quite a nice description
<flux> hcarty, I think Obj.magic is more likely "do what I think I mean, and if I don't know what I mean, crash in surprising and spectacular ways"
<flux> hcarty, yes.. indeed Obj.magic can sometimes fit the "do what I mean"-bill. but. not always..
<hcarty> flux: So the stigma associated with Obj.magic is a conspiracy.
<hcarty> It's unit -> 'a at least...
<hcarty> let f () = failwith "dwim";;
<hcarty> Alpounet: That's something to look forward to with the combo of OCaml 4.0.0 and PLplot 6.0.0 :-)
<Alpounet> hcarty, can't it just guess what we want to plot ?
<hcarty> Camarade_Tux: You would have to do the work to get xs0 and ys0 as float arrays, of course.
<hcarty> Camarade_Tux: This is a day or several late, but (Quick_plot.lines [(xs0, ys0); (xs1, ys1); ...];) would give you a plot of xsN vs ysN using OCaml + PLplot :-)

2009-10-03

<Alpounet> hcarty needed testers, I volunteered.
<flux> camarade_tux, did you look at hcarty's plplot bindings?

2009-10-01

<hcarty> I'm hoping to get Gtk_light to the point where it is useful for small projects. It will have to wait until I need it though, which will likely be a few weeks or months from now.
<hcarty> I'm quite content with lablgtk though
<hcarty> Camarade_Tux: Yes, there seems to be some activity now and then with that project. Hopefully it will see eventually be reasonably complete and see a proper release.
<hcarty> No maintained Qt or wx bindings though.
<hcarty> lablgtk2 provides fairly complete access to Gtk+ 2
<hcarty> Yaron Minsky, one of the Jane St. folks, called OCaml comically unpopular in one of his talks. Or something close to that.
<hcarty> But it is used outside of France. I know there are at users in the US and Japan (Jane St. operates in both locations IIRC, and there are other folks who are not Jane St. related)
<hcarty> It is probably most common in France
<hcarty> albacker: And I use it for satellite data analysis - so it's not just limited to CS purposes :-)
<hcarty> albacker: Jane St. does a lot of very much not-compiler-related programming in OCaml
<hcarty> Not as dead-simple as something like Pure, but as or more simple as most other languages I've used.
<hcarty> If/when an extra boost from C is needed for speed or otherwise, the OCaml C FFI is thankfully rather simple to work with.
<hcarty> kaustuv: Seconded, though it something I didn't do for a long time.
<hcarty> If the | is lined up with the "m" in match, then a leading | may make the code easier to read
<hcarty> derdon: Both forms seem to be used quite frequently in the code I've read
<hcarty> gildor: If I find some good information on setting up an IRC logger I will pass it along.
<gildor> hcarty: this can help other in the future
<hcarty> gildor: had... ack, I can't type on this
<hcarty> gildor: It's not a big issue either way. I has asked about getting help packaging PLplot's OCaml portion for Debian.
<hcarty> Sorry .. new keyboard and I keep mistyping
<hcarty> gildor: It
<gildor> hcarty: tell me how to setup a irc logger (package on debian stable) and i'll do that for you
<hcarty> Alpounet: Thanks, will do
<hcarty> orbitz: Very true :-) I just don't connect over there that often
<Alpounet> hcarty: ask gildor or zach then
<hcarty> 've lost the history
<hcarty> I asked a question there and while I was away my session died, so I
<hcarty> Are there logs for #debian-ocaml @ irc.debian.org?
<hcarty> BigJ2: The precise way to implement it depends on what you want from your function(s)
<hcarty> Or what orbitz said :-)
<hcarty> BigJ2: Or "let s = direction (1.0, 0.0) in print_endline s"
<hcarty> BigJ2: "print_endline (direction (1.0, 0.0))"
<hcarty> orbitz: Yes, thanks
<hcarty> BigJ2: Just print the value returned - something like "print_endline (display (1.0, 0.0))"

2009-09-30

<hcarty> BigJ2: Where do you define the function "direction"?
<BigJ2> hcarty: I think I figured out pattern matching but I can't figure out how to print the return value I am guessing I need to store it in a variable?
<hcarty> BigJ2: Someone else may be able to help if you have a question
<Alpounet> Good night and cheers hcarty
<hcarty> Thanks again for the testing
<hcarty> Good night
<hcarty> Oh no - that's quite unfortunate.
<hcarty> My apologies!
<hcarty> Alpounet: Ah, of course :-)
<hcarty> I remember rwmjones had xavierbot
<hcarty> Alpounet: Indeed - who was working on that?
<Alpounet> hcarty, good luck, doesn't look like an easy task !
<hcarty> Alpounet: http://plplot.sf.net is the one to track long-term. I'm hoping to find a way to include the ocamldoc-generated documentation in the general PLplot documentation build process.
<hcarty> Alpounet: You're quite welcome, and thank you as well. You got mention in the commit message with the spelling error fixes :-)
<Alpounet> hcarty, this is a bit late for tonight, but I should play a bit with it. It could be fun actually, for my articles/college reports/etc
<hcarty> Alpounet: (not that you have to read it! Just in case you have an interest in the library beyond testing :-))
<hcarty> Alpounet: http://0ok.org/ocaml/plplot/doc/plplot/ -- the ocamldoc API reference
<hcarty> myst: Or use bluestorm's pa_holes or an equivalent extension -- http://bluestorm.info/camlp4/pa_holes.ml.html
<hcarty> myst: You'll need to use something like (fun x y -> y <= x)
<hcarty> It does, just not in the mode I was in.
<hcarty> No, nevermind
<hcarty> Wonderful, thanks
<hcarty> Alpounet: Interesting side note - "simlified" does not trigger vim's spell check.
<hcarty> The intro and various examples seem reasonably clear to you?
<hcarty> Alpounet: Thank you very much for the proof-read and comments
<hcarty> I'm glad I haven't pushed my doc changes upstream yet :-)
<hcarty> Alpounet: Ah, thanks!
<Alpounet> hcarty, http://0ok.org/ocaml/plplot/doc/core/ocaml_bindings.html, last paragraph : Plplot.Plot and Plplot.Quick_plot. Plplot.Plot provides a simlified naming scheme => sim*p*lified
<hcarty> I'm on 64bit. I wouldn't expect any trouble from that, but it's nice to know that there really isn't any.
<hcarty> :-)
<hcarty> Ok, thanks
<hcarty> Alpounet: Out of curiosity - are running a 32 or 64bit kernel?
<Alpounet> okay, then hcarty's way is fine
<Alpounet> or, if you're really really sure the list will have a size of 3, and that the program hasn't any sense if not, then do like hcarty tells you
<hcarty> ^^^^ that should be "Bad list!" I suppose.
<hcarty> derdon: "let (a, b, c) = match l with | [a;b;c] -> (a, b, c) | _ -> failwith "Bad array!""
<hcarty> Alpounet: http://0ok.org/ocaml/plplot/doc/core/ocaml.html -- the HTML version of the docs
<derdon> hcarty: hm, looks like bad style with this warning. is there any better "ocaml-like" way?
<hcarty> derdon: So the compiler will warn about it.
<hcarty> derdon: It's an unsafe match though because you don't account for differently-sized arrays or lists.
<hcarty> or "let [|a;b;c|] = some_array"
<hcarty> derdon: You'll get a warning, but you can do the same thing - "let [a;b;c] = some_list"
<hcarty> Alpounet: Once I have this built, would you be interested in commenting on the OCaml portion of the docs?
<hcarty> They are all function or module names, so I'm just wrapping them in known-ok formatting.
<hcarty> No, I'm working on it now
<hcarty> But only in some cases :-)
<hcarty> So "some_example" comes out as "some example" in the PDF output.
<hcarty> Interesting ... the latex output eats underscores from the PLplot documentation (docbook sources)
* hcarty does a dance in celebration
<hcarty> That's exactly what it should do :-)
<hcarty> Excellent
<hcarty> Woo-hoo!
<hcarty> Then "#require "plcairo";;" then "Plplot.plinit ();;"
<hcarty> "#use "topfind";;" first
<hcarty> Ah
<hcarty> That should pull in both the core PLplot library and the Cairo-specific interface
<hcarty> "#require "plcairo";;" from the toplevel, and then "module P = Plcairo;;" is a decent first test
<hcarty> Alpounet: I've never used org-mode - I'm generally using vim - but that link looks interesting.
<hcarty> If you didn't install it, then running the toplevel from build/bindings/ocaml/ should allow you to load "plplot.cma"
<hcarty> http://ocaml.pastebin.com/m3ebc973a -- you may need to add these to your environment, depending on where/if you installed PLplot
<hcarty> If you have time
<hcarty> The toplevel?
<hcarty> Yes, I want to the latest documentation and the ocamldoc reference online before I post to the list.
<hcarty> I have the start of a simple tutorial in the documentation
<hcarty> Just the documentation and examples for now.
<hcarty> Thank you! I think I'll post it to the list soon for a general request for testing and comments on the API.
<hcarty> All the OCaml prerequisites are there in GODI now, thankfully.
<hcarty> Yes, the GODI package will likely not be for a while:-)
<hcarty> At some point when I'm feeling adventurous I'll try to add a GODI package for PLplot.
<hcarty> I may do that, though I don't know if they'd want to add the dependency :-)
<hcarty> Thank you again for the testing. I'm happy to hear that it works somewhere other than on my system :-)
<hcarty> And it plays nicely with the toplevel, which is handy.
<hcarty> xplot01.ml and xgtk_interface.ml should be a bit better
<hcarty> The examples are not the most idiomatic OCaml. They are converted directly from the C examples, so they have a very C-like flavor.
<hcarty> Thanks. PLplot has been around for a while, at least 1992. I provided the OCaml portion (bindings, examples, etc) and have contributed other pieces to the core of the library.
<hcarty> The "closing the xcairo window crashes the plot/application" is a bug that is on the TODO list... I'm not very familiar with the internals of X.
<hcarty> Ah, that happens if you close the window rather than pressing enter or right-clicking on the plot.
<hcarty> http://plplot.sourceforge.net/examples.php gives an overview of each example
<hcarty> Isn't it though? :-)
<hcarty> And ./xgtk_interfaceocaml?
<hcarty> Excellent :-)
<hcarty> Sorry, ./x01ocaml
<hcarty> I recommend xcairo as a good output device from the menu it gives
<hcarty> Hooray! Run one ... ./x01 is a good start
<hcarty> A bunch of x*ocaml files
<hcarty> Are there binaries in build/examples/ocaml/?
<hcarty> (Partial) Victory!
<hcarty> :-)
<hcarty> Thank you very much for your time on this!
<hcarty> Can you pastebin or email me cmake.out?
<hcarty> Yes, CMake caches a lot of things and I'm not sure how to override them
<hcarty> Ok, the lablgtk2 META file needs to be edited and then everything under build/ deleted and them cmake re-run
<hcarty> No, they should be in build/examples/ocaml
<hcarty> What happened?
<hcarty> Oh - are you in build/examples/ocaml/ or examples/ocaml/ ?
<hcarty> What was your cmake commandline?
<hcarty> Does it have executables in there? Hopefully xgtk_interfaceocaml as one of them?
<hcarty> Apparently GODI adds it all in one place. I don't know if it's different for other versions of the file.
<hcarty> The lablgtk2 META file
<hcarty> Oh, remove the mentions of lablgtksourceview from the META file
<hcarty> Yeah ... it shouldn't need lablgtksourceview.cma
<hcarty> Well, it means that some of it built, apparently :-)
<hcarty> Did it find Cairo and lablgtk?
<hcarty> You'll have to clean out the build/ directory and run "cmake ...." again
<hcarty> Sorry - I thought you were asking about the PLplot config :-)
<hcarty> Oh, is this in camlidl?
<hcarty> It takes the value from `ocamlc -where`
<hcarty> OCAMLLIB should picked up automatically
<hcarty> It apparently requires manual editing of at least one of the Makefiles involved
<hcarty> camlidl doesn't have the most modern build setup, unfortunately.
<hcarty> What the current issue?
<hcarty> "make install" should take care of that though.
<hcarty> for PLplot
<hcarty> libcamlidl.a is a build-time requirement
<hcarty> Wait, that's not completely true
<hcarty> The "camlidl" binary just needs to be in your $PATH
<hcarty> Alpounet: No, not for camlidl :-)
<hcarty> If I do end up using Arch for any length of time I'll have to add camlidl and cairo-ocaml to AUR :-)
<hcarty> camlidl is a C -> OCaml binding generator, kind of like SWIG but OCaml-specific and it generates better/cleaner code than SWIG.
<hcarty> Ah, yes - sorry, I forgot that requirement
<hcarty> cmake.out should have some information on why. Can you pastebin it?
<hcarty> From the build directory, "cd examples/ocaml/"
<hcarty> Similar to ocamlbuild's _build directory.
<hcarty> Alpounet: CMake is kind of odd at first, but it does have the benefit of keeping the source tree clean.
<hcarty> Alpounet: No, src/../
<hcarty> Followed by "make" or "make -j 3" if you have a multi-core/cpu system.
<hcarty> Alpounet: http://ocaml.pastebin.com/m72c72a98 -- those are the basic steps
<hcarty> Yes, that's one of the things I'd like to address by adding META upstream :-)
<hcarty> Particularly now that it is packaged for each of the Big Three (Debian, Fedora and GODI).
<hcarty> I'm hoping to be able to give the upstream Cairo-OCaml some development love soon