Revision17 has quit [Read error: 110 (Connection timed out)]
Schmurtz has quit [Read error: 113 (No route to host)]
khaladan has quit [Connection timed out]
zigong has joined #ocaml
Revision17 has joined #ocaml
pango_ has joined #ocaml
pango has quit [Read error: 110 (Connection timed out)]
mikeX has quit ["zz"]
slipstream has joined #ocaml
slipstream-- has quit [Connection timed out]
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
<lispy>
does ocaml have a way to define interfaces?
<lispy>
i wanted (as a learning tool) to create a class vector which had as members vector2, vector3 and vector4
<Smerdyakov>
Why are you using OO?
<lispy>
well, in haskell i would use a type class so that they would have a common set of functions via overloading
<Smerdyakov>
The more idiomatic ML solution would involve functors.
<lispy>
hmm...
<Smerdyakov>
(And that's just what Standard ML does.)
<lispy>
hmm, alright i found a link to functors in this ocaml tutorial
khaladan has joined #ocaml
<lispy>
i'm having a hard time understanding how to define a functor
<Smerdyakov>
The documentation isn't _that_ bad that you have no idea how to define any functor, is it?
<lispy>
it is
<Smerdyakov>
Which documentation have you read?
<lispy>
well, i'm been trying to google it
<Smerdyakov>
Don't you know there is a manual?
<lispy>
i found that, but it has a long convoluted bank account example
<Smerdyakov>
Not the "The module system" section of the tutorial
<lispy>
where should i look?
<Smerdyakov>
You mean where on the page I just referenced?
<lispy>
< Smerdyakov> Not the "The module system" section of the tutorial
<lispy>
if not the module system, then where should i look?
<Smerdyakov>
Oh, I missed some crucial words.
<Smerdyakov>
I meant:
<Smerdyakov>
Not in the "The module system" section of the tutorial
<Smerdyakov>
Meaning that "there is no convoluted bank account example there."
<Smerdyakov>
And, additionally, that is the page you should be reading.
<lispy>
well, when i google for "ocaml manual" and find it i don't see the bank account example, but before when i googled and found a link to the manual it was a bank example
<Smerdyakov>
When you Google with only the search text "ocaml manual," you find particular pages of the manual instead of the ToC?
<lispy>
no
<lispy>
ocaml manual takes me to the manual as you would expect
<lispy>
i don't remember the exact search string that broguht me to the bank account example
<Smerdyakov>
When you have a question about a language, you should always look to its manual. If you haven't used a manual before, you should find its table of contents and use that to find the information you want, not a search through a general-purpose search engine.
<lispy>
i'm looking at the ordered set example but i'm really confused about the line "functor (Elt: ORDERED_SET)" where is ORDERED_SET defined?
<lispy>
or ORDERED_TYPE i guess
<lispy>
well, i was looking for tutorials and examples about functors, language references are notoriously dense
<Smerdyakov>
You are just being ridiculous now.
<Smerdyakov>
You clearly haven't read even the immediate context of the line you're complaining about.
<lispy>
no i'm being serious, there is an interface declared for ORDERED_TYPE, but i don't see a definition
<Smerdyakov>
Did you start reading that page from the beginning?
<lispy>
i started at functors of all things
<Smerdyakov>
You should start from the beginning.
<lispy>
oh, they put the definitions after the functor example where they define OrederedString
<Smerdyakov>
Naturally, the tutorial is designed to be read linearly, so you shouldn't complain if you find something you don't understand.
<Smerdyakov>
No.
<Smerdyakov>
They don't.
<lispy>
let compare x y = if ...
<Smerdyakov>
Listen, you fundamentally don't know what a module system is in the context of ML.
<Smerdyakov>
So read the page from the beginning.
<lispy>
so it looks like you define modules that give the interfaces, then you define a functor thingy that pulls them altogether and then defined the instances of the interfaces as modules also?
<Smerdyakov>
I've reached my limit of being willing to help you, given how unwilling you seem to be to apply reasonable learning strategies with the available documentation. Maybe another day.
<lispy>
uh...
<lispy>
okay
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
Smerdyakov has quit ["Leaving"]
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
shawn has joined #ocaml
JKnecht has joined #ocaml
_shawn has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
Schmurtz has joined #ocaml
bluestorm has joined #ocaml
Schmurtz has quit ["Dodo !"]
mikeX_ has joined #ocaml
srle has joined #ocaml
<srle>
hi, all
<srle>
is anybody here?
Schmurtz has joined #ocaml
<srle>
hola
<bluestorm>
hum
<bluestorm>
i'm here
* JKnecht
too
bluestorm is now known as bluestorm-eat
bluestorm-eat is now known as bluestorm
zigong has quit ["using sirc version 2.211+KSIRC/1.3.12"]
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
<srle>
i have a question
<srle>
I was trying to make accumulator in ocaml (the accumulator that Paul Graham was talking about). But without any luck. Does anybody know the solution in ocaml?
<dylan>
One that operates on any number is not so possible to do
<srle>
dylan : I am interested in ints, only.
<srle>
something like:
<srle>
let f x =
<srle>
let acc = ref x;
<srle>
fun a ->
descender has joined #ocaml
<srle>
acc := !acc + a;
<srle>
!a ;;
<flux__>
replace the first ; with in
<srle>
ok
<flux__>
and I guess you want to return !acc, not a?
<srle>
yes
<srle>
why do I have to put 'in' instead of ; ? (I know that it is a stupid question but...)
<flux__>
well, because ;)
<flux__>
it's an expression 'let foo = bar in expression'
<flux__>
not a top-level definition which is let a = b
<srle>
I have the felling that sintax of ocaml is not uniform. Am I right?
<flux__>
the top level does have some differences
<bluestorm>
srle, syntax is uniform
<flux__>
for example you can only 'open Foo' in top level (but there's a language extension that allows you to write open Foo in expr)
<Schmurtz>
"let ... in" create a new bloc
<flux__>
(an extension that doesn't come with ocaml distribution that is)
<Schmurtz>
if you write let a = b in ...., a only exists in the ...
<srle>
does ocaml have closures?
<Schmurtz>
on a top level, you write let a = b;; so a persiste after the execution of let a = b;;
<srle>
like scheme?
<bluestorm>
srle, yes he does
<bluestorm>
(dunno about scheme)
<srle>
can you give me two line example to get the idea?
<bluestorm>
let add = a + b in
<bluestorm>
hum
<bluestorm>
let add a b = a + b in (sorry)
<bluestorm>
let add2 b = add 2 in
<Schmurtz>
yes, it's better ;)
<bluestorm>
i could write let add2 b = ( + ) 2 in
<bluestorm>
does it looks like a closure ?
<srle>
a little.
<srle>
is there any compiler flag that enables 'OverFlow exception' for integer operations?
<bluestorm>
( man ocamlc :-° )
<srle>
or 'overflows' pass silently?
<srle>
bluestorm : nothing there. :(
<bluestorm>
yes
<bluestorm>
you're right
<bluestorm>
(and nothing in ocamlc --help)
<srle>
people are suggestion to program in ocaml for its safety but this thig passes silently. I don't understand the writters of compilers. Why didn't they include this option?
<bluestorm>
hum
<bluestorm>
i dunno
<bluestorm>
but you could use float instead of int to manipulate big numbers
<bluestorm>
(or some specific library)
<Schmurtz>
yes, but if you don't need it, it may be useful to have sanity checks preventing integer overflows
<Schmurtz>
like in ADA for instance
<bluestorm>
i agree
Schmurtz has quit ["Dodo !"]
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
srle has left #ocaml []
__DL__ has joined #ocaml
Smerdyakov has joined #ocaml
zigong has joined #ocaml
vodka-goo has joined #ocaml
Schmurtz has joined #ocaml
khaladan has quit [Read error: 104 (Connection reset by peer)]
gim has joined #ocaml
Schmurtz has quit ["Dodo !"]
Schmurtz has joined #ocaml
zigong has quit [Success]
_shawn has joined #ocaml
shawn has quit [Connection timed out]
Revision17 has joined #ocaml
_fab has joined #ocaml
<_fab>
moin
<zmdkrbou>
plu
zigong has joined #ocaml
khaladan has joined #ocaml
pango has quit ["Leaving"]
vodka-goo has quit ["Connection reset by by pear"]
smimou has joined #ocaml
mikeX_ is now known as mikeX
Schmurtz has quit ["Dodo !"]
<KrispyKringle>
There doesn't happen to be a convenient library function for converting floats into IEEE formatted bytes, is there?
<KrispyKringle>
ooh,m nevermind.
zigong has quit [SendQ exceeded]
zigong has joined #ocaml
Bigb[a]ng is now known as Bigbang
pango has joined #ocaml
<mikeX>
will input_char mess with \r\n sequences?
sieni has joined #ocaml
kral has joined #ocaml
zigong has quit ["using sirc version 2.211+KSIRC/1.3.12"]
vodka-goo has joined #ocaml
Skal has quit [Remote closed the connection]
gim has quit ["dodo"]
Schmurtz has joined #ocaml
__DL__ has quit [Remote closed the connection]
kral has left #ocaml []
dozer has joined #ocaml
<dozer>
hi - I am learing ocaml for the first time tonight
<dozer>
and can't see how to do mutualy recursive record/variant types
<dozer>
any pointers?
<dylan>
values arn't allowed to be recursive unless you specify -rectypes ocamlc option
<dozer>
so if I'm defining a data-structure like a bnf grammar, how do I represent the mutual-recursiveness of the types representing each production?
<vodka-goo>
dozer: let's try an example
<vodka-goo>
I think what you want to do is simple, so just explain what you want
<dozer>
ok ... thinking of a minimal example:
<dozer>
"type foo = X of x | Empty;;" and "type x = foo * foo;;"
<vodka-goo>
You can write things like type bla = { foo : bla }, or things like type a = A of a | B of b and b = { foo : a }
<dozer>
ok, so I have one type followed by each deffinition linked by "and"
<vodka-goo>
dozer: here you wan either write foo*foo instead of x, or use the "and" construct between the two declarations