smimou changed the topic of #ocaml to: OCaml 3.08.3 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | 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/
jever has quit ["Leaving"]
Jeb has joined #ocaml
ulfdoz has joined #ocaml
petter_ has quit [Read error: 110 (Connection timed out)]
Jeb has left #ocaml []
batkins_ is now known as interferon
interferon has quit [Remote closed the connection]
batdog is now known as batdog|gone
HoneyBee is now known as Oatly
batdog|gone is now known as batdog
Oatmeat has joined #ocaml
<Oatly> .
Oatmeat has left #ocaml []
Oatmeat has joined #ocaml
Oatmeat has left #ocaml []
Oatmeat has joined #ocaml
Oatmeat has left #ocaml []
batdog is now known as batdog|gone
interferon has joined #ocaml
<interferon> is ocaml purely functional/
mrsolo has quit ["Leaving"]
Mike_L has quit [kornbluth.freenode.net irc.freenode.net]
Herrchen_ has quit [kornbluth.freenode.net irc.freenode.net]
mauke has quit [kornbluth.freenode.net irc.freenode.net]
cmeme has quit [kornbluth.freenode.net irc.freenode.net]
Amorphous has quit [kornbluth.freenode.net irc.freenode.net]
mfurr has quit [kornbluth.freenode.net irc.freenode.net]
mellum has quit [kornbluth.freenode.net irc.freenode.net]
mw has quit [kornbluth.freenode.net irc.freenode.net]
mattam has quit [kornbluth.freenode.net irc.freenode.net]
skylan has quit [kornbluth.freenode.net irc.freenode.net]
_shawn has quit [kornbluth.freenode.net irc.freenode.net]
Number17 has quit [kornbluth.freenode.net irc.freenode.net]
rossberg has quit [kornbluth.freenode.net irc.freenode.net]
r_qvisito has quit [kornbluth.freenode.net irc.freenode.net]
det has quit [kornbluth.freenode.net irc.freenode.net]
Banana has quit [kornbluth.freenode.net irc.freenode.net]
interferon has quit [kornbluth.freenode.net irc.freenode.net]
gim has quit [kornbluth.freenode.net irc.freenode.net]
pattern_ has quit [kornbluth.freenode.net irc.freenode.net]
vincenz has quit [kornbluth.freenode.net irc.freenode.net]
Demitar has quit [kornbluth.freenode.net irc.freenode.net]
batdog|gone has quit [kornbluth.freenode.net irc.freenode.net]
TaXules has quit [kornbluth.freenode.net irc.freenode.net]
Oatly has quit [kornbluth.freenode.net irc.freenode.net]
mflux has quit [kornbluth.freenode.net irc.freenode.net]
noj has quit [kornbluth.freenode.net irc.freenode.net]
Hadaka has quit [kornbluth.freenode.net irc.freenode.net]
Hadaka has joined #ocaml
Mike_L has joined #ocaml
Herrchen_ has joined #ocaml
mauke has joined #ocaml
cmeme has joined #ocaml
Amorphous has joined #ocaml
mfurr has joined #ocaml
mw has joined #ocaml
skylan has joined #ocaml
mattam has joined #ocaml
mellum has joined #ocaml
mflux has joined #ocaml
noj has joined #ocaml
interferon has joined #ocaml
gim has joined #ocaml
pattern_ has joined #ocaml
Oatly has joined #ocaml
_shawn has joined #ocaml
rossberg has joined #ocaml
r_qvisito has joined #ocaml
vincenz has joined #ocaml
Number17 has joined #ocaml
det has joined #ocaml
Demitar has joined #ocaml
batdog|gone has joined #ocaml
Banana has joined #ocaml
TaXules has joined #ocaml
<shrimpx> interferon: nope
<Number17> is that because of references that can be assigned to, as well as assignments in classes?
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
interferon has quit ["bed"]
Herrchen has joined #ocaml
Herrchen_ has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
vezenchio has joined #ocaml
zvrba has joined #ocaml
<zvrba> ufff.. could someone tell me in short the advantages of ocaml over lisp?
<zvrba> i'm a C++ programmer who is really missing lambdas (I'm using classes as a poor man's lambdas)
<zvrba> i tend to write functional-style code.. and I'm intrigued by ocaml
<zvrba> but it seems that it has a steep learning curve
<zvrba> what I find missing in Ocaml is easy interfacing to native (C-generated) binary files. functions like perls' pack/unpack (e.g. give a template like 'fL' and binary string and get the tuple with one float and one long)
<zvrba> i wasn't able to find it in the docs...
<shrimpx> Number17: yea
<Snark> re
<Snark> zvrba: lisp is mostly untyped
<Snark> ocaml is strongly typed
<Snark> and the typing is mostly implicit (ie: the compiler determines most types for you)
<det> Ocaml has a nice type system, and it is faster.
<det> Nicer implementation than most lisp/schemes all across the board.
<zvrba> it seems I've found a way to read binary I/o files in ocaml: http://ocaml-lib.sourceforge.net/doc/IO.html
<zvrba> but it seems to have a steep learning curve...
<zvrba> oh well.. maybe some time in the future... i don't have the time right now to start learning a new language :(
<zvrba> although it definetly looks interesting
<zvrba> and a definitive advantage is a single implementation vs. a bunch of different LISP dialects
<zvrba> ok people.. I'm asking people adept in ocaml. how long would it take for me to get productive with ocaml?
<zvrba> I have 10+ yrs of experience in c/c++ and asm programming
<zvrba> and I am very comfortable with the concepts of lisp and scheme
<zvrba> ah and another question: the difference between ocaml and smlnj.
<zvrba> smlnj seems to be popular at AT&T; they are using it for few of their projects, like hancock
smimou has joined #ocaml
_JusSx_ has joined #ocaml
<zvrba> ugh.. I've just read the implementation of red-black trees in ocaml. i'm starting to like this language
<zvrba> i'm amazed how close it is to the conceptual description of rb trees.. and no low-level pointer fiddling like in C
<Snark> oh yes...
<Snark> and pattern-matching... did you read about it yet?
<zvrba> Snark: yes, it's in that chapter. very powerful concept. leading to simple(r) coding style
<Snark> but beware not to turn the old C problem "one function that does it all depending on the parameters" into a pattern-matching equivalent ;-)
<zvrba> and exception handling relies on pattern matching instead on inheritance like C++.. wow :)
<zvrba> Snark: nah, I've overcome that coding style. i prefer more small functions, each doing one job
<zvrba> now.. a serious question. how long would it take for me to become productive in ocaml
<zvrba> are there any small Ocaml challenges that are good for practicing language features
<zvrba> you know, the kind of programming assignments students get when first learning C, Java, or some 'standard' language
<zvrba> wow... I've discovered Int32.float_of_bits :)
<ulfdoz> re
skylan_ has joined #ocaml
schlumpf has joined #ocaml
schlumpf has left #ocaml []
skylan has quit [Read error: 110 (Connection timed out)]
ulfdoz has quit ["deprecated"]
Oatly is now known as Oatmeat
<Oatmeat> What's the difference between the polymorphic types 'a and '_a ?
<vezenchio> the former is polymorphic ie can take any type
<vezenchio> the latter is only a type that could not be determined yet by the type inference algorithm
<Oatmeat> hrm... ok
<vezenchio> the difference is easy to see
<vezenchio> if you have a value x of type 'a
<vezenchio> you can use that value as any type you like further on in the program
<vezenchio> for instance i can use it as an int in a statement 2 * a
<vezenchio> and then later on as a float in a statement 2.0 *. a
<vezenchio> if the type of the value were '_a on the other hand
<vezenchio> then the type of the value would be inferred to be int (and fixed as such) from the first use as an int on
<vezenchio> so if you thentried to use it again as a float later on
<vezenchio> you'd get a type error because int and floatcannot be unified
petter_ has joined #ocaml
<Oatmeat> I see
<vezenchio> (and the type of a changed from '_a to int permanently from the first use of a as an int)
<Oatmeat> I'm still a little confused
<Oatmeat> I have the following
<Oatmeat> type ('a, 'b) imp_t = IMP of ('a -> 'b)
<Oatmeat> let wrap x = IMP x
<Oatmeat> let id = fun p -> p
<Oatmeat> but then "IMP id" has a different type than "wrap id"
<Oatmeat> because "IMP id" has type ('a, 'a) imp_t where "wrap id" has type ('_a, '_a) imp_t
<vezenchio> hm sorry i dont know why it does that either
<vezenchio> but what they types mean is as i explained above
<vezenchio> that is
<vezenchio> after what you said
<vezenchio> if you were to do
<vezenchio> let foo = IMP id and bar = wrap id
<vezenchio> and then later somewhere
<vezenchio> match foo with IMP f -> f 1
<vezenchio> match bar with IMP f -> f 1
<vezenchio> then after that foo's type would still be ('a, 'a) imp_t whereas bar's type would be (int, int) imp_t
<vezenchio> so match bar with IMP f -> f 2.0 would result in a typing error after that
<vezenchio> whereas match foo with IMP f -> f 2.0 would work fine
<vezenchio> what type does wrap have?
<vezenchio> i would have thought that wrap would have type ('a -> 'b) -> ('a, 'b) imp_t
<vezenchio> but iirc the newer versions of ocaml only assign truely polymorphic types to values assigned to as function definition
<vezenchio> i.e.
<vezenchio> let foo bar = ...
<Oatmeat> val wrap : ('a -> 'b) -> ('a, 'b) imp_t = <fun>
<Oatmeat> so yes, the type looks right
<vezenchio> hm thats strange then
<vezenchio> sorry
<vezenchio> i dont know either why it does that
<vezenchio> the typing system has from what i can tell become stricter in which values it assigns truely polymorphic types (ie those with 'a type type variables in them) to
<vezenchio> with recent versions
<Oatmeat> that's ok.. I'm just happy to know what the underscore means
batdog|gone is now known as batdog
ulfdoz has joined #ocaml
paganini has joined #ocaml
ulfdoz has quit ["try 'n' fail"]
ulfdoz has joined #ocaml
Gueben has joined #ocaml
<ulfdoz> mary
<ulfdoz> args, sorry
Schmurtz has joined #ocaml
Amorphous has quit ["arg... must... shutdown... computer burnin..."]
Amorphous has joined #ocaml
Banana has quit [Read error: 104 (Connection reset by peer)]
Banana has joined #ocaml
mattam has quit [Read error: 113 (No route to host)]
mattam has joined #ocaml
Schmurtz has quit [Read error: 110 (Connection timed out)]
_JusSx_ has quit ["leaving"]
GuebN has joined #ocaml
Gueben has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["\o/ in mochintin namocniuh \o/"]
GuebN has quit ["plouf"]
Gueben has joined #ocaml
Snark has quit ["Leaving"]
smimou has quit ["?"]
smimou has joined #ocaml
Nutssh has joined #ocaml
r2d4 has joined #ocaml
<r2d4> How do you break out of a for loop in OCaml?
<mellum> you don't. You use recursion if you need more complicated control flow.
<r2d4> ok! this is going to need some work from me :-)
<smimou> or you can use exceptions...
<r2d4> that seems to fit my imperative brain.
<r2d4> When I need an updatable value, I seem to have to options, use a ref or use a type with a mutable value. What is preferred generally?
<smimou> a ref
<smimou> mutable is when you need records
<mellum> well, a ref is a one-elemented mutable record, so it's really the same
<r2d4> since functional programming seems to be about avoiding updatable values, are those considered necessary evil or just an imperfect shortcut?
<mellum> well, sometimes it's just easier to use a mutable value. I don't think many people think you should completely avoid them
<r2d4> I am trying to get a grasp of all the keywords. So far I found this. http://caml.inria.fr/pub/docs/manual-ocaml/manual044.html. It's a bit dry. Are there any better illustrative references/synopses available?
<mellum> Keywords seem a silly starting point to learn a language... why not follow the tutorial?
<r2d4> mellum: it worked well in the past for me.
petter_ has quit [Read error: 110 (Connection timed out)]
<r2d4> mellum: besides some tutorials don't seem to cover all the keywords.
<mellum> r2d4: well, some of them are pretty obscure.
<mellum> Also it seems to make sense to ignore the OO part of Ocaml when learning it first.
<r2d4> mellum: Is it different from OO in other languages? The basics I read seem OK!
<mellum> r2d4: well, some things might seem usual because type inference needs to work.
<mellum> erm. unusual.
<r2d4> mellum: OK! I will watch for it.
<mellum> But I never use the OO stuff, so I can't really tell.
<r2d4> mellum: BTW, is it hard to make dlls in OCaml? I seem to gather that it is not straight forward and I need to use CAMLIDL.
angagon has joined #ocaml
<mellum> r2d4: I have no idea.
angagon has left #ocaml []
r2d4 has quit ["Chatzilla 0.9.68a [Firefox 1.0.4/20050511]"]
Smerdyakov has joined #ocaml
Smerdyakov has quit ["go"]
mlh has joined #ocaml
Gueben has quit ["plouf"]
paganini has quit ["Leaving"]
noj_ has joined #ocaml
noj has quit [Remote closed the connection]
calvin_ has quit [Remote closed the connection]
calvin_ has joined #ocaml
smimou has quit ["?"]