companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
azimut has joined #ocaml
dnh has joined #ocaml
infinity0 has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
szkl has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tremon has quit [Quit: getting boxed in]
troydm has quit [Ping timeout: 256 seconds]
waleee has quit [Ping timeout: 252 seconds]
azimut has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
infinity0_ has joined #ocaml
infinity0 has quit [Killed (mercury.libera.chat (Nickname regained by services))]
infinity0_ is now known as infinity0
dnh has joined #ocaml
Serpent7776 has joined #ocaml
Tuplanolla has joined #ocaml
Serpent7776 has quit [Ping timeout: 256 seconds]
szkl has quit [Quit: Connection closed for inactivity]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<greenbagels> Man
<greenbagels> Every time I write the program using lists I'm like "oh but random access would be so much more useful"
<greenbagels> Then every time I rewrite it to use random access I'm like "oh but using the cons pattern matching would be so useful"
euouae has joined #ocaml
<euouae> if anyone cares for the Coq->OCaml and OCaml->C examples in Dune, here they are <https://github.com/createyourpersonalaccount/dune_examples>
Serpent7776 has joined #ocaml
dnh has joined #ocaml
bartholin has quit [Quit: Leaving]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<discocaml> <__muffin> Use an rrb tree
waleee has joined #ocaml
dnh has joined #ocaml
<companion_cube> We could use good implementations of rrb trees and the likes....
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bartholin has joined #ocaml
dnh has joined #ocaml
euouae has quit [Ping timeout: 256 seconds]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
euouae has joined #ocaml
kurfen has quit [Ping timeout: 240 seconds]
kurfen has joined #ocaml
euouae has quit [Remote host closed the connection]
<discocaml> <sim642> Sounds like a job for containers
daimrod has quit [Ping timeout: 256 seconds]
average has joined #ocaml
<companion_cube> Contributions welcome in this case, yeah :)
CodeGerrard has joined #ocaml
Serpent7776 has quit [Ping timeout: 252 seconds]
azimut has joined #ocaml
dnh has joined #ocaml
Serpent7776 has joined #ocaml
Serpent7776 has quit [Ping timeout: 246 seconds]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
habnabit_ has quit [Ping timeout: 268 seconds]
habnabit_ has joined #ocaml
dnh has joined #ocaml
troydm has joined #ocaml
<greenbagels> companion_cube: orly? :p
<greenbagels> you're saying "we" as in ocaml-containers or ocaml's standard library modules?
neiluj has joined #ocaml
<neiluj> Hellow!
<neiluj> Anyone used the Julia programming language, and for which kind of applications?
<neiluj> I'm prototyping numerical algorithms in OCaml using bindings to C libraries but wondering how Julia would compare against that
<neiluj> obviously, Julia's ability to overload operators is a huge plus
bartholin has quit [Read error: Connection reset by peer]
bartholin has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
CodeGerrard has quit [Remote host closed the connection]
CodeGerrard has joined #ocaml
<companion_cube> We in general, the community :)
dnaq has quit [Remote host closed the connection]
dnaq has joined #ocaml
bartholin has quit [Quit: Leaving]
dnh has joined #ocaml
<greenbagels> gotcha
<greenbagels> also curious: is there anywhere to read about the specifics of pattern matching? for example, pattern matching on variant types seems logical, but how does (::) with lists fit into all of this?
azimut has quit [Ping timeout: 240 seconds]
azimut has joined #ocaml
<discocaml> <._null._> type 'a list = [] | (::) of 'a * 'a list
<discocaml> <._null._> They are elements of a variant types with the constructors having syntactic sugar, plus another layer to have [0; 1] be read as 0 :: 1 :: []
<discocaml> <._null._> But it's still a variant type
bartholin has joined #ocaml
<greenbagels> the syntactic sugar being the ability to use an infix operator as a constructor?
<discocaml> <._null._> Yes
<discocaml> <._null._> Well it's a constructor, not an operator, but it's the only one which is parsed inline
<discocaml> <._null._> infix*
<greenbagels> oh so its more like it shares the same look as the cons operator but isn't the same thing
<greenbagels> ?
<discocaml> <._null._> No, it is cons. cons is not an operator, not a function
<greenbagels> OH i think im starting to see it
<discocaml> <Kali> type 'a list = Nil | Cons of 'a * 'a list
<discocaml> <Kali> it's just writing them as [] and :: (infix) instead of Nil and Cons (prefix)
<discocaml> <Kali> Cons (1, Cons (2, Nil))
<discocaml> <Kali> 1 :: 2 :: []
CodeGerrard has quit [Quit: Leaving]
<greenbagels> right; so is the syntactic sugar something that's easily done by user-defined types? i feel like ive only seen it for list, though admittedly i am not an ocaml expert
<discocaml> <Kali> the syntax for list is compiler magic and in general infix constructors are not allowed
<discocaml> <Kali> however, you are able to redefine :: and []
<greenbagels> as in, to be actual functions (doing something else), shadowing the constructors?
<discocaml> <Kali> no, to be constructors
<discocaml> <Kali> of a new type
<discocaml> <Kali> which would shadow them/need type disambiguation
<greenbagels> mmm ok i see
<discocaml> <Kali> for instance, you could make a type of lists that only permitted integers in them:
<discocaml> <Kali> type intlist = [] | (::) of int * intlist
<discocaml> <Kali> the writing ['h', 'e', 'y'] would be a type error
<discocaml> <Kali> oops, substitute , for ;
<discocaml> <Kali> *then
<greenbagels> oh i see
<greenbagels> you're saying you can reuse the same tokens but no other tokens can be used as infix constructors?
<greenbagels> pardon my potentially incorrect wording
<discocaml> <Kali> yes, that is correct
<discocaml> <Kali> you may use [] and :: but these are the only non-alphanumeric constructors permitted to be defined
<discocaml> <._null._> (There's also `()`)
<discocaml> <Kali> to my knowledge
<discocaml> <Kali> oh yes, () too
<greenbagels> does this mean () is by default the constructor for the unit type
<discocaml> <Kali> yes
<greenbagels> I feel like my world view is falling apart lol
<greenbagels> This is great stuff, the kind of better understanding of ocaml i was looking for hehe
<discocaml> <._null._> type unit = | ();;
<greenbagels> Right
<discocaml> <._null._> Cursed things :type bool = () | []
<dh`> lol
<greenbagels> Very cursed
<greenbagels> Could you do the same with Result.t
<greenbagels> by adding a parameter
<dh`> neither of those symbols can syntactically have a parameter
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<greenbagels> Due to the compiler black magic parsing rules?
<dh`> and even most languages that let you screw with notation don't allow defining (x) as a unary constructor instead of an expression
<discocaml> <._null._> They do allow arguments, and it looks vey cursed
<discocaml> <._null._> type t = () of int;; let a = () 0;;
<dh`> oh ew.
<greenbagels> Lovely
<dh`> but at least (0) doesn't work :-)
<greenbagels> You are enabling me to write an entirely new level of cursed ocaml programs
<discocaml> <._null._> Infix (::) can only be binary, but written as a prefix it can also accept any number of arguments
<dh`> although you might be able to arrange to have (a) () and () (a)
<discocaml> <._null._> () (a) is () a so it's accepted if () is unary
<dh`> yes, and (a) () is just a () so you can define it as something
dnh has joined #ocaml
<dh`> hmm, type t = True | () of 'x;; let a () = True
<dh`> I suppose you probably need let a (() _) = True
<dh`> no, then it doesn't typecheck
<dh`> maybe just let a _ = True
<dh`> can't match on it though
neiluj has quit [Quit: Client closed]
<dh`> also, doesn't actually work because you can't partially apply constructors
John_Ivan has quit [Ping timeout: 245 seconds]
bartholin has quit [Quit: Leaving]