khaladan has quit [Read error: 104 (Connection reset by peer)]
serge has quit [Read error: 104 (Connection reset by peer)]
gim_ has quit []
<cratuki>
Is there an elegant way to turn a string containing a date into a calendar?
<cratuki>
(erk - wrong channel - sorry)
serge has joined #ocaml
<Smerdyakov>
You reveal your true colors.
<cratuki>
Smerdyakov: Heh. Java is a capable platform so long as you ignore the recommended usage :)
<Smerdyakov>
What's the recommended usage?
<cratuki>
J2EE (the worst of them? I think it's awful), javabeans, setters+getters. Also, I've never seen anyone else use anonymous classes to the extent that I do.
<cratuki>
It's far from perfect which is why I've been playing with ocaml at home. But I am still able to build powerful things with java.
<Smerdyakov>
Web applications?
<dylan>
cratuki: friend of mine had a program which used 35 anonymous classes.
<cratuki>
Smerdyakov: yup. I used to use webobjects, now cayenne, tapestry and a pattern fw I've written
<cratuki>
dylan: At some stage I'd like to use javacc to change the lang to make a nicer syntax for creating anon classes.
<dylan>
right after that he became a haskell programmer.
<Smerdyakov>
It just so happens that I am engaged in revolutionizing web application development these days. A peak at http://laconic.sf.net/demo/
<cratuki>
dylan: Right. I considered haskell but ocaml performance looked better when I was investigating and I like the fact that the libraries seem to install cleanly on lots of platforms (have had heaps of problems getting started with lisp in the past)
hikozaemon has joined #ocaml
<cratuki>
Smerdyakov: I am very interested in this sort of work, particularly in ocaml.
<Smerdyakov>
I'm developing a new programming language that has its basics in common with ML.
<cratuki>
Smerdyakov: However, in order to work in ocaml I would need a high-powered tempalting system and a high-powered ORM.
<Smerdyakov>
cratuki, ah, I think both of those conditions are mistakes. :)
<Smerdyakov>
cratuki, templates prevent you from reifying entire application pieces into single values.
<Smerdyakov>
cratuki, and OO is just crap.
<cratuki>
Smerdyakov: OK. Mistakes or .. different approaches to a good goal?
<Smerdyakov>
Decisions that decrease your productivity
<cratuki>
Smerdyakov: Depends on what you want out of an application. I have two on the go. One (which acts like an application and has no back button) does not need templates. But lacks the back button :)
<cratuki>
Smerdyakov: So far I have found templating the only way to a powerful solution where the back button still has value.
<Smerdyakov>
"Templating" only makes sense in languages so inexpressive that you can't write "templates" as regular old functions just as easily.
<cratuki>
Smerdyakov: Regarding OO, I cannot identify a better way of talking to a relational database than through a ORM like WO-EOF or Cayenne.
<Smerdyakov>
cratuki, you're serious? What about _SQL_?
<cratuki>
Smerdyakov: Yes, the HTML/CSS/Ajax mess sucks, but it's here to stay. Thus - need templates.
<Smerdyakov>
No, it isn't here to stay.
<Smerdyakov>
Lots of folks are developing new languages that _compile_ to that architecture, but require no day-to-day knowledge of it.
<cratuki>
Smerdyakov: SQL has a place. But an ORM allows you to easily construct object graphs in memory and save them later, even hierarchies of object graphs.
<cratuki>
Smerdyakov: I have not identified a way to do this while rolling your own SQL solutions.
<Smerdyakov>
cratuki, can you give a concrete example that you've run into?
<cratuki>
Smerdyakov: If there is a way I'd love to know it. But as far as I can tell EOF and Cayenne are miles ahead of anyone else in this sphere.
<cratuki>
Smerdyakov: Two users are working together to assemble a booking in a franchise operations centre.
<cratuki>
Each affects the booking in memory (and tables its related to - people in the booking, and person objects attached to those joins, and events the booking is for) across the course of several screens.
<cratuki>
In my arch, I build up a graph of objects using my ORM. Then when the user saves, I commit.
<Smerdyakov>
You save graphs on the server side across requests?
<cratuki>
If the user wants to save settings but not yet commit to the database - but allow the other user to see what they've done I can do that as well.
<cratuki>
Cascaded hierarchies. You just can't achieve that unless you write your own object graph. In which case I suspect you'll end up with an ORM much like the systems I use.
<cratuki>
Smerdyakov: I have an in-memory graph in the application server.
<cratuki>
It might be possible that there's a way to construct a graph that doesn't use OO. But it's getting down to semantics now. You still can't achieve these outcomes using roll-your-own SQL.
<cratuki>
At least - not that I know of and I've thought about it a fair bit.
<Smerdyakov>
You can use SQL transactions that span HTTP requests.
<Smerdyakov>
I think the OO view is crap, and you want to stay relational. Perhaps standard SQL doesn't allow it, but that doesn't mean that OO is the answer./
<cratuki>
Smerdyakov: OK - yes - that would work. There would be a lot of work to do writing a framework to make that as capable as the leading ORMs though.
<Smerdyakov>
cratuki, a "framework"? You program directly in SQL....
<cratuki>
Smerdyakov: OO view where 'view' means a data view? or OO as in - that approach to programming?
<Smerdyakov>
OO as in "object oriented" anything.
<cratuki>
Smerdyakov: But if you program directly in SQL and then need to refactor you have to make heaps of changes to SQL. Whereas in my system if I do a major refactor I can just twiddle objects in my glue layer.
<Smerdyakov>
My vision for Laconic is that most code, SQL included, is generated by meta-programming, so that your concern disappears.
<cratuki>
Smerdyakov: OK. That could be promising then.
<cratuki>
I'll check out your webpage and try to contact you, maybe this wekend although I'm busy.
<cratuki>
Unfortunately I am only learning ocaml and am not useful in it yet so I would be of limited use to you at least atm. Do you have a project plan?
<cratuki>
:s/ocaml/ml/
<Smerdyakov>
First, it's implemented in Standard ML, not OCaml.
<cratuki>
heh
<cratuki>
Smerdyakov: Problem with reimplementing is that you lose the fantastic libraries and performance of ocaml. Is there no way to do it within ocaml?
<Smerdyakov>
No.
<Smerdyakov>
Chances are that you can't help unless you have experience with interactive theorem proving and higher-order logic.
<cratuki>
Mm. In the lisp world every man and his dog has an implementation and none of the tools or libraries cross over. :(
<cratuki>
Smerdyakov: I don't recognise those words and thus don't know if I have experience with them :)
<cratuki>
Still - thanks for the link
<Smerdyakov>
You probably don't. Mostly only PhD candidates in CS or math and their later incarnations do. :)
* cratuki
shrugs
<cratuki>
I was never much of a student. :)
<Smerdyakov>
It just turns out that ideas from the foundations of math are really useful in programming languages.
<cratuki>
Interesting. I'm at the exact polar opposite - I have limited ability to innovate and look to make quick gains on what's available now. Hence the use of java :)
<Smerdyakov>
Metaprograms are complicated enough that you need what smells like "theorem proving" to check that they do what you want them to do.
<dylan>
hmm, "is there no way to do it within ocaml?" "No" is ambigous in English.
<cratuki>
Smerdyakov: For application programming the idea of that scares me, because things need to be maintainable.
<Smerdyakov>
Right. We've come a long wide in automated theorem proving.
<Smerdyakov>
s/wide/way
<Smerdyakov>
I have a stratified approach where almost everything is automated.
Smerdyakov has quit ["BRB -- rebooto"]
Smerdyakov has joined #ocaml
<dylan>
kernel upgrade?
<Smerdyakov>
Trying to get USB digital camera to mount with right permissions, and I'm too Linux-newbie to know how to do that without rebooting (or maybe even with!).
<dylan>
it really depends on what your kernel version is. :-/
khaladan has joined #ocaml
<Smerdyakov>
Still haven't been able to get gphoto2 working as non-root.
<dylan>
I don't know in new udev kernels, but before I just made it so I owned all the USB devices.
<Smerdyakov>
It's kind of ridiculous if I need to read a page like that to get this working.
<ketty>
well.. you could also use gnome and automatic mounting ;)
* dylan
pictures a gnome automatically mounting Smerdyakov...
<ketty>
:)
bzzbzz has quit ["leaving"]
<cyyoung>
so i have list A and list B of different lengths (and types), and want to create a "product" list C consisting of each pair (a,b) of an a drawn from b
<cyyoung>
there does not appear to be a standard library function to do this -- am i missing this?
<pango>
which in turn can be written as let list_product l1 l2 = List.fold_left (fun acc e1 -> List.fold_left (fun acc e2 -> (e1, e2) :: acc) acc l2) [] l1
khaladan_ has joined #ocaml
khaladan_ has quit [Read error: 104 (Connection reset by peer)]
ski has quit [Read error: 104 (Connection reset by peer)]
ski has joined #ocaml
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
pango is now known as pangoafk
_jol_ has joined #ocaml
khaladan has quit [Success]
pangoafk is now known as pango
<_jol_>
hello
<_jol_>
i've problems getting streams to work
<_jol_>
[< leads to syntax error....
<_jol_>
any ideas ?
<ulfdoz>
even no experience...
<flux__>
-pp camlp4o?
<_jol_>
ok, now it works. thanks
<_jol_>
what if i want to use stream in the ocaml toplevel ?
<flux__>
I can't remember that off-hand, but I imagine it requires you to build your own toplevel with ocamlmktop
<flux__>
the documentation might tell you how to do that, though
<_jol_>
ok. thanks for your answers.
<flux__>
actually, the documentation suggests another way
<flux__>
#load "camlp4o.cma";;
<flux__>
ocamlmktop -o footop /usr/.../camlp4o.cma works too, though
<flux__>
hm, and that can be shortened to ocamlmktop -o footop camlp4o/camlp4o.cma
dark_light has quit [Remote closed the connection]
multani has joined #ocaml
ppsmimou has quit ["Leaving"]
szymzet has joined #ocaml
<szymzet>
Is there an ocaml library for manipulating images AND optimizing them for web?
<flux__>
you might want to check out the imagemagick bindings for ocaml
<flux__>
otherwise, none that I've heard of. there's another graphic manipulation library around, though, but I imagine imagemagick is more suitable for your purposes.
<flux__>
I can't immediately recall the other library's name, though
<szymzet>
And 2. question. Can I distibute programs using lablgtk without the need to install GTK library (windows)?
<flux__>
I don't know
<flux__>
my guess is no
<flux__>
(well, assumption)
<flux__>
but I guess it is not difficult to provide an installer for windows. I've come to understand that's the way of things are done in windows ;)
<szymzet>
Thanks.
Bigb[a]ng is now known as Bigbang
<multani>
i've got a question regarding lists : a 'polymorphic list' in Ocaml means a list which can stored any kind of datas ?
<flux__>
sort of, yes, but they all need to be of the same type.
<ski>
correct terminology : 'list' is a 'parametric datatype'
<ski>
(functions (and other values) can be polymorphic, types can't)
<multani>
ok, i got it
<ski>
but, it's very common to use polymorphic functions (/values) with parametric datatypes
<ski>
so they're closely related
<multani>
like 'List.hd' for ex. ?
<ski>
yes
<ski>
or 'List.rev', etc
<multani>
ok :)
<ski>
also '[]' and 'fun x xs -> x :: xs' is polymorphic
<ski>
(first being an example of a polymorphic non-function)
smimou has joined #ocaml
<multani>
ok, so I have another question regarding 'collections'
<multani>
my application creates object from classes a, b, c, etc., and I have to put those objects into some kind of 'list'
<multani>
if I use the built-in list of Ocaml, I need to cast all my object into an instance of class a
<multani>
but after that, I can't use the methods which are not in 'A'
<multani>
even if the object was, initially, an instance of class C
<multani>
see the problem ?
<ski>
isn't the usual OO idea here to let the objects themselves do whatever they should do, instead of trying to check what actual class an object was instantiated from ?
<ski>
down-casting isn't possible in OCaml (by design)
<ski>
(i.e. i believe an OO slogan appropriate here is something like "don't case/switch, let the object itself decide what to do")
<ski>
otoh, if you don't need to use classes, you could consider using plain variant types (which can be matched upon)
<multani>
i agree, but with list, it seems not possible (since as you said, down-casting is not possible)
szymzet has quit ["Leaving"]
<multani>
is there any 'collection' type which can be used to do what i want ?
<flux__>
there are some ways to cast data back, the most secure method is to have a hashtbl from downcasted type to the original type
<flux__>
however, it is advisable to reconsider the design..
<flux__>
you may find examples from the net (google maybe, caml weekly might be of special interest to you)
<ski>
flux__ : hm, didn't know that .. is that potentially unsafe ?
<ski>
multani : i assume this doesn't suffice ?
<ski>
# type foobar = Foo of int | Bar of bool;;
<ski>
type foobar = Foo of int | Bar of bool
<ski>
# [Foo 1,Bar false];;
<ski>
- : (foobar * foobar) list = [(Foo 1, Bar false)]
<multani>
well, in reality, my class are much more complex than my small example, so, it's not really a solution
<ski>
argh mea culpa
<flux__>
ski, no, obviously Hashtbl is ok, but you need a hashtbl
<ski>
# [Foo 1;Bar false];;
<ski>
- : foobar list = [Foo 1; Bar false]
<ski>
(i meant, of course)
<flux__>
(what I meant that: it may feel like stupid to have a hashtbl for just satisfying the compiler ;))
<flux__>
but, maybe it will make you feel more safer too, who knows ;)
<multani>
flux__, completely :)
<flux__>
if you really, really really, need to do a cast, I believe Obj.magic works. however, it might not. it did work, however, in my extremely simple and limited test case.
<flux__>
I would seriously consider using Hashtbl instead. or better, rework the design :).
<multani>
flux__, what do you propose about the design ?
<multani>
the only thing which miss from my example on pastebin, is another class, which stores instance of A, B or C (in some kind of list)
<flux__>
well, it's hard to say without knowing what is the goal
<flux__>
surely it's not like the problem can be solved _only_ with that kind of class hierarchy :)
<pango>
nor that a hierachy is needed at all, from what I understand
<ski>
hm .. i've made an ocaml toplevel here, which when i try to run it complain about not finding a shared library (which i have right here) ..
<ski>
can i tell the toplevel to use that one somehow ? or must it be installed in some location ? or maybe the toplevel is constructed wrongly ?
<multani>
i think it's a rather 'common' problem to store a collection of objects, without sacrificing what can you do with those objects (when retrieving them)
<multani>
(maybe i'm wrong)
<ski>
it arguably goes against the spirit of OO, i think
<creichen>
multani: (a) What do you want to do with the objects after you retrieve them? (b) Why are you putting them into a list?
<multani>
creichen, i want to use methods which are available on the object (not just those which are available on the top-parent)
<multani>
and i'm putting them in a list, since i thought it was the simplest way of storing them, but currently, it's a problem
<pango>
multani: ocaml OO is structural
<pango>
multani: you don't need a parent class for that
<creichen>
What is the meaning of that list within your system? (I assume it's something more concrete than "the list of all objets I happen to have created")
<creichen>
The list of all plugins you have loaded? The list of all widgets underneath the present widget? The list of all I/O thingies you're dispatching into?
<multani>
creichen, my objects are figures (points, segments, polygons), and i want to store all the figure I created
<multani>
pango, so, what do i need ? (or need to do)
<pango>
# let store_all l = List.iter (fun o -> o#store) l ;;
<pango>
val store_all : < store : unit; .. > list -> unit = <fun>
<creichen>
multani: OK; so common functionality is operations such as "redraw", "get bounds", "get colour" etc.? And you want to retrieve objects later on so that you can change object-specific parameters (circle radius etc.)?
<creichen>
s/object-specific/type-specific/
<multani>
creichen, absolutely
<pango>
store_all takes any list of objects that have a method called "store"
<creichen>
multani: In that case, there are more elegant solutions anyway. For example, let's assume that your objects can be parameterised by two kinds of data: strings (as for text strings or font specs or whatever) and ints (radius etc); the idea generalises.
<creichen>
Now I'm going to write this in SML syntax since I forgot what the O'Caml syntax is, please forgive me (it's probably going to be similar):
<creichen>
type 'a property = { get : unit -> 'a; set : 'a -> unit; description : string };
<creichen>
datatype real_property = INTPROP of int property | STRPROP of string property;
<creichen>
and add a field "properties : real_property list" to your object types.
<creichen>
This also allows you to unify the property modification code more easily, I'd guess...
<creichen>
You can also do away with the type parametrism there and always use strings, if you add error checking (particularly useful if it's only going to be used interactively anyway)
<creichen>
multani: That's an initial suggestion. Obviously I don't understand the specific program you're writing not even remotely as well as you do, so my suggestion may not be applicable or may require some refinement...
<multani>
creichen, if i am correct, you propose me to add all the attributes (or properties) of the classes into a list a attributes (or properties) ?
<creichen>
Right. It seems to me that this might also allow you to simplify the code that uses these attributes...
szloto has joined #ocaml
serge has quit [Read error: 104 (Connection reset by peer)]
Narrenschiff has joined #ocaml
Narrenschiff has quit ["Leaving"]
hikozaemon has quit ["Leaving..."]
<metaperl>
ketty, ping?
Smerdyakov has joined #ocaml
finelemo1 has joined #ocaml
finelemo2 has joined #ocaml
bzzbzz has joined #ocaml
finelemon has quit [Read error: 110 (Connection timed out)]
finelemo1 has quit [Read error: 110 (Connection timed out)]
chessguy has joined #ocaml
<ketty>
metaperl: ....
<metaperl>
ketty, hi
<metaperl>
quick question
<ketty>
yes?
<metaperl>
I remember you mentioned that you disliked the imperative features of Ocaml... correct?
<ketty>
yes :)
<metaperl>
ok, so why don't you use Haskell so there is no concept of imperative at all?
<ketty>
because i haven't gotten around to learning it yet...
<ketty>
it will probably be the next language i learn :)
<ketty>
i want to learn all languages anyway :)
<Smerdyakov>
Coq! Coq! Coq!
<ketty>
Smerdyakov: hm?
<Smerdyakov>
ketty, what hm?
<ketty>
Smerdyakov: why "Coq! Coq! Coq!" ? ^^
<Smerdyakov>
Because Coq has the ingredients of programming languages of the future
<ketty>
ok ^^
<dylan>
He has a fetish for roosters?
<Smerdyakov>
I have a fetish for making French people wear silly hats.
<dylan>
It seems haskellians have a different focus than ocamlers.
<metaperl>
it's too late. once a language makes inroads into corporate america like Ocaml has, it will only grow in dominance. Dominance of popularity. Not necessarily correctness or quality. But you can't argue with the blinding fast speed of Ocaml
<Smerdyakov>
If you think Haskell is "pure," wait till you see Coq.
<Smerdyakov>
No non-termination allowed in Coq.
<dylan>
heh, an escape from the turing tar-pit.
<dylan>
Smerdyakov: Is your first language something other than English? You use double negatives in very interesting ways. :)
<Smerdyakov>
No. I think that is a reasonable use of a double-negative, since I wanted to stress the absence of a capability found in most PLs.
<dylan>
Of course. It just reminds me more of someone who's mother tongue is Spanish.
* dylan
is fascinated by language, if you couldn't guess.
khaladan has joined #ocaml
<metaperl>
I wrote this post to address the pitfalls of intellectually correct languages: "pumping out the functionality: language and community quality versus productivity" -> http://sequence.complete.org/node/40
<Smerdyakov>
So am I. I like to be novel in my usage, while remaining strictly correct. :)
<dylan>
I do not care much for correctness, as long as I can be understood.
<dylan>
I wrote a summary of a LUG meeting in Scots once, for example.
<Smerdyakov>
metaperl, since you have just quoted from a web site and not stated a conclusion, I can't really argue with you, but I suspect that you have become confused.
<dylan>
the COQ group is now known as the LOGICAL group, perhaps.
<dylan>
(it being a group of people in INRIA)
khaladan has quit [Read error: 104 (Connection reset by peer)]
chessguy2 has joined #ocaml
Sir_Diddymus has quit [Read error: 110 (Connection timed out)]
chessguy has quit [Connection timed out]
_jol_ has joined #ocaml
pango is now known as pangoafk
chessguy2 has quit [Connection timed out]
pangoafk is now known as pango
bzzbzz has quit ["leaving"]
bzzbzz has joined #ocaml
_jol_ has quit ["leaving"]
chessguy has joined #ocaml
AOXIIBOO has joined #ocaml
finelemon has joined #ocaml
khaladan has joined #ocaml
_jol_ has joined #ocaml
finelemo1 has joined #ocaml
vincenz has quit ["leaving"]
AOXIIBOO has quit ["Quitte"]
finelemo2 has quit [Read error: 110 (Connection timed out)]
AOXIIBOO has joined #ocaml
shawn_ has quit ["This computer has gone to sleep"]
multani has quit ["Parti"]
AOXIIBOO has quit ["Quitte"]
finelemon has quit [Read error: 110 (Connection timed out)]
ramza3 has joined #ocaml
ramza3 has left #ocaml []
_jol_ has quit ["leaving"]
Oatmeat|umn has quit ["Leaving"]
chessguy2 has joined #ocaml
chessguy2 has quit [Client Quit]
chessguy has quit [Connection timed out]
shawn has joined #ocaml
<mikeX>
is there a correct way to do this: match tupple with Value1 as v1, Value2 as v2 -> ...
shawn has quit ["This computer has gone to sleep"]
<mikeX>
I want v2 to refer to Value2 not the whole tupple
<ketty>
is Value1 and 2 variant types?
<mikeX>
yeas
<mikeX>
yes
<ketty>
Value1 v1, Value2 v2 -> ...
<mikeX>
ketty: type t = Value1 | Value2
<ketty>
oh...
<mikeX>
I'm just trying ot name the tupple products, not access their whatever they are called
<ketty>
you want v1 to allways be Value1, and v2 to allways be Value2?
<ketty>
i am a bit confused O_o
<mikeX>
my fault, I'll try to explain
AOXIIBOO has joined #ocaml
<Smerdyakov>
mikeX, I think you just need to understand order of operations and use parentheses where needed.
AOXIIBOO has left #ocaml []
<mikeX>
hhmm, I tried using parentheses, but got a syntax error, now it works, I guess I was using them wrong :)
<mikeX>
works now thanks Smerdyakov
<mikeX>
ketty: match tupple with (Value1 as v1), (Value2 as v2) -> do something with v1 and v2 ..
<mikeX>
that's what I wanted
<ketty>
ok
<ketty>
weird :)
<mikeX>
indeed :)
Submarine has joined #ocaml
<Submarine>
# 1 lsr 64;;
<Submarine>
- : int = 1
shawn has joined #ocaml
<pango>
The result is unspecified if [m < 0] or [m >= bitsize]. *)
<Submarine>
yes
<Submarine>
I think it's the Intel CPU that does this anyway.
<Submarine>
I spent maybe 2 hours getting to that!
<pango>
good to know
shawn has quit ["This computer has gone to sleep"]
Submarine has quit ["Leaving"]
ngw has joined #ocaml
<ngw>
hi *
<smimou>
hi
<ketty>
hello
<ngw>
is there a cocoa binding for ocaml ?
<ngw>
hi :)
<smimou>
there seems to be a library in alpha state