<edwin>
well I found what I was looking for on the mirror :D
<flux>
there shoud be a META mirror-tag, so google could automatically forward search results to a pre-defined mirror site :)
<flux>
(possibly even a browser could learn the mirror site as well)
theDroggl_ has joined #ocaml
theDroggl has quit [Ping timeout: 276 seconds]
<edwin>
is there a way to tell tuareg-mode that I'm using revised syntax? (it doesn't highlight 'value'). ViM doesn't highlight 'value' either...
Edward_ has joined #ocaml
<unkanon_>
good morning, folks
<hcarty>
edwin: For vim, I think you need to define a value to tell the highlighter you're using revised syntax
<hcarty>
edwin: It looks like "ocaml_revised" from the highlighting source, using Markus Mottl's vim files
<edwin>
hcarty: ah ocaml_revised
<unkanon_>
I like to experiment with languages and I'm thinking of switching from Haskell to OCaml
<unkanon_>
I love having types and writing functional code, but being purely functional is a PITA
<unkanon_>
so I was thinking OCaml would be better for me than Lisp because OCaml has types
<unkanon_>
and it's famous for being blazingly fast and easier to write compilers in
<unkanon_>
I'd love to adapt that Write a Scheme in 48 hours project to OCaml (the tutorial writes it in Haskell)
<Smerdyakov>
Maybe blazingly fast compared to Haskell.
<Smerdyakov>
The OCaml compiler doesn't do much optimization.
<Smerdyakov>
GHC is much more advanced in that respect, but the language starts it from a worse baseline.
<unkanon_>
I read that OCaml speeds are like 2x slower than C?
<Smerdyakov>
I could believe it.
<Smerdyakov>
The main thing benchmarking against C will hide is the cost 'ocamlopt' imposes on abstraction.
<unkanon_>
yes but GHC has a bunch of PhDs working on it and writing papers I can't understand :P
<gildor>
unkanon_: 2x slower or less
<Smerdyakov>
Most uses of higher-order functions or functors add run-time costs, even when very simple optimization could remove those costs.
<unkanon_>
gildor: well I was satisfied with 2x but less is even better
<unkanon_>
Smerdyakov: I see
<gildor>
unkanon_: I have done, real life project that almost match C performance
<Smerdyakov>
For that reason and some others, I prefer Standard ML.
<unkanon_>
so but do you guys think somebod familiar-ish with Haskell could easily adapt the Scheme in 48 hours tutorial and write it in OCaml?
<unkanon_>
Smerdyakov: hmm now you got me, maybe I read that standard ML is the language that is that fast...
<gildor>
unkanon_: if you never use OCaml before, you will need more time to learn
<gildor>
unkanon_: no Smerdyakov is pointing that in certain situation (functor) OCaml doesn't optimize as much as possible
<gildor>
unkanon_: but you can write very big program even without functor
<Smerdyakov>
gildor, and common cases of higher-order functions, which are _very_ common.
naufraghi has joined #ocaml
<gildor>
Smerdyakov: I doubt the first lesson of a beginner will be "how to use functor"
<gildor>
Smerdyakov: functor is a pretty advanced feature
naufraghi has quit [Client Quit]
<Smerdyakov>
gildor, are you reading what I'm writing? "Function," not "functor."
naufraghi has joined #ocaml
<mrvn>
I don't have a single program yet where I needed to write a functor.
<Smerdyakov>
mrvn, you also don't have a single program yet where you needed to use anything but S and K combinators.... :P
<gildor>
Smerdyakov: you write "higher-order functions or functors"
<Smerdyakov>
gildor, yes, and I'm focusing on higher-order functions. You're agreeing that that is an important case?
<gildor>
Smerdyakov: you mean anonymous function ?
<gildor>
(fun s -> ...)
<mrvn>
Smerdyakov: bah, you know what I mean
<mrvn>
let sum = List.fold_left ( + ) 0
lamawithonel_ has quit [Ping timeout: 264 seconds]
<Smerdyakov>
gildor, no, any use of higher-order functions. It's standard terminology, but would you like me to define "higher-order function"?
<Smerdyakov>
For instance, I believe that for mrvn's code, 'ocamlopt' will allocate a closure for [( + )] and call it like a closure each time.
<Smerdyakov>
When it is trivial to compile the code to the loop you would write in C.
mnabil has joined #ocaml
<mrvn>
Smerdyakov: while it should inline the code for List.fold_left and inline the + in there
lamawithonel_ has joined #ocaml
<Smerdyakov>
mrvn, right.
<unkanon_>
is that something SML would be better equipped to transform into a loop?
<Smerdyakov>
unkanon_, it's a question of compilers, not languages. OCaml happens to have one compiler, while SML has many. MLton, the best optimizing SML compiler, would give you code equivalent to the natural C loop.
<mrvn>
Smerdyakov: I'm not sure if that happens with ( + ) but there is a weakness there.
<Smerdyakov>
mrvn, you think there is special case closure inlining for operators?
<mrvn>
Smerdyakov: more like for trivial things.
<unkanon_>
I've read many good things about MLton, can't remember where now
joewilliams_away has quit [Excess Flood]
<mrvn>
On the other hand ocaml has better cache locality than C so the fold_left will probably be way faster than C
joewilliams has joined #ocaml
<mrvn>
or it simply doesn't matter and you just want to have fun writing readbale code
<Smerdyakov>
mrvn, I don't agree that this is implied. In C, you can do memory management however you like, so you could often lay-out lists in ways that give _better_ cache locality.
<gildor>
Smerdyakov: I see (and know what high-order functions are), but this kind of optimization has a cost in term of compiler complexity (this is deforestation I think)
<Smerdyakov>
gildor, no, it's a trivial optimization. It's just inlining plus constant folding.
<gildor>
Smerdyakov: and if you really want to get toplevel speed on this, you can deforest by hand
<Smerdyakov>
gildor, (where constant folding must do beta reduction)
<mrvn>
Smerdyakov: but who actually does that?
ttamttam has joined #ocaml
<Smerdyakov>
mrvn, I do, in the Ur/Web compiler.
<gildor>
Smerdyakov: have you submitted a patch to OCaml about that ?
<Smerdyakov>
gildor, no, I don't use OCaml.
<mrvn>
Smerdyakov: then what are you doing here? :)
<gildor>
unkanon_: you can go pretty far in term of speed before finding problems, though OCaml is not perfect and still has a GC and missing features that can improve the compiler
* mrvn
wants type attributes like `Const, `Thread_Local, `Immutable
lamawithonel_ has quit [Ping timeout: 255 seconds]
<gildor>
unkanon_: OCaml matches Haskell speed and can be very good with extra awareness about common problem in OCaml (as Smerdyakov pointed: not-inlining certain structure)
<unkanon_>
what's the one that is said to be popular for compiler writing?
<unkanon_>
that they say the language you write in it will inherit its GC advantages if you want to
<Smerdyakov>
unkanon_, I think all the statically-typed functional languages are much better for compiler writing than usual.
<unkanon_>
I have a friend that wants to dabble in functional programming and he just picked OCaml because I mentioned it but now it turns out I had Standard ML in mind this whole time
<gildor>
unkanon_: don't know, there is thing like freshML that can help you, but this is not about GC
<unkanon_>
gildor: did you mean to say before that ocaml lacks a gc?
<mrvn>
hardly.
<gildor>
unkanon_: of course not, but whenever you have a GC you need to be aware of when you want toplevel performance
<hcarty>
unkanon_: The existing OCaml implementation seems to be pretty "bare-metal" when compared with GHC and MLton. So it is missing some optimizations those compilers provide, but its performance tends to be very easy to predict.
lamawithonel_ has joined #ocaml
<mrvn>
ocaml doesn't (really) optimize. You get what you write.
<unkanon_>
I see.
<gildor>
unkanon_: last time I here about MLton, that was something like "the pb is that a small change can change the whole performance of the application"
<unkanon_>
do any of those two (ocaml or sml) offer laziness?
<mrvn>
ocaml has a Lazy module
<unkanon_>
hmm
<gildor>
unkanon_: there is laziness in OCaml, don't know about sml
<gildor>
unkanon_: about MLton, this makes optimization process a little more complex because you have to find where this small change should be applied (hence be aware of the whole optimization applied to your program)
<hcarty>
gildor: I don't remember if this was there before, but I like the "Report a bug" link in the forge footer. I haven't had an opportunity to use it yet, but now it doesn't require digging to find :-)
<gildor>
hcarty: no, I added it, and indeed I hope it will make the *.ocamlcore.org websites more "participative"
opla2 has quit [Ping timeout: 255 seconds]
<hcarty>
unkanon_: Chances are that learning SML or OCaml will be similarly beneficial for you. One may be better than the other for specific projects, but if you are learning for the sake of learning a language then both are fun.
<hcarty>
unkanon_: And, of course, OCaml is better :-) This is #ocaml after all.
Znudzon has joined #ocaml
<unkanon_>
yeah I'm leaning towards ocaml after having read a stackoverflow thread comparing the two
<Znudzon>
Hi all . I am wondering why i cant make records with tuples like: type m={i:(int,int);j:(int,int)}. Any know solution for this ?
<unkanon_>
hcarty: and then you decided to go with ocaml?
<hcarty>
unkanon_: Yes
<unkanon_>
hcarty: can you tell me one of the decisive factors?
<unkanon_>
for you
<unkanon_>
wow SML doesn't have guards, that's insane
lamawithonel_ has quit [Ping timeout: 255 seconds]
opla2 has joined #ocaml
<hcarty>
unkanon_: Speed, particularly the fact that it's predictable; At the time the community felt more lively and friendly; Library availability may have played a roll.
<hcarty>
unkanon_: One very big factor is and was that the official OCaml distribution includes an interactive toplevel and native code compiler
<hcarty>
So I could write C bindings once and share them between the two
<unkanon_>
well just by comparing #ocaml with #sml here at freenode one can tell how ocaml is ahead at least in that respect
<hcarty>
In SML I would have had to use MLton for compiled code and something else for a REPL
<unkanon_>
hcarty: using that link you gave me, I like ocaml better
<unkanon_>
it's missing "tuple selectors" but even Haskell lacks those
<unkanon_>
and with good reason I think
<unkanon_>
I'll take guards over tuple selector any day
lamawithonel_ has joined #ocaml
ikaros has joined #ocaml
<jm_ocaml>
unkanon_: SML has other advantages over OCaml. To name a few, first-class constructors, anonymous records types, and transparent signature ascription.
<unkanon_>
do both have type inference? (it seems so)
<Smerdyakov>
Yes.
<jm_ocaml>
Yes. Most differences are minor. Whether you prefer SML or OCaml really just comes down to personal preference.
<Smerdyakov>
jm_ocaml, I think MLton's optimization is a point that goes beyond subjective.
<unkanon_>
which one makes mutability more natural? I don't want to have to use State monads for when I need to do mutable array computations in a function that is nevertheless *pure*
<Smerdyakov>
unkanon_, OCaml makes mutable record fields slightly more natural. That's the only difference of the kind.
<jm_ocaml>
Well, yes but that's an implementation issue.
<Smerdyakov>
jm_ocaml, yet the base of implementations has to be taken into account in serious decisions about languages.
<jm_ocaml>
If you go down that route, you should also mention greater availability of libraries in favour of OCaml.
<mrvn>
unkanon_: let x = ref 0 let () = incr x type foo = { mutable x : int; } let foo = { x = 0; } let () = foo.x <- foo.x + 1
lamawithonel_ has quit [Ping timeout: 264 seconds]
<unkanon_>
I'm really leaning towards ocaml anyway
<unkanon_>
so it's a bonus that it makes mutability nicer
<Smerdyakov>
It's a completely minor difference in practice.
<Smerdyakov>
Local syntactic transformations give you the same in SML. This is not the case for transformation to monadic form for Haskell.
<Znudzon>
in ocaml list with integer has type int* list ?
<Smerdyakov>
Znudzon, why do you think that?
<hcarty>
Znudzon: Without the *
lamawithonel_ has joined #ocaml
<Znudzon>
Smerdyakov: i guessed
<Smerdyakov>
Znudzon, which source are you using to learn the language?
<Znudzon>
hcarty: thank you
<mrvn>
"I keep the pig, you keep the daugther."
<Znudzon>
Smerdyakov: i don't use ant kind of source. I had ocaml on university some time ago .
<Smerdyakov>
Znudzon, then you should stop and go read a tutorial.
<hcarty>
unkanon_: Community-wise, we have our trolls but the most active folks tend to be very friendly.
<hcarty>
unkanon_: Often terse, but friendly.
<unkanon_>
:)
<Znudzon>
Smerdyakov: Thats your opinion...
<Smerdyakov>
Znudzon, it's clearly the best way to learn a language. Lecture notes are always nearly worthless, even though it's hard for you to see that as a student.
<Znudzon>
Smerdyakov: i need only one thing from ocaml . I don't need read whole tutorial. I get answer for my question thats all i need
<Smerdyakov>
And then, later, you'll need another thing, and another, until you reach the point where it would have been quicker to read the tutorial in the OCaml manual. It's short.
opla2 has quit [Ping timeout: 276 seconds]
<Znudzon>
Smerdyakov: maybe you have right. I think that when i will have more time i will read some tutorials but not now :)
Edward_ has quit []
yezariaely has left #ocaml []
WonTu has joined #ocaml
WonTu has left #ocaml []
<kaustuv>
My annual attempt to make sense of F# seems to be ending in failure again. Microsoft has nearly succeeded in making the syntax of OCaml *worse*.
<mrvn>
well, being worse than ocaml is pretty easy.
<Smerdyakov>
kaustuv, which parts have you stumped? I used it back in 2005, when, if anything, the support must have been worse... but before they added some stuff. :)
<kaustuv>
I'm not stumped, as such, just irritated to an extreme. The lack of simple luxuries such as C-c C-b in Visual Studio is driving me up the wall.
<adrien>
as vim user: what does it do? :P (build?)
<kaustuv>
Eval buffer in a toplevel running inside Emacs
<kaustuv>
The only VS2010 equivalent I can find is to select entire file and hit Alt-Enter. With the Emacs keybindings that is Alt-< Ctrl-Spc Alt-> Alt-Enter, which is way too much overhead, and makes me lose my cursor position.
Znudzon has quit [Quit: Znudzon]
drunK has joined #ocaml
rixed_ has joined #ocaml
<adrien>
pretty annoying indeed
<kaustuv>
After scratching my head for a while, I've come to realize that the F# object system does not support self types, and hence cannot reasonably encode binary methods. Given that it doesn't have functors either, it seriously limits the kinds of generic things I can write. Eg. I don't see an easy way to write code that is parametric on a type t that supports an operation t -> t -> int.
smerz has joined #ocaml
<kaustuv>
Anyway, my impression is that F# is in no risk of gaining willing converts from OCaml. The .Net platform is an overengineered beast and F# seems dead set on reflecting every feature or misfeature in its syntax. To love it, you must already love .Net.
<Smerdyakov>
I think a key aspect to appreciate is that most programmers choose languages/platforms based on the "no one ever got fired for buying IBM" philosophy.
<Smerdyakov>
Hardly any .NET users really understand the platform and what makes it distinct technically.
<Smerdyakov>
They just want to point to a massive platform supported by an industry giant.
<Smerdyakov>
And F# helps them do that.
<mrvn>
kaustuv: List.fold_left: (t -> t -> int) -> t list -> t -> int?
<mrvn>
aeh, that was fold_right but same thing
Smerdyakov has quit [Quit: Leaving]
init1 has quit [Quit: Quitte]
Smerdyakov has joined #ocaml
Anarchos has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
ikaros has joined #ocaml
ttamttam has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
ftrvxmtrx has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
rixed_ has quit [Ping timeout: 255 seconds]
Lajla has quit [Ping timeout: 276 seconds]
kmicinski__ has joined #ocaml
kmicinski__ has quit [Ping timeout: 255 seconds]
Smerdyakov has joined #ocaml
olauzon has joined #ocaml
unkanon_ is now known as unkanon
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
ocaml_jm has joined #ocaml
jm_ocaml has quit [Ping timeout: 272 seconds]
<edwin>
oasis looks great, filed a couple of feature requests :D
edwin has quit [Remote host closed the connection]