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
ftrvxmtrx has quit [Ping timeout: 246 seconds]
gnuvince has joined #ocaml
ftrvxmtrx has joined #ocaml
JoeyA has quit [Quit: Leaving]
<pippijn> I have a problem with ncurses in ocaml: http://paste.xinu.at/af0/
<pippijn> this program does not print "oß"
<pippijn> it writes "öÃ~_" instead
<pippijn> is there an example for an oasis package that provides bindings to an external C library?
<_habnabit> pippijn, ncurses kind of sucks at non-ASCII
fraggle_ has quit [Ping timeout: 246 seconds]
<zaltekk> pippijn: are you sure it isn't a problem with your terminal not handling utf-8?
smerz has quit [Remote host closed the connection]
<pippijn> _habnabit: it works with ncursesw
<zaltekk> the w meaning widechar?
<pippijn> yes
<zaltekk> well there's your answer
<zaltekk> that isn't ascii, so you need the widechar version
<pippijn> zaltekk: http://paste.xinu.at/xV8/
<pippijn> yeah, I guess I do
<_habnabit> that doesn't really indicate anything
<zaltekk> that means that it is likely the ncurses
<zaltekk> since his terminal displayed it correctly
<_habnabit> what's your $LANG
<_habnabit> no, it doesn't mean anything
<_habnabit> the source file encoding can be different from the $LANG
Pr0zac has quit [Ping timeout: 260 seconds]
<pippijn> $ ./test.native
<pippijn> en_US.utf8
<pippijn> Sys.getenv "LANG"
<pippijn> testsuite/screen_t.ml: UTF-8 Unicode text
<pippijn> anything else?
<zaltekk> says use ncursesw
<pippijn> yes
<zaltekk> so just use that?
<pippijn> jsut?
<pippijn> just?
<pippijn> I didn't write the ncurses bindings for ocaml
<zaltekk> err yeah there's the bindings issue
<_habnabit> yes, but you can make it link against ncursesw
<_habnabit> it's not a different API
<pippijn> right.. so I have to recompile it?
<pippijn> so debian's package is just broken
<zaltekk> doubtful
<pippijn> libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f032f48f000)
<zaltekk> looks right.
<pippijn> I don't need to recompile
<pippijn> it's already linked against ncursesw
<_habnabit> (fwiw this crap is why I don't use ncurses)
<pippijn> what do you use then?
<_habnabit> python + urwid
<pippijn> hm
<pippijn> urwid is pure python?
<_habnabit> yes.
<pippijn> maybe it's time for a pure ocaml terminal library
<_habnabit> heh
<pippijn> termcap stuff is in Unix
<_habnabit> urwid has different backends for writing out stuff to the terminal. by default it just emits VT100 escapes
<_habnabit> and basically everything uses that these days anyway
<pippijn> output is one thing
<pippijn> input is another
<pippijn> does urwid handle combining characters correctly?
<_habnabit> afaik yes
<pippijn> that's impressive
<_habnabit> it's not difficult in python
<pippijn> so python knows about terminal emulators, glibc versions etc. that all make slight differences in how combining characters are displayed?
<_habnabit> are there multiple correct interpretations ???
<pippijn> there is no defined interpretation
<pippijn> there are many broken or weird implementations
<pippijn> xterm uses a fixed table derived from some version of unicode
<pippijn> urxvt uses wcwidth()
<pippijn> wcwidth is slightly different per glibc version
<pippijn> different terminals disagree on which character the combiner applies to
<pippijn> unicode defines "base characters" to which it should apply, but not all terminal emulators care about that
<pippijn> so if you want to have correct display width for combiners in urwid, you have to know about all those differences
<pippijn> or urwid has to know
<pippijn> or python
<pippijn> _habnabit: I'm curious, how does urwid represent its screen internally? if it's a single string or array, then getting and setting characters becomes O(n)
<pippijn> is it an array of strings?
<pippijn> ok, fixed, I had to setlocale(LC_ALL, "");
<pippijn> on the C side
gnuvince has quit [Ping timeout: 245 seconds]
gnuvince has joined #ocaml
<pippijn> _habnabit: " ̸̶̗̥̳̂͂"
<pippijn> _habnabit: what does urwid show?
<pippijn> _habnabit: these are 8 unicode codepoints
<pippijn> _habnabit: ncursesw has space for 5
<pippijn> _habnabit: vim only shows 3, I think
lihaitao has joined #ocaml
cyphase has quit [Ping timeout: 265 seconds]
cyphase has joined #ocaml
oriba has quit [Quit: oriba]
JoeyA has joined #ocaml
larhat has joined #ocaml
larhat has quit [Client Quit]
<gnuvince> Is it possible to create a '_a array?
<JoeyA> gnuvince: You mean an array where items can have varying types?
<JoeyA> Or an array whose type hasn't been bound yet?
<gnuvince> JoeyA: no, where the type is initially unknown.
<gnuvince> The latter.
<JoeyA> Array.of_list [];;
<gnuvince> That would be an array of size 0, right?
<JoeyA> - : '_a array = [||]
<JoeyA> That's what the ocaml REPL gives me, yes.
sivoais has joined #ocaml
mattrepl has quit [Quit: mattrepl]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
zorun has quit [Read error: Connection reset by peer]
zorun has joined #ocaml
ulfdoz has joined #ocaml
JoeyA has quit [Quit: Leaving]
tmaedaZ is now known as tmaeda
ocp has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 260 seconds]
johnnowak has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
<johnnowak> hello all. i don't suppose anyone has an idea when 4.0 is coming out?
<adrien> June
<adrien> around June
<johnnowak> ah, wonderful
<johnnowak> thanks
lihaitao has quit [Ping timeout: 260 seconds]
andreypopp has joined #ocaml
Kakadu has joined #ocaml
Cyanure has joined #ocaml
albacker has joined #ocaml
bnwr_ is now known as bnwr
iago has joined #ocaml
* adrien is less and less convinced by the use of lazyness in GUIs and believes it's merely a work-around which, instead of creating circular definitions, creates circular uses
hiptobecubic has joined #ocaml
<mrvn> Only place where I can see it being usefull is lists that are only partially displayed and generating the list entry is expensive. So you make them all lazy and only evaluate the ones that are visible. Things like that.
<mrvn> Otherwise it is a misused to declare a ony-once-mutable.
<mrvn> -d
<adrien> agreed on that
<mrvn> Other than the danger of creating a circular use it is a nice idea though.
<mrvn> memory efficient
tufisi has joined #ocaml
<mrvn> adrien: let foo = Obj.magic 0 .... foo <- real_foo has the danger of segfaultig when you have a circular use but has no no runtime overhead.
<adrien> but for GUIs, I believe that quite often it's the mutate-only-once pattern
<adrien> or delayed initialization
<mrvn> totaly
<adrien> which makes it possible to declare stuff as global variables without having them evaluated too early
<adrien> and then you have the circularity (first declared, then used, then "defined" for real)
<mrvn> # let rec x = lazy (Lazy.force y) and y = lazy (Lazy.force x);;
<mrvn> val x : 'a Lazy.t = <lazy>
<mrvn> val y : 'a Lazy.t = <lazy>
<mrvn> # Lazy.force x;;
<mrvn> Exception: CamlinternalLazy.Undefined.
<mrvn> and it doesn#t go into endless loops even if you have cicles.
<adrien> heh, yeah :-)
<adrien> I'm changing code in yypkg that used lazy and the only I'm facing is that the code is actually circular
<mrvn> For delayed init it can sometimes help to define a smaller type first and then extend that with the delayed values.
<mrvn> I would be nice if ocaml would allow calling methods of the object during initialization if they do not access the uninitialized values. But that would be much harder to check.
<adrien> I've come to like FRP-style, which you can do with no particular support besides glib's event loop; it might not give best performance but at least it's mostly pure/functional
<adrien> what I often do for that is: class foo () = let a = ... in let b = ... in object method bar () = a + 42 end
<adrien> that sometimes give a pretty long list of "let ... in" at the beginning of the function but it has worked pretty well so far for me
<mrvn> only works if you don't need to call a method or function taking the object as argument.
<adrien> yup
<adrien> it's definitely limited but it has been enough for me so far
<mrvn> If it can be done I would always prefer that over Lazy.
avsm has quit [Quit: Leaving.]
roha has joined #ocaml
<pippijn> how does is a method call in ocaml implemented?
<pippijn> I see a call to caml_send1 for a method call with 1 argument
albacker has quit [Ping timeout: 246 seconds]
snearch has joined #ocaml
djcoin has joined #ocaml
<Kakadu> pippijn: I've heared (at JS blog) that _ -> _ -> _ -> _ internally is represented as (_*_*_) -> _
<Kakadu> So All functions have 1 argument
<pippijn> hm
<pippijn> no
<pippijn> there is also send3
sander_ has joined #ocaml
<adrien> pippijn: "currification"?
<mrvn> pippijn: much more complex.
<mrvn> From the outside all functions are curriefied. let foo x y z --> let foo = function x -> function y -> function z -> ...
<mrvn> Internally a closure is a block containing a pointer to the code and a bunch of values for the parameters. Applying things to a closure fills in the slots.
<mrvn> When calling C code arguments are passed using the normal C calling convention up to including 5 arguments. After that things get even more complex. in native code the C calling conventions remain. In bytecode more than 5 parameters are passed as C array of values and the size of the array.
iago has quit [Ping timeout: 246 seconds]
<mrvn> Not sure wether ocaml functions in bytecode are treated the same but I would think so.
iago has joined #ocaml
ocp has quit [Ping timeout: 272 seconds]
ocp has joined #ocaml
Kakadu has quit [Quit: Page closed]
ocp has left #ocaml []
Cyanure has quit [Ping timeout: 240 seconds]
<pippijn> mrvn: how about method calls?
<pippijn> mrvn: they need to be dynamically dispatched
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
f[x] has quit [Read error: Connection reset by peer]
iago has quit [Ping timeout: 240 seconds]
andreypopp has quit [Quit: Computer has gone to sleep.]
iago has joined #ocaml
bzzbzz has quit [Quit: leaving]
Cyanure has joined #ocaml
ulfdoz has joined #ocaml
fraggle_ has joined #ocaml
<pippijn> can I specialise a Map to only accept a certain type as value?
<pippijn> like: module Widget_map = String_map with type t := Widget.t t
<pippijn> something like that
<pippijn> restrict the value type?
<mfp> in fact, you only need to restrict the type of empty and map (since they're the only ways to create maps with arbitrary values), but there's no way to express it succinctly in the signature
<mfp> in the actual module implementation, something like module Widget_map = struct include String_map let empty : Widget.t t = empty let map f (x : Widget.t t) = map f x end should do end
<mfp> -end
<pippijn> ah
<pippijn> mfp: that's good
<pippijn> for widgets, it doesn't work, because the definition of Widget.t uses that map
<pippijn> but there is Geometry.Map, which can be restricted
<mfp> it should be possible _if_ you use recursive modules
<pippijn> yeah
<pippijn> I'm going to try that, just to see if it works
<pippijn> oh boy
<pippijn> mfp: no, this is not pretty
<pippijn> it's not worth it
<pippijn> because I need to specify the signatures in recursive modules
<pippijn> mfp: also, I think I need to restrict all functions in String_map.Make
johnnowak has left #ocaml []
<mrvn> *grummel* Why doesn't stdlib have a priority queue?
snearch has quit [Quit: Verlassend]
<Qrntz> mrvn, for the same reason stdlib doesn't have a lot of things :-(
<mrvn> Anyone know how BatHeap is implemented?
oriba has joined #ocaml
Anarchos has joined #ocaml
roha has quit [Ping timeout: 250 seconds]
letrec has joined #ocaml
mattrepl has joined #ocaml
albacker has quit [Ping timeout: 260 seconds]
roha has joined #ocaml
<thelema> mrvn: using binomial trees
<thelema> I'm sure I have a leftist-tree implementation around here somewhere...
tmaeda is now known as tmaedaZ
j2d2j2d2 has left #ocaml []
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
tmaedaZ is now known as tmaeda
lihaitao has joined #ocaml
lihaitao has quit [Remote host closed the connection]
smerz has joined #ocaml
<mrvn> thelema: I'm looking into Fibonacci Trees. They have O(1) insertion time. For A* there will be more insertions than remove_min so it might be faster.
<mrvn> let make () = { num_elt = 0; in_elt = Obj.magic 0; rees = Obj.magic 0; } # let t = make ();;
<mrvn> zsh: segmentation fault ocaml
<mrvn> How do I make the toplevel not pretty-print an empty tree?
<adrien> don't define a toplevel value that is the empty tree?
<adrien> i.e. add 42 (make ())
<adrien> as your first point
<mrvn> Interestingly enough that doesn't segfault. Adding an element creates a node with "children = Obj.magic 0;" but that doesn't get printed. The output isn't usefull though since a node is in a doubly linked list, a circular list. I probably shouldn't pretty print any tree or have a custom printer. Can I provide one for the toplevel?
Cyanure has quit [Ping timeout: 244 seconds]
roha has quit [Ping timeout: 260 seconds]
ggherdov has joined #ocaml
letrec has quit [Ping timeout: 250 seconds]
milosn has quit [Read error: No route to host]
milosn has joined #ocaml
tilarids` has joined #ocaml
<tilarids`> Hi. Does anyone use gentoo here? It seems current gentoo portage has broken dependencies for dev-ml/lablgtk if gnome 3 is installed
<tilarids`> I wonder if anyone tried dev-ml/lablgtk with gnome USE flag on on gnome 3
<adrien> disable "libgnomeui" support in lablgtk?
<tilarids`> it seems it's gnome-panel that causes troubles
<pippijn> ncurses is crap
<tilarids`> there is no such USE as bonobo in >=gnome-base/gnome-panel-3.2.1
<adrien> tilarids`: well, anything with "gnome" in the name for lablgtk is probably going to cause an issue
<pippijn> mvwaddch (WINDOW *, int y, int x, const chtype ch)
<adrien> actually, anything that will somehow pull gtk+3
<pippijn> first of all, why is it const chtype? it's passed by value.. const doesn't make sense
<pippijn> secondly, why is chtype int?
<tilarids`> and dev-ml/lablgtk depends on the >=gnome-base/gnome-panel-2.32[bonobo] or <gnome-base/gnome-panel-2.32
<pippijn> not wchar_t? not char? int.
<pippijn> and this int is essentially restricted to char
<pippijn> if I try passing a wide character, it's truncated
smerz has quit [Remote host closed the connection]
<pippijn> passing ☺ prints :
<pippijn> so what is it for?
<pippijn> worthless..
<tilarids`> adrien: I was able to emerge the dev-ml/lablgtk by switching off the gnome support. Trying to get better understanding of the issue and (possibly) file a bug to gentoo bugzilla
<adrien> well
<adrien> what was the error?
<adrien> and why the gentoo bugzilla? there's probably a check to do in lablgtk*2* too
<tilarids`> adrien: what kind of check should I do? Is there any way to check that lablgtk2 actually performs well in gnome3 env?
<tilarids`> I'm remerging it with examples now
smerz has joined #ocaml
<adrien> tilarids`: it does *NOT* perform with gtk+3
<adrien> you might have gtk+2 installed too but I have no idea if you have and then, I have no idea if it'll prefer one or the other
Zedrikov has joined #ocaml
<adrien> tilarids`: could you open a bug on the bugtracker for lablgtk that is on forge.ocamlcore.org?
* adrien has to leave now
<adrien> (just something saying basically "check what happens when gtk+3 is installed"
<tilarids`> adrien: I have just checked it. I have both gtk2 and gtk3 installed
<tilarids`> And I can run examples with lablgtk2 example_filename.ml
<tilarids`> Don't know if there are examples that check the gnome-panel
<tilarids`> I'll open an issue then
<adrien> lablgtk2 probably choses gtk+2 then
<adrien> BUT
<adrien> gnome3 is gtk+3
<adrien> which lablgtk* doesn't support
<adrien> and trying to use gnome3 stuff from lablgtk(2) will obviously not work (since one wants gtk+3 and the other one wants gtk+2)
<adrien> but open a bug about that
<adrien> with the error message you got
<tilarids`> from my point of view gnome3 is a terrible mess of gtk2 and gtk3. so lablgtk can actually work with gnome stuff. And actually I don't have any error messages. I just wasn't able to build lablgtk2 with gnome support
<adrien> it's not a mess or mix
<adrien> they maybe have not updated all APIs but it's gtk+*3*
<adrien> gtk+2 and gtk+3 are registered separately in pkg-config
<adrien> so lablgtk2 can simply pull gtk+*2* properly
<adrien> but as soon as it tries to get anything gnome, it'll face gtk+3 which is does *NOT* handle
<tilarids`> adrien: so, is there any example which uses gnome-specific stuff so I can check it and get the error?
milosn_ has joined #ocaml
<adrien> no idea
<adrien> but it's not supported
<adrien> (briedfly baack in 15 minutes)
<tilarids`> I don't want to file a bug that is like "Hey guys, good job, all works fine, but I'm curious about gtk3 support, can you check it?" :)
<adrien> there isq no squpport
<adrien> but lablgtk2 sqhopuld fail nicely when facing gtk+3
milosn has quit [Quit: leaving]
ggherdov has quit [Ping timeout: 256 seconds]
<Zedrikov> Adrien, do you have some problem with your keyboard?
<adrien> gloves
<adrien> but they weren't needed
<adrien> (actually, it's quite hot outside)
<pippijn> it was 29°C here today
milosn_ is now known as milosn
ftrvxmtrx has quit [Read error: Operation timed out]
Anarchos has joined #ocaml
<mrvn> Fibonacci Heaps have a O(1) decrease key. Anyone know if one can also have a O(1) increase key?
<Anarchos> mrvn no idea, did you look in google or wikipedia ?
<mrvn> yeah, that (wikipedia) is what I've implemented
Znudzon has joined #ocaml
<Anarchos> mrvn oh ok, maybe it is not possible to have O(1) increase and decrease key at the same time ?
junsuijin has joined #ocaml
junsuijin has quit [Client Quit]
junsuijin has joined #ocaml
junsuijin has quit [Read error: Connection reset by peer]
<pippijn> _habnabit: ping
ftrvxmtrx has joined #ocaml
avsm has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
hiptobecubic has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ftrvxmtrx_ has joined #ocaml
Hussaind has quit [Read error: Connection reset by peer]
ftrvxmtrx has quit [Ping timeout: 246 seconds]
sander_ has quit [Quit: Leaving]
ulfdoz has joined #ocaml
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
lorill has joined #ocaml
cyphase has quit [Read error: Connection reset by peer]
albacker has quit [Ping timeout: 265 seconds]
struktured has joined #ocaml
cyphase has joined #ocaml
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
Submarine has quit [Remote host closed the connection]
struktured has quit [Ping timeout: 252 seconds]
ggherdov has joined #ocaml
Znudzon has quit [Ping timeout: 260 seconds]
tufisi has quit [Ping timeout: 265 seconds]
djcoin has quit [Quit: WeeChat 0.3.2]
Cyanure has joined #ocaml
mmajchrzak has joined #ocaml
johnnowak has joined #ocaml
ggherdov has quit [Ping timeout: 276 seconds]
Zedrikov has quit [Quit: Bye all, see you next time!]
albacker has quit [Quit: Leaving]
struktured has joined #ocaml
struktured has quit [Ping timeout: 252 seconds]
Cyanure has quit [Remote host closed the connection]
johnnowak has left #ocaml []
dsheets has quit [Ping timeout: 250 seconds]
lorill has quit [Quit: Quitte]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
dsheets has joined #ocaml
iago has quit [Read error: Operation timed out]
mmajchrzak has quit [Ping timeout: 276 seconds]
<mrvn> Priority queue with Binomial Heap or Fibonacci Heap: http://paste.debian.net/166307/
<mrvn> in case someone is interested
<mrvn> Note: Fibonacci heap delete_min is amorticed O(log n) but can be O(n) worst case, O(2 log n + # insertions since last call) unless I'm mistaken.
mrvn has quit [Ping timeout: 245 seconds]
mrvn has joined #ocaml