Banana changed the topic of #ocaml to: OCaml 3.08.1 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
phubuh has quit [Ping timeout: 14400 seconds]
<mrsolo_> why is type conversion useful?
<mattam> because OO in C++ is a mess ?
<jameson> mattam: That seems not to be a particularly constructive answer.
<Smerdyakov> jameson, I think it explains quite well why type conversion is useful in C++.
<jameson> Oh, this was about C++? In that case, I apologise.
<mattam> yeah, read the logs
<jameson> Indeed. mattam, I'm sorry. I thought this was about something else, though I'm still reading up on that to find out whether I was just confused or referring to an O'Caml feature that actually exists.
<Smerdyakov> "Referring"? Where?
<jameson> Right, I was thinking about the explicit use of the (:>) O'Caml infix subtype conversion operator, which actually seems to exist.
<jameson> My assumption was that this was about (:>), as this is an O'Caml channel, so mattam's answer made no sense to me. Again, apologies for this; even if my complaint had been correct, it should've been in a private message.
<Smerdyakov> Yeah, I think the subject was implicit conversions.
<mattam> np jameson, your apologies are accepted :)
ez4 has joined #ocaml
ez4 has quit [Remote closed the connection]
ez4 has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
monochrom has joined #ocaml
m3ga_ has joined #ocaml
m3ga_ is now known as m3ga
m3ga is now known as m3ga_
m3ga_ is now known as m3ga
GreyLensman has joined #ocaml
ez4 has quit [Remote closed the connection]
GreyLensman has quit ["Leaving"]
Nutssh has joined #ocaml
zigong has quit ["Leaving"]
zigong has joined #ocaml
Nutssh has quit [Read error: 104 (Connection reset by peer)]
kinners has joined #ocaml
mlh has joined #ocaml
mrsolo_ has quit [Read error: 232 (Connection reset by peer)]
mrsolo_ has joined #ocaml
cjohnson has quit ["The main attraction: distraction"]
gld has quit [Read error: 238 (Connection timed out)]
vezenchio has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
m3ga has left #ocaml []
Herrchen has joined #ocaml
kinners has quit ["leaving"]
mrsolo_ has quit [zelazny.freenode.net irc.freenode.net]
srv has quit [zelazny.freenode.net irc.freenode.net]
vincenz has quit [zelazny.freenode.net irc.freenode.net]
mflux has quit [zelazny.freenode.net irc.freenode.net]
bacam has quit [zelazny.freenode.net irc.freenode.net]
pattern has quit [zelazny.freenode.net irc.freenode.net]
Hipo has quit [zelazny.freenode.net irc.freenode.net]
mrsolo_ has joined #ocaml
mflux has joined #ocaml
srv has joined #ocaml
vincenz has joined #ocaml
Hipo has joined #ocaml
pattern has joined #ocaml
bacam has joined #ocaml
bacam has quit [zelazny.freenode.net irc.freenode.net]
srv has quit [zelazny.freenode.net irc.freenode.net]
mflux has quit [zelazny.freenode.net irc.freenode.net]
pattern has quit [zelazny.freenode.net irc.freenode.net]
Hipo has quit [zelazny.freenode.net irc.freenode.net]
vincenz has quit [zelazny.freenode.net irc.freenode.net]
mflux has joined #ocaml
srv has joined #ocaml
vincenz has joined #ocaml
Hipo has joined #ocaml
pattern has joined #ocaml
bacam has joined #ocaml
_fab has joined #ocaml
malte has quit ["Lämnar"]
Tristram has quit [Remote closed the connection]
malte has joined #ocaml
Herrchen has quit ["bye"]
lucifer has joined #ocaml
haakonn has quit [Read error: 104 (Connection reset by peer)]
haakonn has joined #ocaml
mrsolo_ has quit [Read error: 113 (No route to host)]
lucifer has left #ocaml []
johgro has joined #ocaml
<johgro> test
<johgro> As I do not kno how IRC works, I will just pose my question, and apologize if this is the wrong way.
<johgro> Is anyone using the Bigarray module?
<johgro> I cannot use the function Array2.create in it.
Tristram has joined #ocaml
<pango_> I haven't used bigarray before but...
<pango_> $ ocaml bigarray.cma
<pango_> # open Bigarray ;;
<pango_> # Array2.create float32 c_layout 1024 1024 ;;
<pango_> - : (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array2.t =
<pango_> <abstr>
<johgro> Thanks, as open Bigarray worked, I assumed bigarray was included when invoking the interpreter with "ocaml", but when I used "ocaml bigarray.cma" everything works better.
<pango_> "The expression open module-path in a structure does not define any components nor perform any bindings. It simply affects the parsing of the following items of the structure, allowing components of the module denoted by module-path to be referred to by their simple names name instead of path accesses module-path . name."... So it's purely a shortcut
srv has quit [Read error: 232 (Connection reset by peer)]
srv has joined #ocaml
bacam_ has joined #ocaml
srv has quit [zelazny.freenode.net irc.freenode.net]
johgro has quit [zelazny.freenode.net irc.freenode.net]
_fab has quit [zelazny.freenode.net irc.freenode.net]
bacam has quit [zelazny.freenode.net irc.freenode.net]
mflux has quit [zelazny.freenode.net irc.freenode.net]
pattern has quit [zelazny.freenode.net irc.freenode.net]
Hipo has quit [zelazny.freenode.net irc.freenode.net]
vincenz has quit [zelazny.freenode.net irc.freenode.net]
srv has joined #ocaml
johgro has joined #ocaml
_fab has joined #ocaml
vincenz has joined #ocaml
Hipo has joined #ocaml
pattern has joined #ocaml
bacam has joined #ocaml
bacam has quit [Read error: 232 (Connection reset by peer)]
mflux has joined #ocaml
cjohnson has joined #ocaml
vincenz_ has joined #ocaml
vincenz has quit ["Changing server"]
vincenz_ is now known as vincenz
mlh has quit [Client Quit]
maihem has joined #ocaml
bacam_ is now known as bacam
zigong has quit [Remote closed the connection]
docelic has joined #ocaml
Smerdyakov has quit ["Client exiting"]
monochrom has joined #ocaml
Smerdyakov has joined #ocaml
cjohnson has quit [Read error: 54 (Connection reset by peer)]
cjohnson has joined #ocaml
_fab has quit []
ows has joined #ocaml
<dan2> if I do this
<dan2> let fib (0 | 1) = 1;;
<dan2> let fib n = ...
<dan2> it will call the former if it is called (fib 1) right?
<mellum> dan2: no
<dan2> mellum: best do it this way then
<dan2> let fib n = match n with |
<mellum> the seconf definition will override the first
<dan2> erm
<dan2> let fib n = match n with
<dan2> | 0 | 1 -> 1
<mellum> try let fib = funcion 1 -> ...
<dan2> |n -> ...
<dan2> let decr = function x -> x-1;;
<dan2> let fib n =
<dan2> match n with
<dan2> | 0 | 1 -> 1
<dan2> | n -> let rec fib' n f0 f1 =
<dan2> match n with
<dan2> | 0 -> f1
<dan2> | n -> fib' (decr n) f1 (f0 + f1)
<dan2> in fib' n 0 1;;
<Tristram> let fib = function
<Tristram> |0|1 -> 1
<Tristram> | n -> fib (pred n);;
<Tristram> the first line ist let rec fib
<dan2> Tristram: is that any better than what I pasted above
<Tristram> and it's done
<Tristram> I don't think your function will work
<dan2> it works fine
<Tristram> sorry
<Tristram> I just read your last function
* dan2 conks Tristram on the head
* Tristram goes to the hospital
<dan2> Tristram: the one with match(s) works
<Tristram> dan2 yes, using function is exactly the same as using match. It is just a bit more "mathematical"
<dan2> Tristram: bah, I bet the ocaml compiler sees them both as the same
<Tristram> so do I
<Tristram> but I think the function with the decr won't work
* dan2 beats Tristram again
<dan2> <dan2> let decr = function x -> x-1;;
<Tristram> <dan2> let fib n =
<Tristram> <dan2> match n with
<Tristram> <dan2> | 0 | 1 -> 1
<Tristram> <dan2> | n -> let rec fib' n f0 f1 =
<Tristram> <dan2> match n with
<Tristram> <dan2> | 0 -> f1
<Tristram> <dan2> | n -> fib' (decr n) f1 (f0 + f1)
<Tristram> <dan2> in fib' n 0 1;;
<Tristram> that one shouldn't work
<avlondono> function is less typing. and you're using them to type more :-)
<dan2> Tristram: god damn, read the line I pasted above that
<dan2> Tristram: and I KNOW it works
<avlondono> let decr x = x - 1 is far less than let decr = function x -> x - 1
<dan2> Tristram: adjust your spectacles
<dan2> avlondono: bah
<avlondono> hehehe
<Tristram> dan2, well, let's forget everything, I just to tired to know wich function you're talking about...
<Tristram> avlondono, dan2 : pred does the same as decr and it is already defined in the core language
<avlondono> indeed
<dan2> Tristram: didn't know
<avlondono> I was just pointing out bad style :-)
<avlondono> but my opinion is not important
<avlondono> so do as you whish dan2 ;-)
<Tristram> int decr(int n) {return (n-1);}
* Tristram runs aways
<dan2> Tristram: you wouldn't be able to call that directly from ocaml
<dan2> Tristram: since ocaml integers are of type long in C
<Smerdyakov> long is the same as int on most popular platforms today.
<dan2> Smerdyakov: hmm
mrsolo has joined #ocaml
<Tristram> I was joking (I know, it is not funny). I can't stand C
<dan2> Tristram: C is fine when you need specific libs or a performance boost or manual memory allocation
<dan2> not that ocaml doesn't compete with C very well, but its garbage collector can be a pita
<mellum> Mhhm, pita
<Tristram> pita?
<monochrom> pita and pizza
<monochrom> fish and chips
<mellum> Tristram: It's a flat white bread. Very tasty.
<dan2> pain in the ass
<avlondono> interesting, a tasty pain in the ass
pango has joined #ocaml
pango_ has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["Look at you, hacker - a pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you"]
cjohnson has quit [Read error: 232 (Connection reset by peer)]
cjohnson has joined #ocaml
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
johgro has quit ["Leaving"]
cjohnson has quit [Read error: 54 (Connection reset by peer)]
cjohnson has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
CLxyz has quit []
jameson has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has joined #ocaml
GreyLensman has quit ["Leaving"]
mlh has joined #ocaml
mlh_ has joined #ocaml
mlh_ has quit [Client Quit]