ulfdoz has quit [Read error: 110 (Connection timed out)]
mrsolo has quit [Remote closed the connection]
Sonarman has quit ["Lost terminal"]
Sonarman has joined #ocaml
Enveigler has quit [Read error: 110 (Connection timed out)]
angagon has joined #ocaml
angagon has left #ocaml []
mlh_ has quit [Client Quit]
mlh_ has joined #ocaml
mlh_ has quit [Client Quit]
mlh_ has joined #ocaml
Smerdyakov has quit ["sleep"]
mlh_ has quit [Client Quit]
mlh_ has joined #ocaml
monochrom has quit ["good morning, sweet dream"]
fluxx has joined #ocaml
mflux has quit [Read error: 54 (Connection reset by peer)]
_fab has quit [Remote closed the connection]
Enveigler has joined #ocaml
Snark_dodo has quit ["Leaving"]
mlh_ has quit [Client Quit]
_shawn has quit [Read error: 113 (No route to host)]
Nate75Sanders has joined #ocaml
batdog is now known as batdog|gone
batdog|gone is now known as batdog
vezenchio has joined #ocaml
smimou has joined #ocaml
Enveigler has quit [Read error: 110 (Connection timed out)]
Gueben has joined #ocaml
Nate75Sanders has quit ["using sirc version 2.211+KSIRC/1.3.11"]
juri has joined #ocaml
<juri>
newbie question: when i'm storing a lablgtk2 dialog in a record i'm dragging around, what should i specify as its type? i've tried using [ 'DELETE_EVENT ] GWindow.dialog, but if i use dialog#misc#run () and click ok (which is supposed to return GTK_RESPONSE_OK), i get an error message. i'm not having any better luck with [ 'DELETE_EVENT | `OK ] or any other reponse id i add to the list
<juri>
[ `DELETE_EVENT ] works just fine if i close the window with the window manager, though
<juri>
tried dialog_any, too, but still the same GSourceFunc: callback raised an exception. bummer.
<juri>
oh well, maybe i'll just do this by hand
<Esine>
how well does OCaml support Unicode? are there any Unicode libraries for OCaml?
<smimou>
yes camomile.sf.net for example
<Esine>
thank you
Gueben has quit [Remote closed the connection]
Enveigler has joined #ocaml
m3ga_ has joined #ocaml
m3ga_ has quit [Client Quit]
<Esine>
"All the data mentioned so far is immutable - it is impossible to change an entry in an existing list, tuple, or record!" "Also, all variables are immutable."
<Esine>
how come do you call them variables if they are constant?
<Esine>
immutable == constant right?
<smimou>
yes
<Esine>
well, for example, how do you write this in OCaml? int i; for( i = 0; i < 10; i++ ) { ... }
<smimou>
for i = 0 to 10 do ... done
<Esine>
oh
<smimou>
in each loop i is constant
<Esine>
ah
<Esine>
now I got it, thanks!
<Esine>
uh one more thing.. how do you know what is part of a function? er.. how do you write this in OCaml: int mul( int x, int y) { printf( "bzz\n"); return x*y; }
<Esine>
let mul x y = print_string "bz\n";; x * y;; doesnt work :P
<smimou>
the first ;; should be a ;
<Esine>
ah
shining has joined #ocaml
<Schmurtz>
Printf.printf "bzz\n%!"
<Schmurtz>
for those who love printf
<Esine>
oh!
<Esine>
theres printf!
<Schmurtz>
yes :)
<Schmurtz>
and a better one than the c printf
<Esine>
hm, what's the %! doing there?
<Schmurtz>
it ask to flush output
<smimou>
it means flush
<Esine>
oh ok
ulfdoz has joined #ocaml
<ulfdoz>
re
Enveigler has quit [Read error: 110 (Connection timed out)]
Enveigler has joined #ocaml
Smerdyakov has joined #ocaml
zvrba has joined #ocaml
shining has quit ["leaving"]
Purice has joined #ocaml
Purice has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has quit ["work"]
Enveigler_ has joined #ocaml
Enveigler has quit [Read error: 110 (Connection timed out)]
<Esine>
hmm
<Esine>
O'Caml has the same problem as D
<Esine>
it creates HUGE binaries
<Esine>
simple hello world is 200 K, 89 K after stripping
<mauke>
ocamlc or ocamlopt?
<Esine>
ocamlopt
<Esine>
and ~2,8 K with gcc and C
<vezenchio>
thats not a very good measure
<vezenchio>
that size is dependant upon a constant inclusion of libraries
<vezenchio>
a better measure of size efficiency would be
<vezenchio>
to see how the size of executables grows with growing program complexity
<vezenchio>
with assembly i can probably write hello, world-programs that are even smaller
<vezenchio>
but thats really of no use
<Schmurtz>
Esine, it's normal
<vezenchio>
because this seeming drawback of C in comparison to assembly is going to disappear asymptotically with growing program complexity
<Schmurtz>
and for big programs, you don't see the difference
<Schmurtz>
vezenchio, exactly :)
<zvrba>
how do I match a function argument according to type?
<mauke>
what?
<zvrba>
for example, I want a function to add rationals, but to perform gcd only if its arguments are integer nominator/denominator
<zvrba>
mauke: make function behave differently based on its type.
<zvrba>
wrong, on the type of argument
<mauke>
since when does OCaml allow function overloading?
<zvrba>
it does not. i'm asking if it's possible to do it with pattern matching
<zvrba>
Ocaml can do matching on types with constructors
<zvrba>
right?
<zvrba>
so how do I do matching on built-in types like int and float
<mauke>
that's totally different and you can't do it
<zvrba>
mauke: ok :)
<mauke>
pattern matching is for values of a certain type
<zvrba>
mauke: thx. so I'm not going to search through manuals any more :)
<mauke>
haskell has type classes, though
<zvrba>
mauke: ahhh... thx! discriminated unions.. it is a SIGNLE type, even if it may have several constructors. I get it :)
<Schmurtz>
what about a type like : type t = INT of int | RATIONNAL of int* int
<Schmurtz>
it doesn't work in fatc...
<mauke>
in haskell you could just make rational an instance of Num and use + with it
<zvrba>
Schmurtz: look, my design was type 'a rational = Rational of 'a * 'a ;;
<zvrba>
and then I proceeded to code addition
<zvrba>
and well.. ONLY if 'a == int, I should do gcd of the result
<zvrba>
if 'a == float or something else, it does not make sense
<Schmurtz>
ok, I see
<Schmurtz>
it's not possible
<zvrba>
Schmurtz: I'm just learning. I know about built-in rationals
<zvrba>
Schmurtz: :)
<zvrba>
ok, nice to know
<zvrba>
Schmurtz: but.. how would you do it then for example?
<Schmurtz>
you may create a type : type number = INT of int | FLOAT of float | ....
<Schmurtz>
you can use pattern matching with such a type
<zvrba>
Schmurtz: ok. thx.
<zvrba>
back to coding :)
<Schmurtz>
good luck
<zvrba>
Schmurtz: thanks :)
Gueben has joined #ocaml
<zvrba>
ok, it's time to hide myself of shamee. it makes *no* sense to have any other type for numerator or denominator except integers :)
<zvrba>
sahme
<zvrba>
shame
<Schmurtz>
if you want to use +, yes
<zvrba>
but anyway, now I know for the future about some things :)
<Schmurtz>
+ is of signature int -> int -> int
<Schmurtz>
for float it's +.
<Schmurtz>
+ is not polymorphic :(
<zvrba>
Schmurtz: I know. but in general, it makes no sense to use any other type except integers (ok, and bignums) for rationals :)
<Schmurtz>
complex integers...
<Schmurtz>
a + ib with a and b two integers
<zvrba>
uf, yes.
<Schmurtz>
however, you won't use it
<zvrba>
hm.. you can even define gcd for complex integers
<zvrba>
:)
<Schmurtz>
I don't know
<Schmurtz>
the best is ti use a type like the "number" type
<zvrba>
I have graduate algebra book .. I know I've seen it inside
<Schmurtz>
ok
<zvrba>
euclidean domains
<zvrba>
anyway.. i'm waay off-topic now with this :)
<pnou_>
actually you only need a factorial ring to define gcd
<pnou_>
which is a weakest condition than euclidian ring
<Schmurtz>
algebra is not my cup of tea...
GuebN has joined #ocaml
Gueben has quit [Nick collision from services.]
GuebN is now known as Gueben
<zvrba>
obviously, I'm a bit rusty too :)
Snark has joined #ocaml
Enveigler_ has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
Enveigler_ has joined #ocaml
ramkrsna has quit [Remote closed the connection]
angagon has joined #ocaml
_fab has joined #ocaml
Enveigler_ has quit [Read error: 110 (Connection timed out)]
angagon has quit [Read error: 110 (Connection timed out)]
GuebN has joined #ocaml
GuebN has quit [Remote closed the connection]
GuebN has joined #ocaml
Gueben has quit [Read error: 110 (Connection timed out)]
GuebN is now known as Gueben
gim has quit [No route to host]
gim has joined #ocaml
<Esine>
is there something like switch ( .. ) { case x: ... } in ocaml?
<Esine>
or do I just have to use loads of if..elses?
<TaXules>
yes
<TaXules>
match value with | x -> blalbla | y -> blibli
<TaXules>
look for pattern matching
<TaXules>
it's an important aspect of ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
<Schmurtz>
Esine, it work with everything, not only with integers
<Schmurtz>
lock at the documentation...
<Esine>
hm
Demitar has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["\o/ in mochintin namocniuh \o/"]
TaXules has quit [Read error: 104 (Connection reset by peer)]