<thelema>
you're good at mismatching your data types with how you use them
<palomer>
what do you mean?
<thelema>
it seems like almost all your functions have a default case that raises an exception
<thelema>
the whole idea of from_some means that somewhere you shouldn't be using an option.
<palomer>
well, err, only lookup and from_some
<kaustuv>
palomer: It seems to me that you want to do something like this: http://ocaml.pastebin.com/d5c0442d8 -- or have I missed something?
<palomer>
I don't actually use from_some (I just forgot what I named my other functions)
<thelema>
and safe_zip, although that's not as unreasonable.
<palomer>
I see what you did there!
<palomer>
yeah, I could use standard zip, but I prefer safe_zip
<palomer>
that's a no brainer!
<palomer>
kaustuv, whoa, that's wicked!!!
grirgz has joined #ocaml
<palomer>
the only problem is that cons is not a function
<thelema>
(List.map2 (fun con dat -> con dat) cons, dats)
<thelema>
now it's a function.
<thelema>
er, now it returns a function
wsmith84 has quit [Remote closed the connection]
<palomer>
nice!
<palomer>
sooo much better than my solution
* palomer
is thinking of quitting his day job
<grirgz>
hi
<palomer>
high
* palomer
has officially been shamed
<thelema>
my solution involves reversing the original list and building a series of closures that each do the right thing to the next element of the list (i.e. inlining the map2). OTOH, it wouldn't be quite as clear as kaustuv's
<kaustuv>
I thought of doing it via a fold, but I think closure creation overhead would kill there. In my version the left and right closures are allocated once and for all at module init
<kaustuv>
The downside is that map is not (normally) tail-recursive, so you pay some piper
<thelema>
kaustuv: lucky for us, batteries' map *is* tail-recursive
<kaustuv>
Yes, but it uses magic in a way that confuses the GC, which is not used to lists growing at the tail.
hkBst has quit [Read error: 104 (Connection reset by peer)]
<thelema>
it does work the GC a little bit hard in the case that the list doesn't fit in the minor heap, as each additional cons expands the GC's list of roots
<thelema>
hmm, I thought bluestorm and I had come up with a different List.map implementation...
<thelema>
ah, there it is... not map, fold_right
<kaustuv>
if the list fits in the minor heap, the difference between TR and non-TR is a complete wash
<thelema>
hmm, even the Jane Street guys thought it best to get tail recursion through rev...
<thelema>
actually, non-TR is usually faster if the list fits in minor
vuln has joined #ocaml
<kaustuv>
There's nothing wrong with rev in my opinion. Why, I rev 7 lists before breakfast every morning!
<thelema>
it would be in Batteries main, except it needs more review.
<kaustuv>
Ow, my poor brain. I'll have to read it when I'm saner in the morning.
kate__ has quit [Connection timed out]
<thelema>
:) yes, it's quite a tangle of recursion
<palomer>
is it...faster?
Asmadeus has quit [Read error: 110 (Connection timed out)]
<thelema>
it's much easier on the GC
<thelema>
List.rev is very hard on the GC for large lists that go away quickly
<mrvn>
bjorkintosh: Blaupunkt has build a car stereo that was programmed in a functional language and they had a german university formally verify the code for correctness. So yes, GC lnaguages are used in embedded devices.
ched__ has joined #ocaml
ched_ has quit [Read error: 110 (Connection timed out)]
<palomer>
mrvn, haskell?
<mrvn>
Not sure what it was. Was years ago that I heard it.
m3ga has joined #ocaml
jeddhaberstro has joined #ocaml
olegfink has quit [Read error: 60 (Operation timed out)]
olegfink has joined #ocaml
olegfink is now known as Guest6594
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
jeddhaberstro has quit []
rogo has quit [Read error: 113 (No route to host)]
vuln has quit ["leaving"]
Guest6594 is now known as olegfink
seafood has joined #ocaml
seafood has quit []
mishok13 has quit [Read error: 110 (Connection timed out)]
AxleLonghorn2 has joined #ocaml
kate__ has joined #ocaml
AxleLonghorn2 has left #ocaml []
seafood has joined #ocaml
AxleLonghorn has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has left #ocaml []
ttamttam has joined #ocaml
ttamttam has left #ocaml []
seafood has joined #ocaml
Snark has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
kate__ has quit [Read error: 110 (Connection timed out)]
mishok13 has joined #ocaml
kate__ has joined #ocaml
ttamttam has joined #ocaml
komar_ has joined #ocaml
eut has joined #ocaml
ygrek has joined #ocaml
olegfink has quit [Remote closed the connection]
olegfink has joined #ocaml
olegfink is now known as Guest86417
jbms has joined #ocaml
<jbms>
Is there a camlp4 module for supporting the "try in" construct?
<Alpounet>
no, and that's exactly the point of the post.
<palomer>
phew!
<Alpounet>
That's an answer to people saying OCaml is dead, there aren't projects around OCaml
itewsh has joined #ocaml
ttamttam has left #ocaml []
kate__ has quit [Connection timed out]
<palomer>
whew, took 3 days to rewrite this code
th5 has quit []
Spiwack has joined #ocaml
jeanb-- has joined #ocaml
kate__ has joined #ocaml
<_andre>
anyone using ocsigen.opt? it complains about a missing sqlite3.cmxs and i don't know how to build it
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
_zack has quit ["Leaving."]
OChameau has quit ["Leaving"]
<Alpounet>
is Cairo OCaml a good and efficient library for GUI ?
Yoric[DT] has joined #ocaml
kaustuv_ has joined #ocaml
<hcarty>
Alpounet: It's a nice Cairo binding
<Alpounet>
Is it handy ?
<Yoric[DT]>
hi
<hcarty>
Alpounet: What sort of GUI are you after?
<hcarty>
I've used it with lablgtk for some simple GUI testing, and for mixing lablgtk with a plotting library
<hcarty>
Yoric[DT]: Hello and congrats on surviving all the way to a Batteries beta release :-)
marmottine has joined #ocaml
<Alpounet>
hcarty, a handy GUI library, that will have to surviving to my tests and little tools programming ;-)
<Yoric[DT]>
hcarty: thanks :)
<Yoric[DT]>
Now attempting to survive a bit further.
* Yoric[DT]
has suffered from a nasty fever since Thursday morning.
<hcarty>
Alpounet: Gtk and Tk are your two main GUI options in OCaml, I think
<hcarty>
Yoric[DT]: Best of luck recovering
<Yoric[DT]>
Thanks.
<Yoric[DT]>
Commuting with fever is proving a tad tricky.
<Yoric[DT]>
Commuting *and doing politics* is proving trickier even :)
bouzu has joined #ocaml
<bouzu>
hi
<bouzu>
does exist function "random" and he return any random int ?
<Alpounet>
hcarty, that's what I think for the moment, yep.
<Alpounet>
I am waiting much from Qt OCaml
<Alpounet>
but will it be released some day ?
<Alpounet>
Nobody knows ;-)
<hcarty>
Unfortunately I don't think Qt OCaml has been updated since the last SoC ended
<hcarty>
Or OSP rather
<Spiwack>
Pierre-Yves hoped to have it done by this summer
<Spiwack>
(Qt-caml)
<hcarty>
bouzu: Check out the Random module
<Spiwack>
However I'm sure he didn't have the time
<Spiwack>
So expect it within a year from now :)
<bouzu>
thanks
<hcarty>
Spiwack: Do you know if it has been updated or maintained at all since the last OSP? It seemed quite promising, so it would be a shame for it to go away
<hcarty>
I've been reasonably happy with lablgtk + Cairo for my limited needs so far
<Spiwack>
I don't actually know, as I haven't seen the authors for a while, but I believe so
<palomer>
I've always wondered
<palomer>
would it be possible to have something like gtk's frame in ncurses
bouzu has quit [Client Quit]
<Spiwack>
(gotta go, goodbye everyone)
<Alpounet>
maybe we should invest it for Batteries ? :-p
Spiwack has quit ["Leaving"]
jah has joined #ocaml
<hcarty>
I think FrGui, or something similar, is worth investing in for Batteries
<hcarty>
I'd volunteer to work on it, but it would be close to a year, most likely, before I really could
<Yoric[DT]>
FrGui was nice.
<flux>
maybe these projects don't get the lift because there doesn't seem to be much demand for gui apps written in ocaml :-/
<flux>
of open source ones I can only think of unison and mldonkey
<flux>
oh, and some ides
<Camarade_Tux>
and soon, a web browser ! \o/
<Camarade_Tux>
...soon...
<Alpounet>
when ?!
marmottine has quit [Read error: 110 (Connection timed out)]
<Camarade_Tux>
after webkit-gtk has the code for offscreen rendering
<Camarade_Tux>
which will probably happen after I make it work properly for windows so I can trade it for that feature :p
<hcarty>
flux: Yes - I wonder if the limiting factor is "I don't like lablgtk" or "I don't need/want to write a GUI app in OCaml"
<Camarade_Tux>
I've only really enjouyed lablgtk after I wrote a library for it (actually a binding generator for all the .*gtk.* libraries)
<Camarade_Tux>
s/u//
<palomer>
is frgui still being maintained?
<palomer>
reactive programming
<palomer>
sounds like my 9th grade chemistry experiment
<Alpounet>
Camarade_Tux, if you create an OCaml web browser, I'll be your first user :-)
<hcarty>
palomer: I don't think it's being maintained. But it's in a usable, if very basic, state now in the 2007 Jane St. OSP Subversion repository
<Camarade_Tux>
thanks :)
<flux>
frgui looked very interesting, but I haven't yet have had the need to write a gui app in ocaml
<flux>
..well, atleast not one that would use widgets, I've written some SDL ones
<hcarty>
palomer: There is also a Google Code repo, but it is an earlier and significantly different implementation
<Camarade_Tux>
I'd like to port MMM to gtk
<flux>
camarade_tux, unfortunately the core of your web browser isn't written in ocaml, which could be a compelling argument for using the browser in the name of browsing safety :)
<Camarade_Tux>
flux, that's the reason I want to port MMM to gtk ;)
<flux>
MMM looks ooold :)
<flux>
but if its core is excellent, then perhaps it's worth the trouble..
<flux>
I mean, how do websites these days look like when seen through that?
<flux>
the screenshot on the website isn't all that bad
<flux>
but hardly multimedia :)
<Alpounet>
flux, SDL is rather for games or at least multimedia stuffs
<Alpounet>
flux, great stuff ! You should put it into OCaml debian repos
<palomer>
I once wrote a game using SDL
<Alpounet>
Me too, but I was a C++ guy at that time.
<Camarade_Tux>
flux, html support must be updated and then, if possible, IE6 level (minus the bugs ;) ) would probably be enough (it should be possible to select the rendering engine per tab so webkit will always be available)
<palomer>
lemme upload a video of it on youtube
<flux>
camarade_tux, the license of MMM is perhaps less than optimal..
<flux>
camarade_tux, I guess it doesn't have javascript, and that would basically need to be implemented without other libraries too
<Camarade_Tux>
I had forgotten the license =/
<Camarade_Tux>
js should be doable with some time
Snark has quit ["Ex-Chat"]
<Alpounet>
and motivation.
jbms has left #ocaml []
* Camarade_Tux
whistles :p
jeanb-- has joined #ocaml
<Camarade_Tux>
although there are already some nice js libs in ocaml
<flux>
indeed, forgot about them
<flux>
but do they actually run js?
<flux>
but atleast they handle the parsing
<palomer>
so...what's reactive programming?
<flux>
palomer, well, did you look at the frgui examples?
<flux>
getting them (js interpreters) to be really fast can be challenging, looking what people've needed to do to get that :)
<flux>
hey, perhaps metaocaml could help with that..
<flux>
which reminds me, how's metaocaml doing these days?
<Camarade_Tux>
I don't intend to get fast JS ;p
<flux>
I think someone said they (metaocaml) were supposed to follow O'Caml HEAD..
marmottine has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
marmottine has quit [Read error: 60 (Operation timed out)]