companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 has quit [Killed (verne.freenode.net (Nickname regained by services))]
infinity0 has joined #ocaml
ryanartecona has joined #ocaml
FreeBirdLjj has joined #ocaml
ryanartecona_ has joined #ocaml
ryanartecona has quit [Ping timeout: 248 seconds]
ryanartecona_ is now known as ryanartecona
FreeBirdLjj has quit [Ping timeout: 240 seconds]
jlam has quit [Ping timeout: 240 seconds]
jlam has joined #ocaml
pierpa has quit [Quit: Page closed]
ziyourenxiang has joined #ocaml
silver has quit [Read error: Connection reset by peer]
copy_ has quit [Quit: Connection closed for inactivity]
ryanartecona has quit [Quit: ryanartecona]
iitalics has quit [Quit: /thread]
FreeBirdLjj has joined #ocaml
malina has quit [Read error: Connection reset by peer]
FreeBirdLjj has quit [Ping timeout: 248 seconds]
ygrek has quit [Ping timeout: 248 seconds]
_whitelogger has joined #ocaml
mfp__ has quit [Ping timeout: 248 seconds]
ziyourenxiang has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 255 seconds]
kalio has quit [Quit: WeeChat 1.9]
sh0t has quit [Ping timeout: 240 seconds]
bombastus has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
ziyourenxiang has joined #ocaml
_whitelogger has joined #ocaml
MercurialAlchemi has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
iitalics has joined #ocaml
jlam_ has joined #ocaml
jlam1 has joined #ocaml
jlam has quit [Ping timeout: 268 seconds]
jlam_ has quit [Ping timeout: 248 seconds]
bombastus has quit [Ping timeout: 258 seconds]
glnerd has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #ocaml
samrat has joined #ocaml
jao has quit [Ping timeout: 260 seconds]
iitalics has quit [Quit: /thread]
moei has quit [Quit: Leaving...]
argent_smith has joined #ocaml
enterprisey has joined #ocaml
argent_smith has quit [Quit: Leaving.]
samrat has quit [Ping timeout: 276 seconds]
argent_smith has joined #ocaml
samrat has joined #ocaml
argent_smith has quit [Quit: Leaving.]
al-damiri has quit [Quit: Connection closed for inactivity]
glnerd has quit [Quit: Leaving]
moei has joined #ocaml
samrat has quit [Ping timeout: 248 seconds]
Algebr has quit [Ping timeout: 248 seconds]
enterprisey has quit [Remote host closed the connection]
samrat has joined #ocaml
andreas_ has joined #ocaml
slash^ has joined #ocaml
mfp__ has joined #ocaml
ziyourenxiang has quit [Ping timeout: 240 seconds]
freusque has joined #ocaml
TheLemonMan has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle-boate has quit [Ping timeout: 248 seconds]
fraggle_ has joined #ocaml
fraggle-boate has joined #ocaml
samrat has quit [Ping timeout: 248 seconds]
sepp2k has joined #ocaml
freusque has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
samrat has joined #ocaml
cranmax has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
sepp2k has quit [Ping timeout: 248 seconds]
sepp2k has joined #ocaml
fraggle-boate has quit [Ping timeout: 276 seconds]
fraggle-boate has joined #ocaml
freusque has joined #ocaml
ziyourenxiang has joined #ocaml
jlam has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
jlam1 has quit [Ping timeout: 240 seconds]
freusque has quit [Quit: WeeChat 1.7.1]
sh0t has joined #ocaml
_aux_ has joined #ocaml
esel has joined #ocaml
jlam_ has joined #ocaml
jlam has quit [Ping timeout: 276 seconds]
jlam has joined #ocaml
jlam_ has quit [Ping timeout: 240 seconds]
jlam_ has joined #ocaml
jlam has quit [Ping timeout: 258 seconds]
_aux_ has left #ocaml [#ocaml]
sh0t has quit [Ping timeout: 268 seconds]
spew has joined #ocaml
freusque has joined #ocaml
samrat has quit [Ping timeout: 248 seconds]
FreeBirdLjj has joined #ocaml
andreas_ has quit [Quit: Connection closed for inactivity]
jlam has joined #ocaml
jlam_ has quit [Ping timeout: 258 seconds]
robertc`` has joined #ocaml
spew has quit [Ping timeout: 260 seconds]
spew has joined #ocaml
nomicflux has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
sepp2k has quit [Quit: Leaving.]
jlam_ has joined #ocaml
jlam has quit [Ping timeout: 255 seconds]
freusque has quit [Ping timeout: 255 seconds]
spew has quit [Ping timeout: 248 seconds]
spew has joined #ocaml
freusque has joined #ocaml
spew has quit [Ping timeout: 240 seconds]
nomicflux has quit [Quit: nomicflux]
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
silver has joined #ocaml
freusque has quit [Quit: WeeChat 1.7.1]
jnavila has joined #ocaml
spew has joined #ocaml
sepp2k has joined #ocaml
samrat has joined #ocaml
robertc`` has quit [Ping timeout: 240 seconds]
sh0t has joined #ocaml
spew has quit [Ping timeout: 260 seconds]
nanoz has joined #ocaml
<nanoz> Lists and arrays are predefined data structures, for example you can have a list of integers:
<nanoz> [ 42; 1; 55 ]
<nanoz> its semicolon to seperate ?
<nanoz> [42,1,55]
<nanoz> going thru http://try.ocamlpro.com
<Fardale> For list it is like : [2;34;1]
<artart78> yes semicolon, with commas it'd be an array of one element which is a tuple
<Fardale> [42,1,55] is a list of tuple [(42,1,55)]
<nanoz> [|"John"; "Doe"|] what is this ?
<nanoz> | ?
<xa0> an array of strings
<xa0> with John and Doe as elements
<artart78> woops I said a mistake, list not array
<nanoz> ["John"; "Doe"] is this fine
sz0 has joined #ocaml
<xa0> that's a list of strings
<nanoz> [|"John"; "Doe"|] this is array of strings ?
<xa0> yes
<nanoz> what is the difference b/w list and arrays ? why didnt ocaml have just array ?
<Armael> they are different structures, and you can do different things with them
<Armael> (this may be surprising if you come from python and are used to the "one structure for all needs")
<Armael> eg with arrays you can access to any element in constant time given its index
<Armael> but extending an array requires allocating a new one and copying the elements of the old one
<Armael> with lists, you can add elements in front in constant time without any copying
<Armael> but you need to walk through the list if you want to access the nth element, for example
<Armael> also, lists are immutable data structures while arrays are mutable
spew has joined #ocaml
ryanartecona has joined #ocaml
ziyourenxiang has quit [Ping timeout: 260 seconds]
<nanoz> isnt arrays are immutable ?
<Armael> arrays are mutable
<Armael> let a = [|1;2|] in a.(0) <- 15; a
<nanoz> oh!
<Armael> a.(i) <- foo writes foo at index i of array a
<nanoz> you can replace the head element of a list too
<nanoz> cant you ?
<Armael> not really, what you can do is constructing a new list with a different head element
<Armael> but the previous list will still exist
andreas_ has joined #ocaml
<Armael> let a = [1;2;3] in
<Armael> let b = 15 :: (List.tl a) in
<Armael> (a, b)
<Armael> this returns ([1;2;3], [15; 2; 3])
<Armael> b is just a new list composed of 15 followed by the "tail" of a
<nanoz> List.hd [1; 2; 3] is to get head, how to get middle element
esel has quit [Ping timeout: 260 seconds]
<nanoz> and tl
<nanoz> List.tl [1; 2; 3]
<Armael> the best is to use pattern matching to destruct a list
<Armael> List.hd / List.tl should be used with care since they can fail (and raise an exception) if the list is empty
<Armael> while pattern matching will ensure you handle all cases
<orbifx[m]> look at `nth` function
<nanoz> why ocaml is weird ; let foo = [1,2,3]; foo[1] /// is far easy
<orbifx[m]> nanoz: because OCaml isn't weir :)
<orbifx[m]> weird*
<Armael> accessing an element by its index is not a primitive operation on lists: it has to walk the list
iitalics has joined #ocaml
copy_ has joined #ocaml
samrat has quit [Ping timeout: 260 seconds]
<nanoz> a high level language should be extremely friendly
jlam_ has quit [Ping timeout: 240 seconds]
jlam has joined #ocaml
iitalics has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
sh0t has quit [Ping timeout: 240 seconds]
jnavila has quit [Ping timeout: 255 seconds]
iitalics has joined #ocaml
<nanoz> by the way i'm from js world :) ((f)=>{f('hello world')})(alert)
<nanoz> as i'm unable to crack in haskell , ocaml is the place i started to learn fp
<thizanne> (fun f -> f "hello world) print_string
<thizanne> doesnt seem much less friendly
<thizanne> you have a "weird" feeling because you're used to languages that basically all work the same
<thizanne> ocaml makes you think differently, which isnt bad but is disturbing at first
<thizanne> just keep practicing until the pieces of the puzzle fit together
iitalics has quit [Remote host closed the connection]
<nanoz> your right
<nanoz> by the way i was choosing good place to learn / start with FP
AlexRussia has joined #ocaml
<nanoz> which is used most in production is it scala or ocaml ?
iitalics has joined #ocaml
AlexRussia_ has joined #ocaml
AlexRussia_ has quit [Client Quit]
<Leonidas> didn't xmlm have a mode to directly parse xml into a tree?
AlexRussia has quit [Ping timeout: 240 seconds]
<Leonidas> nanoz: depends on where you ask. We use 0 Scala in production and >0 OCaml, so /clearly/ Ocaml is used more :p
<Leonidas> nanoz: accessing lists by index is also something that is not done very often in fp code. Fortunately, since that leads to off-by-ones and complicated logic.
<nanoz> 1 more do startup company use Ocaml ?
<Leonidas> nanoz: https://esper.com/ use it, as far as I am aware
shinnya has quit [Ping timeout: 248 seconds]
argent_smith has joined #ocaml
nanoz has quit [Quit: <3]
jnavila has joined #ocaml
<_y> just why python people deemed calling their arrays “lists” was a good idea :-(
tane has joined #ocaml
zv has quit [Quit: WeeChat 1.7.1]
maarhart has joined #ocaml
maarhart has quit [Remote host closed the connection]
zv has joined #ocaml
shinnya has joined #ocaml
jlam has quit [Ping timeout: 255 seconds]
sh0t has joined #ocaml
jlam has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
jlam_ has joined #ocaml
jlam has quit [Ping timeout: 240 seconds]
jnavila has quit [Remote host closed the connection]
ryanartecona has joined #ocaml
jlam has joined #ocaml
jlam_ has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
kakadu has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
jlam_ has joined #ocaml
iitalics has quit [Remote host closed the connection]
iitalics has joined #ocaml
jlam has quit [Ping timeout: 260 seconds]
jlam has joined #ocaml
jlam_ has quit [Ping timeout: 240 seconds]
jnavila has quit [Remote host closed the connection]
tane has quit [Quit: Leaving]
iitalics has quit [Quit: /thread]
iitalics has joined #ocaml
<reynir> Ugh, I'm tired of json web apis that return more or less fields than specified
ryanartecona has quit [Quit: ryanartecona]
iitalics has quit [Quit: /thread]
spew has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
<dxtr> Hmm, can Core handle unicode?
sh0t has quit [Ping timeout: 260 seconds]
argent_smith has quit [Quit: Leaving.]
<octachron> dxtr, it depends a lot on what you mean by "handle" unicode
<octachron> having strings containing unicode data would be fine with core (or even the stdlib)
<octachron> manipulating strings in a unicode-aware way is (like often) more complicated (see the various uus… library by Daniel Bünzli for instance, or camomille)
<dxtr> Right
<dxtr> Is there something like lisps property lists?
<octachron> dxtr, yes and no? If the type of values are homogeneous, there is the Map and Hashtbl modules
<octachron> otherwise the encoding is more complicated, universal map can play this role, there is a corresponding module in Core as far as I remember
andreas_ has quit [Quit: Connection closed for inactivity]
<dxtr> Ah, oka
<dxtr> Okay
<dxtr> I realized I can just create a data type for what I want :)
<orbifx[m]> How related are FP Monads to Leibniz monads? Anyone seen references in papers?
<orbifx[m]> dxtr: nice :)
<octachron> orbifx[m], they are mostly homographs (I imagine that with enough effort one could discover a filliation but it would be very artificial)
jlam_ has joined #ocaml
<orbifx[m]> I remember reading something on this Quora. I think there was some amount of inspiration. Wondered if anyone here has looked into it
jlam1 has joined #ocaml
jlam has quit [Ping timeout: 260 seconds]
jlam_ has quit [Ping timeout: 248 seconds]
pierpa has joined #ocaml
copy_ has quit [Quit: Connection closed for inactivity]
sh0t has joined #ocaml
kakadu has quit [Remote host closed the connection]
jlam1 has quit [Ping timeout: 240 seconds]