FreeBirdLjj has quit [Remote host closed the connection]
Soni is now known as APNG
jwatzman|work has quit [Quit: jwatzman|work]
Simn has quit [Ping timeout: 264 seconds]
jwatzman|work has joined #ocaml
<antoro>
Hello, what is the easiest way to learn OCaml with OO background?
<Drup>
honestly ? the same as if you didn't have OO background.
<Drup>
(just read RWO :p)
govg has quit [Ping timeout: 258 seconds]
FreeBirdLjj has joined #ocaml
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
silver has joined #ocaml
larhat1 has quit [Quit: Leaving.]
larhat has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
govg has joined #ocaml
seangrove has joined #ocaml
sdothum has joined #ocaml
seangrove has quit [Ping timeout: 250 seconds]
Simn has joined #ocaml
ggole has joined #ocaml
<flux>
antoro, I'm afraid OO background may not be that helpful, in fact it might be counterproductive ;-). OO is an advanced subject in OCaml, tool among others, and is not pervasively used in the libraries at all (except select few)
<antoro>
flux, yep, I know that OO background isn't helpful.
<antoro>
(for learning a function language)
<antoro>
function = functional
<flux>
antoro, perhaps the way to go is to do what Drup suggests, read Real-world OCaml (available online) and then (or during) try to write something you need
<flux>
(at some point you might realize that the Core-library RWO uses pervasively isn't the only standard in OCaml world, though ;-))
<antoro>
actually, I don't need anything specific, just interested in learning OCaml :) thank you tough, I'll take a look at Real-world OCaml
<flux>
antoro, well, it really helps to have a target to aim for :)
govg has quit [Ping timeout: 276 seconds]
FreeBirdLjj has joined #ocaml
phase_ has joined #ocaml
larhat has quit [Ping timeout: 250 seconds]
phase_ has quit [Client Quit]
larhat has joined #ocaml
kakadu has joined #ocaml
govg has joined #ocaml
seangrove has joined #ocaml
seangrove has quit [Ping timeout: 265 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
sh0t has quit [Read error: Connection reset by peer]
kolko has quit [Read error: Connection reset by peer]
kolko has joined #ocaml
yomimono has joined #ocaml
nicholasf has quit [Remote host closed the connection]
two_wheels has joined #ocaml
rgrinberg has joined #ocaml
nicholasf has joined #ocaml
<pierpa>
antoro: do you already know about the Ocaml MOOC starting in september?
aphprentice has quit [Quit: Connection closed for inactivity]
tane has quit [Quit: Verlassend]
nicholasf has quit [Remote host closed the connection]
ocamlnewnewbee has joined #ocaml
<ocamlnewnewbee>
I found the argument order is different for if I use "core syntax" for many functions, such as Lisp.map, Array.iter, is there any reason of beign inconsistent?
<ocamlnewnewbee>
I am a beginner, so I am truly confused why it is like this?
<ocamlnewnewbee>
For example, List.map (fun x -> 2*x) [1;3];;
<ggole>
The functions that Core exposes have the same names but different (and labelled) argument orders
<ocamlnewnewbee>
It will have to be "List.map [1;3] (fun x -> 2 * x)" if I set up core.
<pierpa>
Doesn't Core use labeled arguments?
<Armael>
the intended way to use Core functions is to use labeled arguments: you'd write List.map ~f:(fun x -> 2 * x) [1;3]
<Armael>
or List.map [1;3] ~f:(fun x -> 2 * x)
<Armael>
(the point of having a labeled argument is that the order doesn't matter)
<ocamlnewnewbee>
I see. So I guess it is a common practice to mostly use labeled arguments when using core?
<Armael>
yea, I think "List.map [1;3] (fun x -> 2 * x)" works because of the way labels are implemented, but you are supposed to use a label ~f
<ocamlnewnewbee>
Nice. very helpful. Thanks a lot!
agarwal1975 has quit [Quit: agarwal1975]
ocamlnewnewbee has left #ocaml [#ocaml]
al-damiri has joined #ocaml
<mrvn>
Armael: labels can be skipped if the application is not possibly partial
sepp2k has joined #ocaml
ocamlnewnewbee has joined #ocaml
copy` has joined #ocaml
seangrove has joined #ocaml
rgrinberg has quit [Quit: WeeChat 1.5]
rgrinberg has joined #ocaml
ocamlnewnewbee has quit [Quit: Lost terminal]
seangrove has quit [Ping timeout: 276 seconds]
ocamlnewnewbee has joined #ocaml
<ocamlnewnewbee>
Why the executable size is huge even if the code only have two lines to print out a string array? It is about 29MB if I use the following command:
<ocamlnewnewbee>
and it is still huge if I replace ocamlc with ocamlopt.
<ocamlnewnewbee>
However, without using core, the exe file significantly reduced to "normal", ~500K.
<pierpa>
that's because Core is a huge library
<flux>
it is due to two reasons: 1) core is one big module (Core.*), that is all taken into use when you use any part of it, instead of separate modules 2) ocaml doesn't have a smart mechanism for eliminating unused parts of modules
<flux>
so the ocaml mechanism works only at module level. if you link in a .cma that has unused modules, those are not linked in. but if they are used, the complete module is linked in.
<flux>
apparently Core also has been split into parts you may be able to use if you're worried about binary size, ie. Core_kernel. not sure what it has and what a typical program needs.
<flux>
it might be that the flambda introduced in 4.03 will pave way to good dead code elimination in the final phase?
<flux>
the documentation says "Flambda provides full optimisation across different compilation units, so long as the .cmx files for the dependencies of the unit currently being compiled are available. (A compilation unit corresponds to a single .ml source file.) However it does not yet act entirely as a whole-program compiler: for example, elimination of dead code across a complete set of compilation units is not supported."
<flux>
so "not yet" gives us hope.. :)
<flux>
I guess after a proper dead code eliminator small ocaml programs get to be really small
<flux>
do the ocaml/javascript guys use some dead code eliminators?
mbrock has quit [Quit: Connection closed for inactivity]
mengu has joined #ocaml
govg has quit [Ping timeout: 260 seconds]
<Armael>
yes, js_of_ocaml performs dead code elimination
<flux>
and js_of_ocaml works on ocaml bytecode?
<Armael>
yes
<Armael>
and it is fed the bytecode for the whole program so it has whole program information
<flux>
so I guess that's not a solution the native compiler could just plug in and use.. but maybe the byte code compiler could?
<Armael>
no because of modular compilation
<mrvn>
the native code compiler gets all modules too and every module has all the functions and values and their code in them. No reason one couldn't eliminate dead code.
seangrove has joined #ocaml
<antoro>
pierpa, thank you for the MOOC link!
<ocamlnewnewbee>
@ flux, thanks a lot for the explanation!
demonimin has quit [Remote host closed the connection]
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
demonimin has joined #ocaml
agarwal1975 has joined #ocaml
two_wheels has joined #ocaml
mengu has quit [Remote host closed the connection]
rgrinberg has quit [Quit: WeeChat 1.5]
ocamlnewnewbee has quit [Quit: Lost terminal]
mengu has joined #ocaml
mengu has quit [Changing host]
mengu has joined #ocaml
rgrinberg has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Ping timeout: 244 seconds]
rgrinberg has joined #ocaml
Mercuria1Alchemi has joined #ocaml
FreeBirdLjj has joined #ocaml
dexterph` has quit [Ping timeout: 244 seconds]
SilverKey has joined #ocaml
mengu has joined #ocaml
govg has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
slash^ has joined #ocaml
FreeBirdLjj has joined #ocaml
ygrek_ has joined #ocaml
shinnya has joined #ocaml
zpe has quit [Remote host closed the connection]
jwatzman|work has quit [Quit: jwatzman|work]
mengu has quit []
johnelse has joined #ocaml
<antranigv>
I met Algebr yesterday, I liked OCaml a lot, I might use it for my daytoday stuff!:))
<antranigv>
ad it seems aeasy to learn as well! :)
<antranigv>
btw, there's a small change needs to be done in the installation manual for Gentoo. change emerge ocaml to emerge dev-lang/ocaml please? :) because we have 2 ebuilds with the name ocaml.