<Smerdyakov>
DRMacIver, what deficiency do you have in mind?
<DRMacIver>
Well I've since been pointed out the reasoning behind both, which makes me less irked with them. :)
<DRMacIver>
Oh, I only mentioned one here.
<DRMacIver>
Anyway, I'm bothered by not being able to do things like match foo (x, x)
<DRMacIver>
(Where foo is a constructor)
<Smerdyakov>
I don't understand... that is a legal prefix of an OCaml expression.
<Smerdyakov>
Except that constructors must be uppercased.
<Smerdyakov>
Oh, I see. Nonlinear patterns.
<Smerdyakov>
Never mind.
<DRMacIver>
Yeah
<DRMacIver>
Sorry, I've been writing ML so my habits are a little out of synch.
<Smerdyakov>
Pattern matching is the fundamental elimination operation on algebraic datatypes. Other features like you ask for are nice, but they can be compiled into uses of existing features.
<DRMacIver>
They can, but the number of times in which their presence would have slashed the amount of code I was writing this evening was starting to bug me. :)
<DRMacIver>
(I'm doing reduction on an algebraic datatype with a really silly number of reduction rules)
<pango>
you can use guards, even if it's not as pretty
<DRMacIver>
Hm. Suppose I have some algebraic datatype. Is there any nice way to perform reductions on it?
<DRMacIver>
(e.g. my datatype has a Max : Foo list -> Foo) constructor which I want to flatten so that Max [ Max[a, b], c ] = Max [a, b, c] )
<DRMacIver>
Obviously I can just do huge chunks of pattern matching for a 'reduce' function to get it into some standard form, but this is kindof tedious and I was hoping there was a better way. :)
<pango>
doesn't need to be that huge, if that's all what it does...
<DRMacIver>
pango: Well, no. That's one of about fifteen things it does. :)
<DRMacIver>
Possibly more.
<DRMacIver>
That particular one is easy of course.
<pango>
wishing for a dwim : 'a -> 'a function then ;)
<DRMacIver>
Basically. :)
<DRMacIver>
But not really. I guess what I'm basically wishing for is a Reduce function which takes a bunch of reduction rules.
<DRMacIver>
But actually I guess that's easy to write.
<wkh>
buh
<DRMacIver>
(If you know any set theory, I'm trying to write a datatype to implement cardinal arithmetic for infinite cardinals. It's proving a bit fiddly. :) )
<DRMacIver>
And currently I can't even implement things like Aleph_omega ...
love-pingoo has joined #ocaml
<pango>
I wonder if there's such lib already....
<DRMacIver>
I doubt it
<pango>
for rewritting, I mean
<DRMacIver>
Oh, right.
<DRMacIver>
Maybe. I should do some googling.
<DRMacIver>
I've already had one instance where I've started writing my own crappy implementations only to realise it was handled by the course List libraries. :)
shawn has quit ["This computer has gone to sleep"]
<DRMacIver>
Hm. Actuall I lie.
<DRMacIver>
Writing a general Reduce function isn't only not easy, it's not possible.
<DRMacIver>
Because not all my constructors take the same number of arguments.
<DRMacIver>
Some are unary, some take list arguments, etc.
zak_ has joined #ocaml
<zak_>
how do i compile an ocamlsdl program? i saw a makefile which appears to depend on another makefile which i can't find, so it didn't really explain it to me... what must i put on the command line?
<DRMacIver>
That looks nice. But ideally I'd like a way to implement this in straight OCaml
<DRMacIver>
As believe it or not I actually have a practical use for it (for some value of practical...), and want to be able to interface with a bunch of libraries, etc.
<DRMacIver>
(In particular it needs to be able to talk to a database and pass text output to a file.)
<DRMacIver>
Hm
<DRMacIver>
I'm not actually sure that does anything OCaml can't anyway. The examples look like it's just a fractionally better substitute for matching based on constructors.
zooko has joined #ocaml
<pango>
DRMacIver: I also wonder if Coq could have helped you, since I've heard it can generate Ocaml code. I'm sure Smerdyakov, or another Coq user, could give you more details...
<pango>
but that means rethinking your rewrite process in terms of constructive logic
<DRMacIver>
Hm. Rethinking it in terms of constructive logic is probably doable.
<DRMacIver>
I'll take a look. Thanks.
<DRMacIver>
Hm. Actually my 'reduce' solution will work after all. Duh. The reduction rules do all have the same type. They're functions f : Cardinal -> Cardinal
_jol_ has joined #ocaml
<pango>
different types would not have been unsolvable either - just a set of cross-recursive functions
<zak__>
i understand that dynamic linking is possible, but is it likely to be supported, documented and tested some time soon?
dibblego has joined #ocaml
dibblego has quit ["Leaving"]
love-pingoo has joined #ocaml
love-pingoo has left #ocaml []
dbaelde_ has joined #ocaml
dbaelde_ has quit [Client Quit]
love-pingoo has joined #ocaml
smimou has joined #ocaml
chessguy has joined #ocaml
chessguy2 has joined #ocaml
chessguy has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Leaving"]
chessguy2 is now known as chessguy
zmdkrbou has quit ["brb"]
oracle1 has quit [Read error: 60 (Operation timed out)]
zmdkrbou has joined #ocaml
beschmi has joined #ocaml
zak__ has quit [Read error: 104 (Connection reset by peer)]
<DRMacIver>
Hm
<DRMacIver>
I hadn't noticed before that OCaml treats everything beginning with a capital letter as if it were a constructor
<DRMacIver>
I'm not sure I like that
<pango>
or a module name
<DRMacIver>
Ah, true.
<DRMacIver>
Anyway, the point being that I cant declare functions whose names begin with capitals.
<DRMacIver>
Which is fine. I wouldn't do that anyway. But the fact that I can't is vaguely irksome. :)
Smerdyakov has joined #ocaml
_jol_ has joined #ocaml
<ayrnieu>
you'll get over it.
_jol_ has quit [Client Quit]
mikeX has joined #ocaml
<DRMacIver>
ayrnieu: Probably. But it's the latest on a pile of growing general disatisfaction with the look and feel of the ocaml syntax. :-/
<zvrba>
yeah. i wonder why did they had to change the SML syntax so much
<zvrba>
SML's syntax I actually like
<zvrba>
but ocaml has amuch larger standard library :(
<ayrnieu>
Without checking wikipedia, I doubt that that "they took SML and then changed it" accurately reflects how the syntax arised.
<zvrba>
maps, hashes, etc..
<ayrnieu>
DRMacIver - ignore the pile. You can recreate it if you want to write about it.
<Smerdyakov>
zvrba, the serious SML compilers have the SML/NJ library, which is superior to the OCaml standard library when considered in combination with the SML Standard Basis.
<Smerdyakov>
For instance, absolutely fantastic support for pretty-printing HTML documentation.
<zvrba>
Smerdyakov: but the thing is incompletely documented
<zvrba>
i had to trawl the source to discover hash tables >:
<ayrnieu>
zvrba - and then you didn't document them? For shame!
<Smerdyakov>
zvrba, reading signature files is the best way to learn libraries, anyway. :)
<zvrba>
heh :)
<Smerdyakov>
(That's how I learned the parts I needed of the pretty-printing and HTML libraries.)
<Smerdyakov>
And they aren't even commented.... imagine learning a Java library that way!!
<zvrba>
ugh. no-go.
<Smerdyakov>
Or, God forbid, a C library. I spent a day trying to figure out how to use OpenSSL via SML.
<zvrba>
i can't find my way around java even with documentation
<DRMacIver>
ayrnieu: Are you seriously proposing "If you don't like feature X of this language, go write your own" as a reason not to observe that a language has issues?
<Smerdyakov>
At least OpenSSL has things linearly in header files, instead of spread across 100 tiny .java files.
<zvrba>
DRMacIver: maybe he was suggesting camlp4 :)
<zvrba>
anyway, food time
<ayrnieu>
DRMacIver - I so utterly and completely and obviously did not suggest such that you've gone from 'zero' to 'hate' in my estimation.
<DRMacIver>
ayrnieu: Ok. Then I apologise. Could you clarify your "You can recreate it if you want to write about it." comment then, as in that case I have no idea what you mean by it.
<ayrnieu>
You have assumed a value of 'it', which I have indicated is very, very wrong. Backtrack and try another value.
<DRMacIver>
Nope. Can't be bothered. I'm sufficiently annoyed by you now that I don't really care what you mean.
<ayrnieu>
Fuck off, them :D
zooko has left #ocaml []
<ayrnieu>
When the correct value of 'it' immediately precedes the uses of 'it', as within normal English usage, I've no sympathy for your desire for outrage.
<DRMacIver>
Given that 'the pile' being referred to is a large portion of the syntax of OCaml, my reading of 'recreate it' is a perfectly reasonable one.
<Smerdyakov>
Oh, good. We were overdue for a battle royale in #ocaml.
<DRMacIver>
Smerdyakov: Sorry to disappoint, but you're not going to get it. :)
<ayrnieu>
Smerdyakov - oh, go away. You probably vultured around loud discussions in school and then called them 'fights', too.
<Smerdyakov>
ayrnieu, that would have involved talking to people.
<ayrnieu>
DRMacIver - by 'the pile', I mean the fingers and not the moons :-)
<ayrnieu>
hm, and then you yourself described it as a 'pile of disatisfaction'.
<DRMacIver>
I do beg your pardon. So I did. Somehow I'd mentally reparsed that as my having said 'pile of dissatisfactory features'
<DRMacIver>
I still don't know what you're suggesting I do, but I can see why you were irritated by my interpretation now. :)
<ayrnieu>
:-) I suggest that you, having identified some syntax as disatisfactory, don't actively maintain it in a pile of such. If you carry on with the language and don't keep reminding yourself that parts of it bother you, you may find that they become familiar and no longer bother you. Also, if you still want to create a large "Why O'Caml Has Sucky Syntax" article, you can re-identify your pile at that time: you won't b
<ayrnieu>
e harmed by forgetting about it for a while.
<DRMacIver>
Ah. Right.
<zvrba>
back.
<DRMacIver>
It's not so much that I deliberately maintain a pile as that there are a number of features I keep running into and thinking "Grmph. SML did this better." :)
<zvrba>
Smerdyakov: my annoying problem with SML is figuring out how to link in something not already linked in runtime
* ayrnieu
did pretty much the same thing in the other direction.
<zvrba>
and CM seems mistifying
<Smerdyakov>
zvrba, it's pretty easy.
<zvrba>
arnieu: you mean ocaml->sml ?
<ayrnieu>
zvrba - aye.
<zvrba>
ayrnieu: well, I first tried Ocaml, then SML. and figured out that SML has much nicer syntax
<zvrba>
Smerdyakov: it is, but not in a very friendly (howto) way
<zvrba>
Smerdyakov: ok, let's say that I write myutils.sml containing several different structures.
<zvrba>
and functors
<zvrba>
how do I make it visible to the top-level interpreter?
<Smerdyakov>
'#use "myutils.cml";' or include the filename in your .cm file.
<DRMacIver>
Hm. Speaking of documentation, the PostGreSQL libraries make me cry. :(
<Smerdyakov>
DRMacIver, OCaml's, you mean?
<DRMacIver>
Yeah
<DRMacIver>
The entire thing is in two files. One of OCaml, one of C. No documentation. Minimal comments.
<Smerdyakov>
I like mine better. :)
<DRMacIver>
Hm?
<DRMacIver>
Written your own?
<Smerdyakov>
I just gave a link to the web CVS.
<Smerdyakov>
For SML
<DRMacIver>
Ah
<DRMacIver>
They don't seem to have much better documentation. :)
<flux__>
drmaciver, actually the .mli is quite descriptive
<Smerdyakov>
Perhaps you're looking at the directory. Move one up from the one whose link I gave.
<flux__>
drmaciver, atleast if you've ever interfaced with postgresql earlier
<Smerdyakov>
s/the directory/the wrong directory
<Smerdyakov>
I claim that my SML interface is understandable with no prior use of libpq.
<flux__>
and its usage of the expect-argument is great
<DRMacIver>
flux__: Oh. So it is. :)
_JusSx_ has joined #ocaml
<zvrba>
.. and printf for sml someone referred me to didn't work >:
<flux__>
well, I've used libpq earlier, so I cannot give an opinion on how such a library would be to learn without having done so ;)
<flux__>
drmaciver, you're saying you didn't notice before?-)
<zvrba>
it's so awkward to format output in sml >:
<DRMacIver>
flux__: I seem to have just looked at the .ml and the .c. Whoops.
* DRMacIver
looks embarassed
<DRMacIver>
The .mli still isn't great though. And I really wish there was actual documentation. I suppose I should demand my money back or something. :)
<Smerdyakov>
If you don't think a signature file is documentation, then you shouldn't be using ML>
<flux__>
smerdyakov, hm, I guess it is arguable whether it is documentation or not.. for instance, it can never be wrong, whereas normal documentation can, and usually is ;)
<Smerdyakov>
DRMacIver, then you must be an ML novice, or not know SQL and its standard modes of usage.
<flux__>
anyway, even if the .mli gives you everything, there's still more to it
<flux__>
I didn't figure out how to effectively use the Event-module before seeing a simple example
<DRMacIver>
Smerdyakov: Or possibly just have different opinions about how things should be documented than you do?
<DRMacIver>
Nah, what am I talking about? That couldn't happen.
<Smerdyakov>
Sorry, I don't accept that that applies here.
<DRMacIver>
I noticed.
<DRMacIver>
As it happens I *am* an OCaml novice. I used to code SML a while ago, but most of that was done in isolation without having to rely on other peoples code (except for the MosML standard libraries, which were much better commented than these)
<Smerdyakov>
The level of documentation you're asking for would make these libraries _harder_ to use for ML experts.
<Smerdyakov>
Since the redundant text would take up space and make it harder to find what matters.
<flux__>
smerdyakov, in my opinion it is difficult to make a say that more (correct) documentation is somehow worse or even equal to having only the interface description. it is obviously up to the end user to decide whether to refer to it or not.
<DRMacIver>
I don't think this is going to be a useful conversation :)
<flux__>
and for example, ocaml comes with module Lexing, which I think well deservers actual documentation
<Smerdyakov>
The version I gave is shorter and nicer.
<zvrba>
yeah :)
<zvrba>
bbl
Wild_Cat has quit []
mikeX has quit ["leaving"]
Carillon has joined #ocaml
Carillon_ has quit [Connection timed out]
f78 has joined #ocaml
Snark has quit ["Leaving"]
_velco has quit ["I'm outta here ..."]
smimou has quit [Read error: 104 (Connection reset by peer)]
smimou has joined #ocaml
gmh33 has joined #ocaml
descender has quit [Remote closed the connection]
descender has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
_JusSx_ has quit ["leaving"]
d-bug has quit [Client Quit]
Wild_Cat has joined #ocaml
<gmh33>
does ocaml use lazy functions?
<zmdkrbou>
it has a lazy keyword
<gmh33>
does that make a function lazy ?
<gmh33>
sorry I'm trying to compare OCaml and Haskell
<gmh33>
I like haskell's lazy evaluation for making things simpler
<zmdkrbou>
there's a big difference : haskell *is* lazy, ocaml is not
<zmdkrbou>
though you can use this "lazy" keyword to make things lazy
<gmh33>
ooo
<gmh33>
making infinite lists and stuff is easier with lazy evaluation
<gmh33>
and possible
<zmdkrbou>
mmmh i don't think you can have infinite data structures in ocaml, even with the lazy thing
<ayrnieu>
gmh - it's possible even without lazy evaluation, but sure.
<pango>
sure you can
<gmh33>
it's excessively easy with lazy evaluation
<ayrnieu>
gmh - yes, this is obvious.
<gmh33>
I always seem to state that don't I =/
<pango>
it's also obvious that lazy evaluation is more natural in lazy languages ;)
<gmh33>
yyyyep
<gmh33>
;P
<pango>
# let x = lazy (3 * 3) ;;
<pango>
val x : int lazy_t = <lazy>
<pango>
# Lazy.force x ;;
<pango>
- : int = 9
<pango>
that's the basic mecanism of lazy values in ocaml
<gmh33>
cool :)
<gmh33>
Haskell is really interesting but it takes a while to actually learn how to do anything useful with the language
<gmh33>
and I just started browsing around OCaml
<gmh33>
OCaml seems to encompass quite a lot of programming paradigms
<gmh33>
if I even spelt that correctly
<ayrnieu>
Most languages do :-)
<gmh33>
except languages like Haskell :P
<gmh33>
which isn't a bad thing, just there's a lot of explaination that goes into teaching how to use it
<ayrnieu>
no, even Haskell.
smimou has quit ["bli"]
<gmh33>
well they just use complex mathematical theory to claim pureness of paradigm
<ayrnieu>
part of thinking otherwise might come from unfamiliarity with impressive GHC extensions like Concurrent Haskell, or from coarse atomization of Haskell features (this really cool type system and these monads and all these weird arrows and such are all just 'functional', right?), and from the superpopularity of very specific 'paradigms' in very specific contexts -- like object-oriented programming, which you *obviously
<ayrnieu>
* can't do in, say, C.
<ayrnieu>
they like to be purely-functional; they don't claim 'pureness of paradigmn'.
<gmh33>
sorry, I'm using that word incorrectly
<gmh33>
both OCaml and Haskell are very interesting langauges :)
<gmh33>
I think I'll be looking into OCaml more :D
<Smerdyakov>
Ahem. Coq is way cooler than Haskell in that regard. :P
<gmh33>
Smerdyakov: ?
<Smerdyakov>
gmh33, ?
<gmh33>
(that last statement confused me) lol
<gmh33>
though a quick googling makes me slighly less confused