Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
cadabra has joined #ocaml
cadabra has left #ocaml []
<jdrake>
Does Ocaml accept greek letters in source?
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
<thelema>
jdev: anything in latin-1
<jdrake>
hmm
<jdrake>
I am rather surprised that in this day and age we don't have ubiquitous unicode.
<thelema>
text encodings are much more difficult and complicated than I expected.
<jdrake>
When I do this: type scene = None | Circle of float * float;; Circle (3.4, 3.5);; and get back this: - : scene = Circle (3.4, 3.5) what precisely is it saying 'scene' is? I understand that Circle is a constructor (hense capital).
<thelema>
- [has type] scene [and equals] Circle (3.4,3.5)
<jdrake>
So it is only type constructors that have capitals?
<thelema>
no, module names too. There's a list in the reference manual
<thelema>
Constructors, Variant tags, Exceptions and Modules are uppercase, everything else lower
<thelema>
(well, module types can be upper or lower)
middayc has quit []
<thelema>
(and the current implementation accepts lowercase variant tags, but...)
<jdrake>
variant tags?
thermoplyae has quit ["daddy's in space"]
<thelema>
yes, you just called them "Constructors", but variant types are tagged, and the names of the constructors are the tags.
<thelema>
err, n/m
<thelema>
Variant tags -> polymorphic variants.
<jdrake>
I am looking to make a type that can represent a collection of geometric shapes
<thelema>
will a list work?
<thelema>
type shape = Circle ... | Square ... | ...
<thelema>
type scene = shape list
<jdrake>
actually a listis what I had in mind
<jdrake>
Eventually it would be useful to have it recursive
<thelema>
type shape = Circle ... | Square ... | Scene of scene and scene = shape list
<thelema>
type scene = Circle ... | Square ... | Scene of scene list
Kopophex has quit [Read error: 110 (Connection timed out)]
<jdrake>
ok, I think I will copy it and save it in a comment and start out with the basic scene and circle
<jdrake>
I am trying to go on some knowledge I had before, so I best be referencing a few things.
<jdrake>
ocaml doesn't liek this one: type shape = None | Circle float * float * float
<jdrake>
Just says 'syntax error', from around the first float
<jdrake>
oops
<jdrake>
forgot of
<thelema>
yup.
<jdrake>
How can I read in a source file into the top level and execute commands?
<thelema>
#use filename
<thelema>
err, #use "filename"
<jdrake>
Good it works
<jdrake>
# Scene [Circle (50.0, 50.0, 30.0)];;
<jdrake>
- : scene = Scene [Circle (50., 50., 30.)]
<jdrake>
If I had x being that result, would it be possible to append the scene easily?
<thelema>
let append shape = function Scene sl -> Scene (shape::sl) | s2 -> Scene [shape;s2]
<jdrake>
ok, I think I need that 'translated' into english
<thelema>
let append shape scene = match scene with Scene sl -> Scene (shape::sl) | s2 -> Scene [shape;s2]
<thelema>
defines a function called append. It takes two arguments: a shape and a scene.
<thelema>
If the Scene is really a Scene, then it returns a new scene with the new shape prepended to the old scene's list
<thelema>
If the scene is a simple shape, it returns a Scene with the two shapes in a list.
<jdrake>
ok, I think I get this
Mr_Awesome has joined #ocaml
thermoplyae has joined #ocaml
jonafan_ has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
jdrake has quit [Read error: 110 (Connection timed out)]
thermoplyae has quit ["daddy's in space"]
<palomer>
hello
<palomer>
how do I annotate a (function C1 -> E1 | ...) term?
ygrek has joined #ocaml
shortcircuit has quit [Connection timed out]
hkBst has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
shortcircuit has joined #ocaml
filp has joined #ocaml
szell has quit [Client Quit]
Tetsuo has joined #ocaml
Yoric[DT] has joined #ocaml
szell has joined #ocaml
ahf has quit [Client Quit]
ahf has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
Linktim has joined #ocaml
Anarchos has joined #ocaml
<Anarchos>
i have problems to build ocamlc.opt, it seems to be related to the option '-ccopt "" '
<Anarchos>
anybody encountered similar problem ?
<Yoric[DT]>
hi
<Yoric[DT]>
Still your shared libs ?
<Anarchos>
dunno, because i configured with no-shared-libs
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has joined #ocaml
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Linktim_ has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
melkart has joined #ocaml
bluestorm has joined #ocaml
LordMetroid has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
lordmetroid_ has joined #ocaml
lordmetroid_ has quit [Client Quit]
LordMetroid has quit [Read error: 110 (Connection timed out)]
LordMetroid has joined #ocaml
menace has joined #ocaml
Linktim- has joined #ocaml
Kopophex has joined #ocaml
melkart has quit [Remote closed the connection]
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Jedai has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
Waleee has joined #ocaml
pango has quit [Remote closed the connection]
Linktim_ has quit [Read error: 110 (Connection timed out)]
Torment has quit [Read error: 110 (Connection timed out)]
pango has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
jdrake has joined #ocaml
smimou has quit ["bli"]
Linktim has joined #ocaml
melkart has joined #ocaml
Linktim_ has joined #ocaml
Linktim- has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
r0bby has quit [Success]
Linktim_ has quit [Read error: 110 (Connection timed out)]
spanish_mathish is now known as spainish
Linktim- has quit [Read error: 110 (Connection timed out)]
r0bby has joined #ocaml
<Yoric[DT]>
Does anyone have a nice example of a situation when lazy lists are better than iterators ?
<Yoric[DT]>
(besides parser combinators)
<flux>
well, in general you can't pattern match on iterators..
<pango>
iterating over several sets in parallel?
<flux>
by iterator does one mean functions like Foo.iter or an iterator like in c++ stl?
<Yoric[DT]>
flux: I guess you could, if your iterator has something like peek : 'a t -> 'a
<Yoric[DT]>
c++-style
<flux>
yoric[dt], so, not much different then. you could emulate them with each other?
<Yoric[DT]>
The equivalent of Stream.t / Enum.t .
<flux>
different name perhaps
<flux>
so this is the issue at hand, then? duplicity?
<Yoric[DT]>
Yeah, not only emulate but also build one from the other without loss.
<Yoric[DT]>
No, just a blog entry.
<Yoric[DT]>
I've explained at length what lazy lists are and what they're good for.
<Yoric[DT]>
But most of my examples so far also apply to iterators.
<Yoric[DT]>
I'd like to show one difference.
<Yoric[DT]>
At the moment, the only nice example I have is the "either" combinator of parser combinators (<|> in parsec).
thelema has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
<Yoric[DT]>
A bit too complex for the entry, but an interesting read.
<flux>
is there a higher level iteration replacement that can deal with the iterating-two-things-in-parallel-issue?
melkart has joined #ocaml
Jeff_123 has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
Jeff_123 has quit [Client Quit]
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
smimou has joined #ocaml
sporkmonger has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
Linktim_ has joined #ocaml
Linktim_ has quit [Remote closed the connection]
Linktim has quit [Read error: 110 (Connection timed out)]
<palomer>
how do you get ocaml to generate an mli file?
<Smerdyakov>
Why would you want to do that?
menace has left #ocaml []
<flux>
ocamlc -i
<flux>
because at times you're lazy and haven't written it beforehand, and want to get a good headstart into writing one
<palomer>
why write one when ocaml will write it for you?
<palomer>
I just want to know the types of my terms
<flux>
well, you will want to maintain it afterwards manually
<Smerdyakov>
palomer, because modules can be given many different signatures.
<flux>
do you use emacs?
<palomer>
I use emacs
<flux>
then compile your files with the flag -dtypes
<palomer>
Smerdyakov, for example?
<flux>
and move your cursor over a term for which you want to determine the type of
<palomer>
flux, what's that in OMakespeak?
<flux>
I don't know
<palomer>
ok, move the cursor and then what?
<flux>
in any case, after you've done that, press C-c C-t
<Smerdyakov>
palomer, do you have any understanding of the standard paradigms for encapsulation and abstraction with ML-style module systems?
<flux>
it will tell you the type of the expression under the cursor
<flux>
it is an _excellent_ tool
<palomer>
Smerdyakov, err, I don't use functors much, if that's your question. I know how to include and open modules
Linktim has joined #ocaml
<palomer>
though I try and avoid modules and stick to objects
<Smerdyakov>
palomer, do you understand that you can give modules more restrictive signatures, hiding components and/or making types abstract?
<flux>
you will need caml-mode, though (and if you use tuareg mode, it will still require caml-mode to provide that feature)
<palomer>
Smerdyakov, yes, but that's mostly useful when you want to use functors, no?
<flux>
not really
<palomer>
caml-mode > tuareg-mode ?
<Smerdyakov>
palomer, no.
<palomer>
emacs uses tuareg mode by default, no?
<flux>
caml-mode is 'the standard mode', tuareg mode is a more advanced version of it
<flux>
maybe, if it's installed
<palomer>
now, why would you make a type abstract if not to use it in a functor application?
<flux>
palomer, example: Unix.file_descr
<flux>
and numerous others
<palomer>
flux, I got tuareg mode on
* palomer
doesn't know about Unix.file_descr
<flux>
it's really an integer underneath, but it is inadvisable to mix them with plain integers
<Smerdyakov>
palomer, you seem to have a serious misunderstanding here. It doesn't make sense to make a type abstract to use it in a functor application.
<palomer>
oh, so the type is hidden
<flux>
yes.
<palomer>
ahh, but I'm the only using my modules
<palomer>
so I don't need to hide anything
<Smerdyakov>
palomer, I recommend either learning the ML module system (since you seem to know nothing about it) or not trying to use mli files.
<palomer>
but if other people were to use my modules, I'd probably fiddle with my mli files
<palomer>
I'm only using mli files to get the types of my terms!
<Smerdyakov>
palomer, and that last statement makes me want to send an angry letter to your university. You don't seem to have been exposed to basic principles of software engineering.
<flux>
well, for small pieces of software perhaps not. but when you have a bigger system you might still limit the visibility. consider it a form of compiler-enforced documentation.
<Smerdyakov>
palomer, if you think imposing usage restrictions on software that only you will use is pointless, you have a lot to learn.
<palomer>
Smerdyakov, after every conversation with you, I always come out with the impression that I'm ignorant
<flux>
and when you have a large project, having .mli -files means that when you modify the corresponding .ml -file, not everything that refers to that module needs to be recompiled
<flux>
that makes recompiling faster
<Smerdyakov>
palomer, seriously, this is usually taught in the first year of CS degrees....
<palomer>
flux, but compilation is speedy anyways
<flux>
I must say that judging this conversation that may be justified
<flux>
palomer, not when you have sufficiently big project
<palomer>
Smerdyakov, seriously, stop being so insulting (though I appreciate your help)
<Smerdyakov>
palomer, you could probably benefit from reading an introductory programming book.
<palomer>
Smerdyakov, you could probably benefit from reading "People Skills: How to Assert Yourself, Listen to Others, and Resolve Conflicts", or a similar title
<Smerdyakov>
palomer, someone isn't necessarily out of line just because he's giving you bad news.
<flux>
and even though the largest single piece of software now compiles only 15 seconds, it is still much nicer to not wait that 15 seconds when you modify something that is depended upon by many other modules
<palomer>
Smerdyakov, someone is out of line when they make patently false assumptions about you and then give you insulting advice based on those assumptions
<palomer>
flux, but makefiles make it so that only the files that need to be recompiled are recompiled
<flux>
palomer, btw, .mli-files are a great place to put your documentation in
<palomer>
flux, since I keep my files small, I never wait more than half a second
<flux>
palomer, exactly, but if you have a file, say, default_settings.ml, once you modify anything it, everything will be recompiled anyway, as everything depends on it
<palomer>
flux, ahh, good point
<Smerdyakov>
palomer, well, I'm pretty sure the consensus among others participating is that you've shown incontrovertibly that you are lacking basic knowledge about software design, by saying that you don't need to enforce abstraction boundaries because you're the sole author of a program.
<flux>
palomer, however if you also have default_setting.mli, the whole-world-compilation will occur only when you add a net setting
<flux>
a new, even
<palomer>
Smerdyakov, sole author and user
<Smerdyakov>
(s/don't need to/shouldn't try to)
<Smerdyakov>
palomer, and that reply just reinforces my view..
<Smerdyakov>
palomer, who uses the software is irrelevant. This is about helping you code and maintain the software productively.
<flux>
palomer, think how much nicer it is to come back to your piece of code after a couple of years, when you have kept up good software engineering style ;)
<palomer>
flux, I never come back to a piece of code; I don't write that kind of code (though if I did, I'd do it much more rigorously)
<flux>
hmm.. what kind of code is something you never come back to?
<flux>
perhaps perl oneliners..
<palomer>
flux, experimental code
<palomer>
flux, implementing a type system, then trying out a different type system, etc...
<flux>
don't they have useful functions you perhaps would some day extract to a generally useful library?
<palomer>
flux, haven't run into any (except general purpose stuff like an either datatype and corresponding functions)
<palomer>
I have useful three liners, but they're self explanatory (map_by_two,count_none,etc...)
<Smerdyakov>
palomer, you are almost certainly taking longer to develop your software because you're not thinking about how to factor it into components with strong interfaces.
<palomer>
in ocaml I factor them into classes
<qwr>
palomer: defining interfaces actually makes easier to write your code. although with ocaml modules having to write different mli files is a minor annoyance.
<Smerdyakov>
Which is another problem, but it can sometimes lead to reasonable solutions.
<flux>
for some reason the path doesn't get fed into your default load path then
<flux>
it should happen by debian/ubuntu magic of system wide emacsrc-files
<flux>
in any case, the issue can be worked around
<flux>
with sufficient emacs-trickery ;)
<flux>
for example, you could try M-; (set-load-path load-path (cons "/usr/share/emacs/site-lisp/ocaml-mode" load-path)) first..
<flux>
but I have xemacs here. perhaps your situation is different.
<palomer>
set-load-path is void
<flux>
well, I just looked that from my xemacs
<palomer>
righto
<palomer>
lemme dig something up
<palomer>
I used to spend days editing my .emacs
<flux>
I think I'll be off to sleep. your problem should be solvable, good luck ;)
<palomer>
thx!
<palomer>
night!
<flux>
good night.
<palomer>
it works!
<palomer>
hee hee
bperryman has joined #ocaml
bperryman has quit [Client Quit]
thelema has joined #ocaml
<palomer>
what's the easiest way to make sure a class is a subclass of another? object (self:'a) constraint 'a = #superclass ?
AxleLonghor1 has joined #ocaml
AxleLonghor1 has left #ocaml []
ygrek has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
hordf has joined #ocaml
filp has quit [Read error: 110 (Connection timed out)]
hkBst is now known as hikiBisit
hikiBisit is now known as hkBst
smimou has quit ["bli"]
Linktim has quit [Remote closed the connection]
coucou747 has joined #ocaml
hordf has quit ["Bye"]
Waleee has quit []
melkart has quit [Remote closed the connection]
* palomer
wishes there was something similar to initalizer lists in ocaml
jdrake has quit [Read error: 110 (Connection timed out)]
<qwr>
initializer list is what?
* qwr
. o O ( google tells, that it is one way of C++ field initialization... )
<palomer>
constraint 'self = #('self eiffel_traversable) <--how would I write this
<palomer>
qwr, yeah, it would allow me to access self in val declarations
smimou has joined #ocaml
Tetsuo has quit ["Leaving"]
<orbitz>
what is 'this'?
<qwr>
orbitz: nothing
<orbitz>
that was to palomer
<qwr>
palomer: you could predefine classtype?
<qwr>
(although that would be quite verbose...)
<palomer>
qwr, you mean create a class type for my class?
<qwr>
yes
<palomer>
I think that's what ocaml wants me to do
* palomer
grumbles!
<palomer>
the problem with class types is that you can't combine them
<palomer>
or can you?
<palomer>
if I used a virtual class I could do
<palomer>
inherit class_1; inherit class_2
* qwr
wonders, whether there are some operator to get class type from class
<qwr>
palomer: yes you should be able to inherit
<palomer>
ahh, true true
* palomer
will ponder this
* qwr
suspects, that there could be easier ways than trying to that kind of OO magic...
<qwr>
but i don't know the problem of course ;)
<palomer>
I'm doing OO super magic
<palomer>
but, erm, maybe there is a better way
<palomer>
only class types can inherit from class types!
nuncanada has joined #ocaml
<palomer>
constraint 'self = #(['parent_type,'left_sibling_type,'right_sibling_type] typ) <---ok, how would I do this?
<palomer>
parametrically subtyped constraints seem to be impossible
* qwr
shrugs looking at that
<palomer>
constraint foo = #('bar baz)
<palomer>
foo is a subtype of 'bar baz
<qwr>
why you wont give that kind of shit as constructor parameters?
<qwr>
why all those type dependencies?
<palomer>
well, the crux of the problem is that I have this abstract syntax tree
<palomer>
so I have a method get_right_sibling
<palomer>
for every class which is a node
* qwr
would probably represent AST using variants. not classes
<palomer>
now, get_right_sibling returns something depending on the node
<palomer>
the problem with variants is that I have about 15 different node types
<palomer>
a constructor for every node type would be bothersome
<palomer>
and then I would have to put some boilerplate for every constructor
<qwr>
you can nest variants
<qwr>
and structs...
<palomer>
ok, how would I represent the pointer to the current node?
<qwr>
and refactor common code into functions
jdrake has joined #ocaml
<qwr>
what you call pointer?
<palomer>
reference
<qwr>
so you use ref?
<qwr>
;)
<palomer>
a reference to what?
<palomer>
a really huge variant type?
<qwr>
for example
<qwr>
or struct containing that variant type
<qwr>
if all variants share some info
<palomer>
we're talking 15 constructors and counting
<palomer>
it'll be a huge pain to manage
<qwr>
how OO solves that? what those constructors do?
<palomer>
you don't have a huge variant
<palomer>
you should have many classes which implement the same interface
<palomer>
/should/just have
* palomer
is off to supper!
<qwr>
so you have classes instead of constructors
<qwr>
how it's easier?
<qwr>
(class basically is a constructor)
* qwr
thinks the only thing is, that ocaml structs are somewhat stupid. classes can be used like a smarter structs... maybe that is what helps you with classes?
<qwr>
(ocaml structs are not polymorphic which is annoying occasionally)
<qwr>
but still... the class magic you're doing looks somewhat overcomplicated
<nuncanada>
Heya, is it possible to pass a module like a value in a array?
<nuncanada>
or a list
<nuncanada>
I want to make a list of modules of a certain type
<nuncanada>
to iterate over them in my application menu
<pango>
nuncanada: no, modules aren't first class
<qwr>
maybe you could build list of functors?
* qwr
isn't sure...
<nuncanada>
functors are first class?
<qwr>
no
<nuncanada>
I am not very ocaml savvy, how would you guys do it?
<qwr>
not a value list
<nuncanada>
I have 4 modules that do the same thing (4 different substitution calculi), i want to make a generic function to "use" any of these modules
<nuncanada>
Create a big list with each function within a tuple?
<qwr>
tuple for name?
<nuncanada>
for each function name
<nuncanada>
like ((A.function1, A.function2), (B.function1, B.function2))?
<nuncanada>
just seems ugly, but i guess it will work
<nuncanada>
maybe there's a better way to do it?
yangsx has joined #ocaml
<qwr>
i think timtowtdi...
<qwr>
for example you could write the generic function into functor module, that takes module as parameter
<qwr>
and then make list of functions from this functor instances
<qwr>
but if your modules have simple interface, it would be pointless
* qwr
should go sleep anyway...
<nuncanada>
hmm
<nuncanada>
these do have simple interfaces... Although there are other parts where this might be useful