<zozozo>
beginner: it means a representing heterogeneous lists as a tuple whose second element is a tuple, whose second element is a tuple, etc..
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dhil has joined #ocaml
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
<malc_>
zozozo: how is empty list/nil represented?
<zozozo>
a value of type unit
<zozozo>
so you can have : (int * (string * (float * unit))) to represent a hetereogeneous list with three elements for instance
<malc_>
ah, okay gotcha, thanks
Orion3k has quit [Quit: Leaving]
fre has quit [Ping timeout: 244 seconds]
<beginner>
zozozo: a tuple has the same runtime representation as a list?
dhil has quit [Ping timeout: 260 seconds]
<zozozo>
a tuple with 2 elements indeed has the same representation as the Cons(::) list constructor (i.e a block with 2 fields)
<beginner>
zozozo: so this right leaning tuple is represented as a list in memory?
<zozozo>
well, it happens to have the same memory representation as a list
<beginner>
zozozo: maybe stupid question, but does that fact alone make it faster than a tuple with more than two elements?
fre has joined #ocaml
<thizanne>
beginner: it doesnt, but it allows you to add elements
<zozozo>
I don't think so, actually, since lists are represented as a chain of blocks, and a n-tuple as a single block with n fields, I'd say a large tuple is more efficient
<zozozo>
both in terms of space used, and access speed
<beginner>
zozozo: is that information in the documentation? I always find it hard to reason about performance in OCaml
<zozozo>
from what I recall, the documentation avoid mentioning specifics about memory representation
<zozozo>
but rwo has a chapter where they explain the basics of memory layout in ocaml
<beginner>
thizanne: what do you mean that i can add elements to the tuple?
<thizanne>
beginner: you can type val cons : 'a -> 'b -> 'a * 'b; let cons x xs = x, xs
govg has quit [Ping timeout: 256 seconds]
brunoro_ has quit [Ping timeout: 260 seconds]
<thizanne>
but you cannot type something like val cons : 'a -> ('b * 'c * ... * 'd) -> ('a * 'b * 'c * ... * 'd)
<beginner>
zozozo: I have read the book, but i read often things like "A trained eye can glance at OCaml source code and know exactly where memory allocation will occur and how data will be represented in memory." which i can not follow
<zozozo>
well, it takes a while, but knowing how things are represented in memory is not that hard
<zozozo>
seeing precisely where allocations can occur is a lot harder since there are some unusual cases
<beginner>
zozozo: do you have some advice?
<zozozo>
just don't care about that till you have to optimize your program ?
brunoro_ has joined #ocaml
<beginner>
zozozo: do you use tools that show you allocations, i thought the ocamlpro guys are working on stuff like that?
<zozozo>
they do have a memory profiler tool called ocp-memprof , but recently the ocaml compiler has been isntrumented to have its own memory profiler called SPacetime
copy` has quit [Quit: Connection closed for inactivity]
jwatzman|work has joined #ocaml
brunoro_ has quit [Ping timeout: 244 seconds]
<beginner>
i think i have heard about that in yaron minskys tweets
brunoro_ has joined #ocaml
govg has joined #ocaml
_y has quit [Ping timeout: 260 seconds]
tobiasBora has quit [Ping timeout: 258 seconds]
_y has joined #ocaml
tobiasBora has joined #ocaml
copy` has joined #ocaml
al-damiri has joined #ocaml
AlexDenisov has joined #ocaml
dhil has joined #ocaml
hellofunk has joined #ocaml
brunoro_ has quit [Ping timeout: 258 seconds]
govg has quit [Ping timeout: 246 seconds]
nahra has joined #ocaml
petroav has joined #ocaml
silver has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
dmi3y has quit [Quit: dmi3y]
nahra has quit [Ping timeout: 245 seconds]
brunoro_ has joined #ocaml
dmi3y has joined #ocaml
nahra has joined #ocaml
petroav has quit [Ping timeout: 260 seconds]
aphprentice has quit [Quit: Connection closed for inactivity]
nahra has quit [Remote host closed the connection]
sepp2k has joined #ocaml
<frefity>
is there a standard function for taking an even list of items returning a list of pairs?
<frefity>
eg. [1;2;3;4] -> [(1,2),(3,4)]?
petroav has joined #ocaml
<Drup>
frefity: no
AlexDeni_ has joined #ocaml
<frefity>
ok, thanks
AlexDenisov has quit [Ping timeout: 252 seconds]
Algebr` has quit [Ping timeout: 256 seconds]
tane_ has joined #ocaml
d0nn1e has quit [Ping timeout: 256 seconds]
nahra has joined #ocaml
d0nn1e has joined #ocaml
nomicflux has joined #ocaml
petroav has quit [Ping timeout: 260 seconds]
jao has joined #ocaml
dhil has joined #ocaml
<reynir>
hmm, ccpo gets updated and 13 (transitive) dependents need recompiling
al-damiri has quit [Quit: Connection closed for inactivity]
Algebr` has joined #ocaml
dhil_ has joined #ocaml
hellofun` has joined #ocaml
dhil_ has quit [Client Quit]
<kakadu>
Folks, when compiler shows error like `Fatal error: Bytegen.comp_primitive` should it be considered as a bug?
ontologiae has joined #ocaml
hellofunk has quit [Ping timeout: 256 seconds]
zpe_ has joined #ocaml
Algebr` has quit [Ping timeout: 246 seconds]
zpe has quit [Ping timeout: 244 seconds]
sh0t has joined #ocaml
<malc_>
kakadu: i would say - yes, judging by bytecomp/bytegen.ml
shinnya has joined #ocaml
vcre has quit [Quit: Page closed]
gjaldon has joined #ocaml
cpdean has joined #ocaml
cpdean has quit [Client Quit]
cpdean has joined #ocaml
beginner has quit [Quit: Leaving]
Mercuria1Alchemi has quit [Ping timeout: 260 seconds]
<infinity0>
what's the lwt equivalent of >> in haskell?
<infinity0>
i.e. a >> b === a >>= fun () -> b
<infinity0>
writing >>= fun () -> all the time is a bit of a pain
<flux>
well, you can define a >> yourself but you may find that the evaluation order may not be what you hope
<hannes>
there used to be >> in lwt, but is was a camlp4 extension
<hannes>
for now, I'd just write the tiring >>= fun () -> :D
<flux>
I guess you could write a ppx syntax extension for >>, because x >> y is parseable ocaml?
<flux>
ppx can do other transformations than just extension points, right?
<flux>
no?-)
<infinity0>
hm ok i'll just do it the long way round
AlexRussia has joined #ocaml
al-damiri has joined #ocaml
<infinity0>
pr there for you hannes :p
<Bluddy[m]>
flux: Wow you're right! You can even do haskell's flexible associativity/precedence with ppx!
gjaldon has quit [Remote host closed the connection]
gjaldon has joined #ocaml
soupault has quit [Remote host closed the connection]
<reynir>
lwt.ppx has >> I'm pretty sure
hellofun` has quit [Ping timeout: 246 seconds]
fre has quit [Quit: WeeChat 1.4]
jnavila has quit [Ping timeout: 260 seconds]
dmi3y has quit [Quit: dmi3y]
AlexRussia has quit [Ping timeout: 256 seconds]
nopf has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
ryanartecona has joined #ocaml
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shinnya has quit [Ping timeout: 244 seconds]
rdavison has joined #ocaml
brunoro_ has quit [Ping timeout: 260 seconds]
noddy has joined #ocaml
brunoro_ has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
brunoro_ has quit [Ping timeout: 265 seconds]
<Bluddy[m]>
reynir: indeed it is
<Bluddy[m]>
thanks
<Bluddy[m]>
still would be nice to have haskell's flexible operators
aggelos_ has quit [Ping timeout: 268 seconds]
balod has quit [Remote host closed the connection]
balod has joined #ocaml
aggelos_ has joined #ocaml
AlexDenisov has joined #ocaml
AlexDeni_ has joined #ocaml
brunoro_ has joined #ocaml
AlexDenisov has quit [Ping timeout: 246 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
<flux>
you mean arbitrary precedence?
<flux>
because I like how you (person reading the code) can actually determine the structure of expressions without looking at the operator's declaration. even if sometimes you don't get to choose the fancy nice-looking operator you wished for..
AlexDenisov has joined #ocaml
brunoro_ has quit [Ping timeout: 248 seconds]
AlexDeni_ has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
<Bluddy[m]>
yeah i mean arbitrary precedence. Operator-heavy code is going to be hard to parse no matter what. Kudos to you if you remember the precedence rules.
zpe_ has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
hellofunk has joined #ocaml
gjaldon has quit []
<flux>
so when reading that operator-heavy code, you look at the declarations to understand it?
<reynir>
It's not *that* many operator symbols. If you know the precedence of the existing operators...
brunoro_ has joined #ocaml
yomimono has joined #ocaml
jnavila has joined #ocaml
veggie_ has joined #ocaml
kakadu has quit [Remote host closed the connection]
sepp2k has quit [Quit: Leaving.]
fre has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
fre has quit [Ping timeout: 258 seconds]
hellofunk has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
brunoro_ has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
kakadu has joined #ocaml
tane_ has quit [Quit: Leaving]
brunoro_ has joined #ocaml
shinnya has joined #ocaml
malc_ has quit [Remote host closed the connection]
jlongster has joined #ocaml
<jlongster>
anyone here use the kaputt testing library? I have a few questions about it
<jlongster>
first: the docs indicate that `select_list` selects a value from an array, like `Gen.select_list ["foo", "bar", "baz"] (fun x => x)`
<jlongster>
but it appears each item needs to be another generator. is there another function that would achieve the above?
veggie_ has quit [Ping timeout: 245 seconds]
veggie_ has joined #ocaml
FreeBirdLjj has joined #ocaml
<orbitz>
companion_cube: is there a trim function for strings in containers somewhere?
FreeBirdLjj has quit [Ping timeout: 240 seconds]
rdavison has quit [Quit: rdavison]
ryanartecona has quit [Quit: ryanartecona]
rand__ has joined #ocaml
<rgrinberg>
orbitz: don't think you need containers for that. String.term is in the stdlib