Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lpw25
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
31.
▲
by
lpw25
12y ago
OCaml's object/class system is actually pretty good. It isn't used very often in OCaml because most of what OO gives you can be more naturally expressed in other parts of the language, but that doesn't mean that it'
32.
▲
by
lpw25
12y ago
I think all the pieces are there to do that (e.g. cohttp, yojson, atdgen, PG'OCaml), although perhaps not in a single easy to use framework. Maybe http://rgrinberg.com/blog/2014/04/04/introducing-opi
33.
▲
by
lpw25
12y ago
Indeed using the improved OCaml inliner ( http://www.ocamlpro.com/blog/2013/07/11/inlining-progress-re... ) on the original OCaml gives a speedup of 2.75.
34.
▲
by
lpw25
12y ago
By replacing the distance function with: let distance (a1 : int array) (a2 : int array) = let open Array in let len = length a1 in let acc = ref 0 in for i = 0 to len - 1 do let v1 = unsafe_get a1 i in
35.
▲
by
lpw25
12y ago
It's "mu" not "miu". I think they gave a talk on it at CUFP one year.
36.
▲
by
lpw25
12y ago
I think that js_of_ocaml 2.0 added support for compiling mutually recursive functions using trampolines. So that compiler is back to being right again.
37.
▲
by
lpw25
12y ago
> Functional programming is about programming with functions Actually I think the etymology of "functional programming" comes for programming with functions as first-class objects. So a "functional programming language&quo
38.
▲
by
lpw25
13y ago
Lisp is the original functional language. Functional language traditionally meant a language that emphasised functions as values, in particular supporting higher-order functions. Hence the word "functional". More recently, people
39.
▲
by
lpw25
13y ago
> Ocaml's compiler is also slow Umm, no it isn't. I'm not sure I'm aware of a faster compiler. It's so fast most people don't even realise that they are running the byte code version (ocamlc) rather than th
40.
▲
by
lpw25
13y ago
I rather think lambdas, generics and type inference are straight out of ML, especially as hack is written in OCaml.
41.
▲
by
lpw25
13y ago
I think they mentioned something in the browser using js_of_ocaml at CUFP last year.
42.
▲
by
lpw25
13y ago
Also, only some things in OCaml are structurally typed (modules, objects, polymorphic vairants), others are not (records, variants). For example: # type meters = I of int;; type meters = I of int # let meters i = I i;; va
43.
▲
by
lpw25
13y ago
Abstraction provides the equivalent of nominative typing. It is easy to differentiate between 12 meters and 12 Newtons with OCaml's type system. In general, it is easy to get nominative behaviour out of a structural system. It is much
44.
▲
by
lpw25
13y ago
Pull requests welcome: https://github.com/ocaml/ocaml.org/tree/master/site/learn/tu...
45.
▲
by
lpw25
13y ago
Note that using `unsafePerformIO` is more unsafe than that, because the compiler assumes that functions are pure and will make transformations which alter the semantics in the presence of side effects. The OCaml compiler does not do these o
46.
▲
by
lpw25
13y ago
It's not a strawman. Just look at the code for reverse-complement in Haskell. It is full of strictness annotations (unidiomatic) and uses inlinePerformIO (unsafe). It also uses a few inlining pragmas (unidiomatic). The fact that this c
47.
▲
by
lpw25
13y ago
> So, fast code. Which is what is at question. No the question is about whether fast code is easy to write, if it has to be highly tuned then it is not easy to write. > I'm pretty sure the language shoot-out is of greater value a
48.
▲
by
lpw25
13y ago
> No he didn't. He took the time to learn ocaml. Not before writing his initial benchmarks, which is what we're talking about. > The closest thing to evidence I can find suggests that it is no more difficult to write fast co
49.
▲
by
lpw25
13y ago
> Even if you were to erroneously say that, it isn't type classes that is the problem. I'm pretty sure it is. For example, see section 3.7 of "Type classes: an exploration of the design space" by SPJ et al.
50.
▲
by
lpw25
13y ago
> He literally didn't learn haskell and copy and pasted random stuff from stackoverflow and irc But that's the point right. He did the same for OCaml and got faster code. Obviously you can write fast code in Haskell, but that