Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Year of OCaml?

Name: Anonymous 2015-05-28 4:58

We have recently gotten or will be soon getting, in no particular order:

# multicore (no more GIL)
# flambda
# GC tuning for real time systems
# algebraic effects
# modular implicits

Are we kicking ass yet?

Name: Anonymous 2015-05-28 5:21

fibs get

Name: Anonymous 2015-05-28 18:44

OCaml is OO shit, SML is the real deal.

Name: Anonymous 2015-05-28 19:23

OP, you're doing it wrong:

multicore +. (no +. more +. GIL);
flambda;;
GC +. tuning +. for +. real +. time +. systems;;;
algebraic +. effects;;;;
modular +. implicits;;;;

Name: Anonymous 2015-05-28 19:24

Did they fix arrays yet?

Name: Anonymous 2015-05-28 20:57

tbh i feel like ocaml is becoming overcomplex and losing its ocamlness, not keen on this trend

Name: Anonymous 2015-05-28 21:54

>>1
Too bad the type system still sucks ass.

Name: Anonymous 2015-05-28 22:09

>>3
but 3-kun, nobody uses it¹
1. 'it' meaning both sml and ocaml's object system

>>4
modular +. implicits;;;;
oh shit nigger what are you even doing?

Name: Anonymous 2015-05-29 17:33

>>7
What do you find difficult to understand about the type system?

Name: Anonymous 2015-05-29 19:28

>>8
You're not gonna believe this, but the only way to fix this is to... start using it! Incredible yet true.

Name: Anonymous 2015-05-29 19:36

check'em

Name: Anonymous 2015-05-29 19:49

>>10
Build an ecosystem and they will come. You won't get many OCaml users though.

OCaml's OO is really just a marketing symbol. It's there, it's good as far as these things go. But nobody uses it. SML could be living in this paradise, but like in old times The Jealous God wouldn't tolerate anything He thought was Imperfect. Meanwhile in OCaml we have an Idol of Satan in our courtyard which everyone agrees not to worship... and we have enough people around for that to mean something.

Name: Anonymous 2015-05-29 20:52

>>12
Just use Haskell.
What's the point of a functional language if it's not pure and bloated with all those ;;;;;

Name: Anonymous 2015-05-30 0:09

>>13
all those ;;;;;
What is this about? Are you sure you're not confusing OCaml with Python?

Name: Anonymous 2015-05-30 0:32

>>14
Yep, pretty sure.

https://ocaml.org/learn/tutorials/basics.html

The OCaml syntax is pleasantly concise. Here's a function which takes two floating point numbers and calculates the average:

let average a b =
(a +. b) /. 2.0;;


You'd have to be pretty damn hypocritical to say that ;;; +. ;; .+ ;; /. ;;;;;; is "pleasantly concise".

Name: Anonymous 2015-05-30 0:51

>>15
;;; +. ;; .+ ;; /. ;;;;;;
That's not OCaml either. Are you sure you're talking about OCaml? Maybe that's Ruby?

Name: Anonymous 2015-05-30 0:58

>>16
You, sir, are an idiot.

Name: You, sir, are an idiot. 2015-05-30 1:27

>>17
You, sir, are an idiot.

Name: You, sir, are and idiot. 2015-05-30 2:22

>>19
You, sir, are and idiot.

Name: Anonymous 2015-05-30 3:30

>>21
You, sir, are a idiot.

Name: Clara the Clarifier 2015-05-30 7:51

The ;; are only required at the interpreter.

Name: Anonymous 2015-05-30 15:12

>>21
Really?

Name: Anonymous 2015-05-30 17:30

>>22
Why don't you see for yourself?

Name: Anonymous 2015-05-30 19:22

>>23
$ cat > a.lua
1 + 1
$ lua a.lua
lua: a.lua:1: unexpected symbol near '1'


No I think you need the ;; even on source files. It doesn't work without it.

Name: Anonymous 2015-05-31 3:31

>>4
you're that guy who keeps saying shit like Rust has foced GC aren't you?

Name: Anonymous 2015-05-31 5:42

>>4,24,etc
$ tail -5 look-ma-no-hands.ml
let a = 1 + 2
let b = 2.2 + 3.3
let _ = print a
let _ = print b
let _ = "Have a nice day!" |> print_endline

$ ocaml ./look-ma-no-hands.ml
3
5.5
Have a nice day!


Not featured: +., ; or ;;

Try it yourself at: https://andrewray.github.io/iocamljs/modimp.html

Full disclosure:
$ head -33 look-ma-no-hands.ml
module type Num = sig
type t
val add : t -> t -> t
end

let (+) (implicit N : Num) = N.add

implicit module Num_int = struct
type t = int
let add = Pervasives.(+)
end

implicit module Num_float = struct
type t = float
let add = Pervasives.(+.)
end

module type Show = sig
type t
val show : t -> unit
end

let print (implicit S : Show) x = S.show x

implicit module Show_int = struct
type t = int
let show x = string_of_int x |> print_endline
end

implicit module Show_int = struct
type t = float
let show x = string_of_float x |> print_endline
end

Name: Anonymous 2015-05-31 9:20

>>26
Wow, cool. So pretty much OCaml has both ML modules and typeclasses now? Because implicit module ... = struct looks terribly like instance ... where

Btw, that last block in your code probably should've been

implicit module Show_float = struct
type t = float
let show x = string_of_float x |> print_endline
end

Name: Anonymous 2015-05-31 10:07

Is it just me or does ``OCaml'' sound like it should be a dialect of Perl?

Name: Anonymous 2015-05-31 10:15

>>27
So pretty much OCaml has both ML modules and typeclasses now?

We've got it all pretty much. I saw a beautiful slide somewhere for Monad done with this.

Btw, that last block in your code probably should've been

Damn, you're right. It works the way I had it though, and I think I know why—i.e. unification has to search even shadowed modules.

Name: Anonymous 2015-05-31 10:21

OCaml, the strict and impure Haskell

Name: Anonymous 2015-05-31 10:53

>>28
Well they both have camels on their books. But Perl has butterflies too now.

>>30
I'll take it.

P. S. Haskell ain't pure either dude.

Name: Anonymous 2015-05-31 12:49

>>21
Bullshit.

let fmap (implicit F : Functor) = F.fmap;;
https://github.com/ocamllabs/imp/blob/master/impControl.ml

Name: Anonymous 2015-05-31 14:35

>>26
let _ =
let _ =
let _ =
Maximum bloat.

Name: Anonymous 2015-05-31 17:03

>>32
You may include them if you wish, but they are not required. Basically what you are saying right now is all mice are grey. I'm saying some mice are brown. And you said bullshit and showed me a picture of a grey mouse. Understand?

Name: Anonymous 2015-05-31 20:26

>>32
You're just jelly that OCaml is a greater demon with control over imps.

Name: Anonymous 2015-06-04 5:16

>>33
maximum hangups

Name: Anonymous 2015-06-11 4:49

>>33
I prefer let _ = because ; is too hard to type.

Name: Anonymous 2015-06-11 5:58

I prefer let _ = because throwing away values at the toplevel makes execution obvious.

Name: Anonymous 2015-06-11 7:46

I prefer ( ) because then the span of an expression is completely unambiguous.

Name: Anonymous 2015-06-11 9:13

>>1-39
DISSERTATED

Name: Anonymous 2015-06-11 16:20

>>39
Can you give an example?

Name: Anonymous 2015-06-11 17:09

>>41
Of course not

Name: Anonymous 2015-06-11 17:38

>>42
You just realized (expr) only works on callable expressions, didn't you?

Name: Anonymous 2015-06-12 1:17

>>43
You just realized these dubs are piping hot and ready to be checked, didn't you?

Name: Anonymous 2015-06-12 13:47

>>44
No, please elaborate on what are dubs.

Name: Anonymous 2015-06-12 14:08

>>45
;; are the ultimate dubs. OCaml is the dubnguage.

Name: Anonymous 2015-06-12 20:18

>>46
You've finally convinced me. I'm learning me an OCaml.

Care to advise some learning materials for the language, anyone?

Name: Anonymous 2015-06-12 20:26

Name: Anonymous 2015-06-12 22:22

>>47
OCaml learning resources are not great...

http://ocaml.org/ - the tutorials aren't the best, but can be helpful, there are up-to-date docs here.

http://try.ocamlpro.com/ - online REPL, could be useful.

Some tips:

https://opam.ocaml.org/ - you'll want to use this. Install system OCaml and if you want to upgrade, opam switch. Use opam instead of system packages for packages. You might need system packages for a few, and you'll need the system -dev libraries for a bunch of things.

When you read about functors skip any docs/tutorials that talk about how confusing it might be. It's not a hard concept and the author is just setting you up for failure.

Don't try to understand the types in Printf, at least not at first. It's atypical and Lovecraftian.

FFI used to be a nightmare, but now you can just use ctypes.

Name: Anonymous 2015-06-13 10:50

>>48-49
Thanks.

Name: Anonymous 2015-06-13 19:18

>>50
http://www.lexicallyscoped.com/2015/06/06/intro-to-ocaml.html

It's a recent post with links to different things, including RWO which no one has mentioned yet.

Name: Anonymous 2015-06-13 19:40

>>51
I'm a software developer and team leader living in Gothenburg, Sweden.
I bet there isn't a single Swede on his team, only negroes and arabs, and he also has a cuck-shed.

Name: Anonymous 2015-06-13 22:10

I will do OCaml Q&A in this thread for learning purposes if anyone is interested.

Name: Anonymous 2015-06-13 22:51

>>53
how do you contral linking order in the C FFI?

Name: Anonymous 2015-06-13 23:25

>>54
AFAIK it's the order seen on the command line. I don't do a lot of FFI and most of it ends up being trial and error.

I have a few bookmarks:
http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html
http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.html
http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/calling_ocaml.html

Most of the time you should prefer ctypes unless the overhead is too much for you:
https://github.com/ocamllabs/ocaml-ctypes
https://github.com/ocamllabs/ocaml-ctypes/wiki/ctypes-tutorial

Name: Anonymous 2015-06-13 23:34

>>55
It's like people don't even try with their dubs anymore.

Name: Anonymous 2015-06-13 23:43

>>56
I reserve my dubs for quality posts unlike you shitstains.

Name: Anonymous 2015-06-14 10:49

>>53
Is there a way to have s-exp syntax for OCaml?

Name: Anonymous 2015-06-14 11:05

>>58
Why would you want that? If the answer is metaprogramming, there are better ways to do it... and sexprs are boring when you have a type system that does lambda calculus.

Name: Anonymous 2015-06-14 11:26

>>59
Because s-exps are the superior syntax.

Name: Anonymous 2015-06-14 13:29

>>59 a.k.a haskell the autistic dog

Name: Anonymous 2015-06-14 22:55

>>60
So you're just derailing then? Ok.

Name: Anonymous 2015-06-14 22:57

>>62
No, I'm asking if there's a tool to have s-exp syntax in OCaml. Cause otherwise I'd have to write it myself. There isn't, then?

Name: Anonymous 2015-06-14 23:03

>>63
otherwise I'd have to write it myself

why?

just use normal ocaml syntax

Name: Anonymous 2015-06-14 23:10

>>64
It gives me pain. It's too angular, unbalanced, haphazard and complex. After I tried Lisp, all other syntaxes are not good enough for me. And since Ocaml seems moderately hard to parse, I imagined that someone already did the work. Alas, I'll have to do it myself. Thanks for your (implicit) answer, negative though it may be.

Name: Anonymous 2015-06-14 23:20

>>63
There's a library for inline sexpr data representation. Nobody would want to write OCaml code in sexprs. If you think otherwise, I submit you don't really want to write OCaml.

Name: Anonymous 2015-06-14 23:21

Name: Anonymous 2015-06-14 23:29

>>67
Thanks anon!

>>66
Why so sure? Check this out:

(value x 42)
(value f (lambda x 0))
(value rec f (lambda (x y) 0))
(let ((x 42) (y 27)) (+ x y))
(let* ((x 42) (y 27)) (+ x y))
(module M (struct ...))
(type (t 'a) (sum (A 'a int) (B)))
(lambda (x y) x)
(progn x y z)
(f x y)
(list 1 2 3)
(list x y z :: t)
(, a b c)
(match x ((range 'A' 'Z') "x")))
({} (x y) (z t))

Name: Anonymous 2015-06-14 23:29

you'll cowards don't even smoke camels

Name: Anonymous 2015-06-14 23:46

>>68
I'm not sure that even exists anymore or ever covered much of the language.

Name: Anonymous 2015-06-14 23:56

Name: Anonymous 2015-06-15 0:29

>>71
Funny it's not in my p5 distribution. Anyway, that reads a lot worse than both Lisp and OCaml.

Name: Anonymous 2015-06-15 1:35

>>72
your moms an ocaml

Name: Anonymous 2015-06-15 7:02

>>68
It's...it's beautiful!

Don't change these.
Name: Email:
Entire Thread Thread List