mfurr changed the topic of #ocaml to: OCaml 3.08.2 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
zzorn_WoW is now known as zzorn_sleep
zzorn_sleep has quit ["They are coming to take me away, ha ha"]
Sonarman has joined #ocaml
Sonarman has quit [Read error: 110 (Connection timed out)]
booyaa has joined #ocaml
booyaa has left #ocaml []
int80_h has quit [Nick collision from services.]
tea has joined #ocaml
Sonarman has joined #ocaml
Sonarman has quit ["leaving"]
Banana has quit [Remote closed the connection]
monochrom has quit ["Few people understand "understanding"."]
vincenz has quit [Ping timeout: 14400 seconds]
Submarine has joined #ocaml
Snark has joined #ocaml
vezenchio has joined #ocaml
mlh_ has quit [Client Quit]
_fab has quit [Remote closed the connection]
Banana has joined #ocaml
pango has quit [Remote closed the connection]
smimou has joined #ocaml
zzorn has joined #ocaml
vincenz has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
Msandin has joined #ocaml
mattam has joined #ocaml
<mflux> hmh, can one allocate a bigarray from c-code and then let ocaml's gc to take care of it? the example on bigarray's documentation shows only the case of returning a statically allocated array
<vincenz> you have to do some extra work in the c-code
<vincenz> and use the mlalloc
Submarine has quit ["Leaving"]
_fab has joined #ocaml
tintin has joined #ocaml
MartinS has joined #ocaml
<MartinS> hmpf, bug int the map_<type> generation code, but fold_<type> otoh seems to be working well...
Msandin has quit [Read error: 110 (Connection timed out)]
<mflux> would it be easier or more difficult to make an ml-function to do the allocation for me?-)
<mflux> (and call it from the c-code)
MartinS is now known as Msandin
Skal has joined #ocaml
<vincenz> mflux: what kind of value are you allocating?
<mflux> 2-dimensional bigarray for RGB-data
<mflux> for which dimensions are determined in the function
<Msandin> Now, this isn't a bug, it's just that the map constructed from a recursive datatype is a recursive function, and thus sensible to the monomorphism restriction... so not all recursive data types have a map which can be types, obvious I guess:)
<Msandin> type(s=d)
<vincenz> mflux: make a singular dimension array?
<mflux> how much would that help?
<mflux> or do you mean not using Bigarrays
<vincenz> alloc_array(f, a) allocates an array of values, calling function f over each element of the input array a to transform it into a value. The array a is an array of pointers terminated by the null pointer. The function f receives each pointer as argument, and returns a value. The zero-tagged block returned by alloc_array(f, a) is filled with the values returned by the successive calls to f. (This function must not be used to build an array of flo
<mflux> that option did cross my mind, but I'd rather avoid it, because this is what bigarrays are for ;)
<vincenz> and use normal arrays
<mflux> hmm
<mflux> infact I may be able to put that into bigarray
<Msandin> This means my code works, which is great, heck, it now constructs string_ofs, maps, and folds for many types=)
<vincenz> Msandin: what is "monomorphism restriction"?
<Msandin> vinc: well, in this case it's about restricting recursive polymorphism, certain functions can't be typed in the a type system which allows type inference, because it never generalizes at type parameters:-)
<Msandin> this function doesn't type check, for example: let g1 f = f 1, f "1";;
<vincenz> hmm
<vincenz> true
<vincenz> though I fail to see how that ties into recursive data types
<vincenz> Msandin: what client do you use?
<Msandin> Miranda
<vincenz> for irc
<vincenz> oh!
<Msandin> vinc: well, my problem is actually about the restriction on recursive polymorphism
<vincenz> how so?
<vincenz> can you give an example?
<vincenz> is miranda any good?
<Msandin> you can't make a recursive call to a function with different types, eg
<vincenz> true
<vincenz> but where would you need that?
<Msandin> (miranda is the IM client I use for ICQ, MSN messenger, and IRC, I think it's decent)
<vincenz> (never heard of it before..How does it compare to gaim? And... introduce it to tabcompletion...I use messengers for messenging but I use irssi for chat and it lights up my name when it's complete... usually accomplised on most irc-clients with <TAB>)
<vincenz> I would assume that you could map for any datatype
<Msandin> Well, the map function for this type: type 'a t = A of ('a * int) t with map
<vincenz> for what type do you get "bugs"?
<Msandin> would look like this:
<Msandin> let rec map_t f_a = fun (A p1) -> A (map_t (fun (p1, p2) -> f_a p1, (fun x -> x) p2) p1)
<Msandin> which doesn't type check
<Msandin> (seems Miranda doesn't do CTCP version)
<vincenz> nope
* vincenz blinks
<vincenz> type 'a t = A of ('a * int) t
<vincenz> you can't construct one of those types
<vincenz> it's non-constructable
<Msandin> well:-P
<vincenz> and it requires inf amount of memory
<vincenz> stick to constructable types
<Msandin> well, I can add another constructor to make it constructable:-)
<vincenz> type 'a t = A of ('a * int) t | B of int
Snark has joined #ocaml
<vincenz> and then you can make a mape
<Msandin> nope, still can't
<vincenz> hmm
<vincenz> cause it's not really recursive
<vincenz> type 'a t depends on type ('a * int) t depeonds on ....
<vincenz> so this is monomorphic recursion?
<vincenz> that 'a t depends on 'a t?
<vincenz> cool I learned something new :)
<vincenz> wait a sec
<vincenz> how do you do the map for a plain disjoint union?
<vincenz> type xxx = A of int | B of string
<vincenz> what does map_xxx look like?
<Msandin> it is, because the map which takes a function of ('a -> 'b) would need to call itself with a function of type ((int * 'a) -> 'b), which is illegal, and so I can't map that
<Msandin> vinc: boring=)
<vincenz> well show me
<vincenz> Msandin: yip cause the type is not really recursive :)
<vincenz> but what would map_xxx look like?
<Msandin> vinc: map's aren't that interesting when the type doesn't have any type parameters;-P
<vincenz> let map_xxx f_a f_b?
<vincenz> it takes two f's?
<Msandin> nope, zero
<vincenz> ok
<Msandin> one f/type parameter for a map
<vincenz> type 'a xxx = A of 'a | B of string
<Msandin> the fold would take two f's, one per constructor
<vincenz> ah duh
<vincenz> wasn't thinking :P
<vincenz> B of string does not get changed
<vincenz> cause 'b xxx still has B of string
<vincenz> dumdum
<vincenz> don't mind me
<Msandin> hehe=)
<vincenz> what do you do besides mucking with camlp4?
<Msandin> Currently unemployed:-/ But I'm going to do work practice in a couple of week, looking forward to that
pango has joined #ocaml
<vincenz> what did you study?
<vincenz> and what do you mean by work practice?
<Msandin> well, i have a computer science and engineering degree, and work practise, well, it means that after remaining unemployed for a certain ammount of time the government pays whatever little money I get as a compensation and I work for a limited period of time (3 months in my case) for a company which might want to employ me at the end of this period...
<Msandin> better than me working on fold functions doing nothing, and it gives me a chance to prove myself to the company and gain some experience, or so the idea is=)
Zaius has joined #ocaml
<Msandin> what u do vinc?
<vincenz> phd student
<vincenz> I don't see it light up if you don't use my full name tho :P
<Msandin> aha, and this client doesn't have tab completion... but it's convinient otherwise, what's your PhD work about?
<Msandin> (vincenz for highlighting:-P)
<mflux> hmh, I seemed to be able to pass uint8 allocated in C back to ocaml, but with int32 it fails (contents are apparently nonsense)
<mflux> I do wonder though if it will be managed by the gc though ;)
<mflux> hmph, Bigarrays support both row-major and column-major formats, for which I would like the latter, but then again its indexing starts at 1, not 0
<mflux> who really manipulates arrays so that horizontally adjacent elements are not adjacent in real memory
<Msandin> ay, just figured ut a problem right=)
_JusSx_ has joined #ocaml
vincenz has quit ["leaving"]
vincenz has joined #ocaml
* Msandin sort of just released Tywith 0.3, http://www.seedwiki.com/wiki/shifting_focus/tywith
CosmicRay has joined #ocaml
<vincenz> your wiki?
<vincenz> Msandin: shouldn't you separate concerns?
<vincenz> the fold_Tree
<vincenz> never mind
<Msandin> vincenz: hum? did I make yet another mistake? well, my wiki, seemed the easiest way=)
<vincenz> no I was incorrect
<vincenz> just...
<Msandin> well, I'm certain my code could be improved, and hopefullt I will, refactoring this'n'that:)
<vincenz> how did you get the .com name?
<Msandin> Nah, it's not like that, it's my wiki, but it's a free wiki on the seedwiki wikifarm
<Msandin> Obviously, some sort of support for floats would be nice:-P
<Msandin> Ehrm, none needed, stupid me
Snark has quit [Connection timed out]
Msandin has quit [Read error: 60 (Operation timed out)]
Msandin has joined #ocaml
Msandin has left #ocaml []
yangsx has joined #ocaml
<yangsx> Lately I'm reading "GUI Programming with QT: Python Edition" and found the python QT binding very impressive. I'm wondering why there is no such a binding with OCaml.
<yangsx> Is it technically too difficult, or nobody gets the time working on it, or the license problem?
vezenchio has quit ["I live in a yurt on the steppes of Sheepfuckistan. That's why."]
vezenchio has joined #ocaml
<Smerdyakov> I don't know enough about Python QT to say.
<Smerdyakov> Perhaps it could be challenging if it relies overly much on dynamic typing.
<Smerdyakov> But I suspect that, even in that case, there would be a reasonably easy alternative design to implement for OCaml.
<det> yangsx, I would think most O'Caml developers who want a GUI would prefer GTK.
<yangsx> QT has reflection to reflect signal and slot and requires CPP preprocessing.
<yangsx> det: agree lablgtk is quite nice
<Smerdyakov> yangsx, I'd be lying if I said I understood what you just said. :P
<det> yangsx, In what way does it require CPP preprocessing?
<yangsx> QT has uic to preprocess the cpp source code
<Smerdyakov> yangsx, please assume we know nothing about QT.....
<yangsx> after uic compilation, QT source code can be compiled by standard compliant compiler.
<Smerdyakov> What on earth is "uic"?
<det> yangsx, Do you mean programs with use QT or the QT code base itself?
<det> w/with/which/
<yangsx> det: I mean program with QT library.
<det> I am having trouble understanding your english, do you mean programs which _use_ QT?
<yangsx> Smerdyakov: QT's preprocessor to implement signals, slots, widget ownership hiearchy, etc.
<Smerdyakov> yangsx, and I have no idea what any of that means concretely.
<yangsx> det: sorry. yes.
<det> Smerdyakov, I think he is saying that programming in QT means you are programming in a special dialect of C++ with QT extensions which gets compiled to real C++
<Smerdyakov> yangsx, if you could give the absolute _minimal_ example, which might not even be QT code but would only demonstrate the difficulties, then perhaps we could discuss whether or not there is a better way to do it in OCaml.
<yangsx> det: that's it.
<Smerdyakov> Oh, I think I've understood that, but the fact that such a language/compiler exists doesn't mean that it provides anything useful above what OCaml provides. C++ is a pretty impoverished language.
<det> Maybe there are no external symbols to call to set this stuff up. Just UIC magic.
<Smerdyakov> That wouldn't have to be a problem.
<Smerdyakov> I'm not going to draw any conclusions without a concrete example to consider.
<yangsx> say some calsses can emit signals and other classes have slots to handle certain signals.
<Smerdyakov> So the classes that "emit signals" have a method you can call to register a handler function.
<yangsx> the beauty of signal/slot mechanism is that the object emits signals does not have to know who's going to handle the signal
<Smerdyakov> Oh please. That's the same as saying "the beauty of List.map is that it doesn't need to know what its function argument will be."
<det> Sounds like exceptions to me.
<Smerdyakov> I'm willing to bet that uic spends most of its effort implementing reduced versions of OCaml features.
<yangsx> it's any class that's interested in that specific to register
<Smerdyakov> yangsx, you are claiming that simulating closures is not the main difficulty in this feature?
<Smerdyakov> yangsx, I think keeping a global mapping from signal names to closures is quite easy in OCaml...
<det> yangsx, Are the signals handled hierarchly?
<yangsx> I don't know how python binding does that.
<Smerdyakov> yangsx, that doesn't matter.
<yangsx> det: not necessarily
<Smerdyakov> yangsx, are you claiming that handling signals is more complicated in OCaml than keeping a mapping from signal names to sets of closures?
<det> yangsx, What if more than one class is interested in a specific signal?
<yangsx> det: just works as expected.
<det> yangsx, How is it expected to work?
<yangsx> any interested objects can be called with a connect function.
<Smerdyakov> yangsx, can you please answer my question before talking about anything else?
<yangsx> Smerdyakov: sorry, I'm not sure the answer to your question.
<Smerdyakov> yangsx, OK. I will assume I am right, unless you can demonstrate otherwise. Nothing you have said so far contradicts my assertion.
<Smerdyakov> yangsx, which means that signals are handled _better_ by a simple OCaml implementation than with the custom uic compiler.
<Smerdyakov> So, again, I'll make the general assertion that was uic is is a compiler from a subset of OCaml into C, essentially.
<Smerdyakov> All the features it adds are trimmed-down versions of OCaml features.
<Smerdyakov> Therefore, you can cut out that stage and do things directly if you start from OCaml/
<yangsx> an example line of python code: self.connect( self.add, SIGNAL( 'clicked()' ), self.addEntry )
<Smerdyakov> What does it mean?
<yangsx> self is a reference to the class object, add is a component of the object
<Smerdyakov> I think I know enough about Python to understand the local semantics.
<Smerdyakov> The question is, what does connect do, and what do its arguments mean?
<yangsx> signal looks like a macro telling that 'clicked()' is the signal.
<yangsx> that line of code connects the signal to a slot 'addEntry' of the same class.
<Smerdyakov> How does connect use its first argument?
<yangsx> if the first argument gets clicked, addEntry will be called.
<Smerdyakov> So, in OCaml: self#add#connect("clicked()", self#addEntry)
<det> yangsx, What does SIGNAL do with the string 'clicked()' ?
<yangsx> Smerdyakov: that's lablgtk's way.
<det> yangsx, is SIGNAL a python function or is it preproccessed?
<Smerdyakov> yangsx, I claim that is also QT's way, implemented in OCaml.
<yangsx> det: SIGNAL in QT marks that "clicked" is a signal and registers it as so behind the scene, I guess
<Smerdyakov> yangsx, why do you think that the pattern I suggest is not a proper way to implement an OCaml Qt interface?
<yangsx> SIGNAL is a macro in QT, a function in Python
<yangsx> Thus python qt binding does not require preprocessing
<Smerdyakov> I'm asserting that you've picked the wrong essential reason that the Python version doesn't use preprocessing; the _real_ reason is that Python has closures built in.
<yangsx> Smerdyakov: I mean lablgtk implements in that way, not suggesting it's not proper ocaml way
<Smerdyakov> yangsx, OK, then you agree that OCaml provides a better way of implementing signals than uic does....
<yangsx> ocaml certainly shines here
<Smerdyakov> So it's up to you to demonstrate something uic does that isn't just a weakened version of an OCaml feature, if you believe this preprocessing stage is so important for Qt.
<yangsx> one signal might be connected to 1+ slots
<Smerdyakov> Obviously. That presents no problem.
<Smerdyakov> Do you understand my point? The entire reason that, to C++ programmers, it seems you need a fancy preprocessor for this is that C++ MAKES IT HARD TO MAINTAIN LISTS OF FUNCTIONS?
<Smerdyakov> The preprocessor is only implementing a subset of the features needed for standard closures.
<yangsx> what's your idea of implementing signal/slot in ocaml?
<Smerdyakov> I just showed you.
<Smerdyakov> self#add#connect("clicked()", self#addEntry)
<Smerdyakov> A "slot" is any function of the appropriate type to receive event data.
<Smerdyakov> A "signal" is associated with an object-local list of slots (functions), and each such object has a method that can be used to register new signals.
<yangsx> QT library aside, one needs implement "slot, signal, connect"
<Smerdyakov> Yup. I just showed you how.
<Smerdyakov> I'll also suggest that there is no good reason to enforce than "an OCaml Qt binding" uses the same functions as the original C++ version.
<Smerdyakov> What OCaml programmers want is code re-use; they want to use GUI widgets & such that are already developed, out there, and well-maintained.
<Smerdyakov> They couldn't care less about going down a check-list and making sure they can find "slot, signal, and connect."
* Smerdyakov leaves.
yangsx has quit ["using sirc version 2.211+KSIRC/1.3.11"]
budjet has joined #ocaml
vodka-goo has joined #ocaml
budjet has quit [Remote closed the connection]
pango has quit [Read error: 110 (Connection timed out)]
Zaius has quit [Read error: 110 (Connection timed out)]
_JusSx_ has quit ["leaving"]
_DL_ has joined #ocaml
_JusSx_ has joined #ocaml
__DL__ has quit [Read error: 110 (Connection timed out)]
budjet has joined #ocaml
pango has joined #ocaml
budjet has quit [Remote closed the connection]
Submarine has joined #ocaml
vezenchio has quit ["I live in a yurt on the steppes of Sheepfuckistan. That's why."]
budjet has joined #ocaml
budjet has quit [Remote closed the connection]
senko has quit [Read error: 104 (Connection reset by peer)]
mayhem has joined #ocaml
<mayhem> yop
<mflux> hm, ocamlprof cannot be used with -pp -flags?
Submarine has quit [Read error: 104 (Connection reset by peer)]
Skal has quit ["Client exiting"]
vodka-goo has quit []
CosmicRay has quit ["Client exiting"]
kinners has joined #ocaml
a-zwei has quit ["Leaving"]
smimou has quit ["?"]
yangsx has joined #ocaml
<yangsx> join #python
yangsx has left #ocaml []
gim has quit [Read error: 110 (Connection timed out)]