n06rin has quit [Read error: Connection reset by peer]
n06rin has joined #ocaml
demonimin has joined #ocaml
ygrek_ has joined #ocaml
n06rin has quit [Read error: Connection reset by peer]
n06rin has joined #ocaml
watermind has quit [Quit: Konversation terminated!]
ygrek_ has quit [Ping timeout: 264 seconds]
talzeus has quit [Remote host closed the connection]
Neros has quit [Read error: Operation timed out]
chambart has joined #ocaml
chambart has quit [Ping timeout: 264 seconds]
ygrek_ has joined #ocaml
structuralist has joined #ocaml
n06rin has quit [Ping timeout: 264 seconds]
n06rin has joined #ocaml
bondar has quit [Ping timeout: 246 seconds]
zarul has quit [Ping timeout: 268 seconds]
zarul has joined #ocaml
ben_zen has quit [Quit: sleeeeep]
<adrien>
morning
<adrien>
pippijn: thinking again about the things I can and can't do with pmake, I'm really seeing how gmake has to be quite a lot more complicated and slower
<adrien>
but some of the gmake stuff is really useful =/
talzeus has joined #ocaml
callen has quit [Changing host]
callen has joined #ocaml
talzeus has quit [Remote host closed the connection]
n06rin has quit [Ping timeout: 240 seconds]
ygrek_ has quit [Ping timeout: 260 seconds]
n06rin has joined #ocaml
chrisdotcode has joined #ocaml
hto has quit [Quit: Lost terminal]
hto has joined #ocaml
structuralist has quit []
Yoric has joined #ocaml
talzeus has joined #ocaml
Yoric has quit [Ping timeout: 248 seconds]
ulfdoz has joined #ocaml
Simn has joined #ocaml
Yoric has joined #ocaml
talzeus has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 248 seconds]
talzeus has joined #ocaml
chrisdotcode has quit [Ping timeout: 240 seconds]
Myk267 has joined #ocaml
talzeus_ has joined #ocaml
talzeus has quit [Ping timeout: 268 seconds]
ollehar has joined #ocaml
Snark has joined #ocaml
ollehar has quit [Read error: Connection reset by peer]
chrisdotcode has joined #ocaml
ollehar has joined #ocaml
ggole has joined #ocaml
Yoric has joined #ocaml
weie_ has quit [Quit: Leaving...]
j0sh has quit [Ping timeout: 246 seconds]
j0sh has joined #ocaml
Yoric has quit [Ping timeout: 248 seconds]
testcocoon has quit [Quit: Coyote finally caught me]
n06rin has quit [Ping timeout: 264 seconds]
testcocoon has joined #ocaml
chrisdotcode has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 245 seconds]
mfp has joined #ocaml
asmanur has quit [Read error: Operation timed out]
asmanur has joined #ocaml
<gasche>
asmanur: I would like to know what you changed in mlorg to adapt to 4.01
<gasche>
your 0.1.2 archive decompresses into a 0.1.1 directory
<gasche>
(I tried to diff the two archives and that made it more painful that it should be)
xavierm02 has quit [Remote host closed the connection]
xavierm02-A-P has joined #ocaml
xavierm02 has joined #ocaml
xavierm02-A-P has quit [Ping timeout: 264 seconds]
Drup has quit [Read error: Operation timed out]
wmeyer has joined #ocaml
<wmeyer>
hello.
xavierm02-A-P has joined #ocaml
<adrien>
\o
<wmeyer>
o/
<pippijn>
hi wmeyer
<pippijn>
how's it going?
wmeyer has quit [Ping timeout: 240 seconds]
<adrien>
I like to think he's depressed because he has too much to do
xavierm02-A-P has quit [Ping timeout: 264 seconds]
<adrien>
:D
<pippijn>
haha
<pippijn>
I know that feeling, though :/
<pippijn>
but only when I'm not working
<adrien>
he asked me for patches, I sent him 11 patches and a couple big ones :)
pango has quit [Quit: Client exiting]
pango has joined #ocaml
xavierm02-A-P has joined #ocaml
pango has quit [Read error: Operation timed out]
xavierm02 has quit [Ping timeout: 256 seconds]
ygrek has quit [Ping timeout: 260 seconds]
pango has joined #ocaml
tobiasBora has joined #ocaml
tane has joined #ocaml
Drup has joined #ocaml
xavierm02-A-P has quit [Read error: Operation timed out]
xavierm02-A-P has joined #ocaml
xavierm02 has joined #ocaml
xavierm02-A-P has quit [Ping timeout: 260 seconds]
xavierm02-A-P has joined #ocaml
xavierm02_ has joined #ocaml
xavierm02-A-P has quit [Read error: Operation timed out]
xavierm02_ has quit [Read error: Connection reset by peer]
xavierm02 has quit [Ping timeout: 264 seconds]
tobiasBora has quit [Quit: Konversation terminated!]
n06rin has quit [Quit: Leaving.]
tobiasBora_ has joined #ocaml
Snark has quit [Ping timeout: 268 seconds]
xavierm02 has joined #ocaml
xavierm02 has quit [Ping timeout: 252 seconds]
dsheets has joined #ocaml
xavierm02 has joined #ocaml
beginner42 has quit [Quit: Leaving]
testcocoon has quit [Quit: Coyote finally caught me]
testcocoon has joined #ocaml
<aggelos_>
hmm. I'm writing a program which is doing comparisons of somewhat complex data structures
<aggelos_>
so I'm juggling too many balls there and I was wondering if I could use the type system to make sure I won't ever mix which side a given subset of the data structure is from
<aggelos_>
so some kind of Left/Right type wrapper around the same basic types, which ensures you can only generate lists of types wrapped with Left or similarly for Right, but you can't mix them up
<aggelos_>
not quite sure how I'm supposed to do that though
<aggelos_>
is that even possible?
<aggelos_>
I'm more than glad to do my own digging if someone can provide pointers :)
<Anarchos>
why not use the standard = ?
walter has joined #ocaml
Snark has joined #ocaml
<aggelos_>
Anarchos: I'm sorry, was that addressed to me?
tobiasBora_ has quit [Ping timeout: 267 seconds]
<xavierm02>
aggelos_ : I'm not sure what you want but you might want to look up phantom types. And I think Anarchos' question was indeed for you and unless your structure is made so that you can have reference loops, you probably should use = like he said.
yacks has quit [Quit: Leaving]
<xavierm02>
wait
<xavierm02>
you have a tree and you want to remember if your node came from the right or the left?
<gasche>
aggelos_: OCaml does not have the perfect solution to your problem, which is an explicit cooercion to a non-unifiable type
<gasche>
I'd say the simplest thing is to use
<gasche>
type 'a left = Left of 'a
<gasche>
type 'a right = Right of 'a
<gasche>
and wrap your values with Left and Right as appropriate when you access them
<gasche>
another solution would be to wrap your code in a functor
<gasche>
module Data(M : sig type 'a t type left type right) = struct ... end
<gasche>
in the code you can use (left t) and (right t) as distinct types, but then instantiate the functor such that they actually are the same
<gasche>
(one issue with this encoding is that you don't have aspect to the underlying type of your values, only their left or right-ness; if you cannot be polymorphic on the types of the data structure, you have to add one more type parameter to t)
<aggelos_>
gasche: right, I was going to ask that. the structure of the code is that two external files are analyzed (complex data structures being built and all) and then I need to do the left/right comparison
<aggelos_>
so I need to be able to access all the elements constituting the data structures with compare_nodeset (l : LeftNodeset) (r : RightNodeset)
<aggelos_>
which would recurse (well, it's more complicated than that, but...) into compare_node (l : LeftNode) (r : RightNode) and so on
<gasche>
I think you should try the really simple (type 'a left = Left of 'a) approach first
gnuvince has joined #ocaml
gnuvince has quit [Changing host]
gnuvince has joined #ocaml
<gasche>
its only issue is that wrapping and unwrapping Left/Right has a performance cost
<gasche>
if you have code working in this style, you can try to convert to more complex solutions that remove that performance cost (such as the abstraction over phantom types I proposed)
<aggelos_>
fair point
<gasche>
but doing both at the same time looks like a sure path to mental exhaustion
<aggelos_>
alright, I'll try that first then
<aggelos_>
thanks, that helps a lot
walter has quit [Quit: This computer has gone to sleep]
<Anarchos>
gasche your insights on types and modules are much more powerful than mines :)
walter has joined #ocaml
Neros has quit [Ping timeout: 268 seconds]
milosn has quit [Read error: Operation timed out]
as has quit [Quit: Connection closed for inactivity]
testcocoon has quit [Quit: Coyote finally caught me]
walter has quit [Quit: This computer has gone to sleep]
testcocoon has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
testcocoon has joined #ocaml
tobiasBora_ has joined #ocaml
walter has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
yacks has joined #ocaml
hellome has joined #ocaml
hellome has quit [Read error: Connection reset by peer]
chambart has joined #ocaml
hellome has joined #ocaml
testcocoon has joined #ocaml
tobiasBora_ has quit [Quit: Konversation terminated!]
<gasche>
Anarchos: that's unrelated, but I don't like the built-in polymorphic comparison functions
<gasche>
they're a defect, from a language design point of view
darkf has joined #ocaml
<companion_cube>
for which typeclasses would be the perfect fix ;)
<aggelos_>
gasche: so if I have code that does List.combine left right (or hand-coded functions with similar signatures) and I want to preserve the left/right-ness in the resulting pairs, what would be an elegant way to handle that?
<gasche>
well
snearch has joined #ocaml
<gasche>
if "left" is of type (foo left list) and "right" of type (bar right list), you'll get a (foo left * bar right) list as a result
<ggole>
List.combine doesn't 'merge' the types or anything
<aggelos_>
ah sorry, it's foo list left etc
<gasche>
ah
<gasche>
in that case you have to implement a function ('a list left -> 'a left list)
<gasche>
(or change your code to produce an ('a left list) in the first place)
xavierm02 has quit [Ping timeout: 256 seconds]
Arsenik has joined #ocaml
<aggelos_>
well, when the most general containers to be compared are generated, it's not entirely clear which will be right and which will be left, so I can't easily do the latter
<aggelos_>
the thing is, list is not the only container I'm dealing with
<aggelos_>
so I'd like to have a more generic approach
<aggelos_>
hmm. possibly I should be going through .enum to do such packing/unpacking
<aggelos_>
hmm
<aggelos_>
no, I don't think that'll work either
<gasche>
if each container provides a "map" function, writing the left-traverse shouldn't be hard in term of code lines
<mfp>
gasche, companion_cube: any idea about how the work on implicits is going? (re: modular type classes as killer app for applicative functors)
<gasche>
the thing is, later you'll want to change your code in a different style where ('a list left -> 'a left list) is the identity function
<companion_cube>
mfp: no idea
<companion_cube>
gasche: better provide a fold operator
<gasche>
mfp: not very fast because Pierre and Grégoire are busy with other things
<gasche>
(Grégoire is working on a very related topic, Pierre on compiler optimizations)
<mfp>
the other side so to speak (inlining across functorization and HOFs) seems to be moving nicely indeed
<adrien>
ah, right, I need to bribe hnrgrgr to work on ocaml-ty :P
<adrien>
hnrgrgr: oh, btw, I talked to you about ocaml-ty at the last oups; it worked well for what I wanted =)
<adrien>
hnrgrgr: but you need to fix the testsuite :P
<aggelos_>
hmm
<aggelos_>
let lr_bind (le : BatEnum.Enumerable left) (re : BatEnum.Enumerable right) (f : 'a -> 'a -> ('b, 'b)) -> ('b, 'b) BatEnum.t
<aggelos_>
possibly something like that
testcocoon has quit [Quit: Coyote finally caught me]
<aggelos_>
ah, missing the left/right in the results
<aggelos_>
*return type
walter has quit [Quit: This computer has gone to sleep]
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
testcocoon has joined #ocaml
<Anarchos>
gasche yes i agree for the default comparison (=)
ulfdoz has quit [Read error: Operation timed out]
testcocoon has quit [Quit: Coyote finally caught me]
xavierm02 has joined #ocaml
milosn has joined #ocaml
testcocoon has joined #ocaml
<xavierm02>
gasche : When you say "I'd expect an user to rather represent infinite structures another way, or use a purity assumption on either arguments, to use a specialized implementation with O(1) memory consumption", 1) How would you expect infinite structures to be implemented? 'a -> bool ? 2) What do you mean by "purity assumption"? Having a function f:'a -> 'a in O(1) so that f(u_n)=u_{n+1}?
<jpdeplaix>
hnrgrgr: you should also consider merging ocaml-ty and ocaml-implicit with trunk (you can do it with the github mirror, I tried)
beginner42 has joined #ocaml
bondar has joined #ocaml
snearch has quit [Quit: Verlassend]
testcocoon has quit [Quit: Coyote finally caught me]
Yoric has joined #ocaml
chambart has quit [Ping timeout: 264 seconds]
testcocoon has joined #ocaml
ulfdoz has joined #ocaml
<gasche>
xavierm02: one of the (somewhat implicit) guarantees of Stream and Enum is that if producing the next element produces a side-effect, this effect will only be performed once (even if you access the effect several times)
Yoric has quit [Ping timeout: 248 seconds]
<gasche>
so if you implement a function take_n : int -> 'a list option that returns the n next element of the enum (without popping them, that is), you *must* store those elements somewhere to return them when someone asks them again
Yoric has joined #ocaml
<gasche>
in the context I was discussing, a purity assumption would be "it's fine to call next() two times instead of memoizing the result"
<gasche>
which is more or less what the Seq data-structure of Batteries does
<gasche>
(Seq don't require cloning, you can just call the "next" function again)
<xavierm02>
so then it would take that Enum with the purity assumption on a specific side and simply go though it to get the next element instead of storing it?
<xavierm02>
I don't think I understand what you're saying >_<
<companion_cube>
I think that if you want memoization then lazyList is the right thing
<companion_cube>
otherwise, an iterator should be consumable
Drup has quit [Ping timeout: 256 seconds]
<gasche>
xavierm02: to compute the cartesian product, you have to output the same element again and again
<gasche>
with Enum, once you forced an element once, you have to store it for as long as it may be needed again
<gasche>
with Seq, you can simply call the corresponding "next()" function again, without having to store it anywhere in the meantime
<xavierm02>
companion_cube : it was about computing the cartesian product of two possibly infinite enums. So you have to enumerate the "diagonals" which means going though the first n elements of one list in the "normal" order and backwards on the other list. So having a lazyList would make it O(n^2). If there was a doubly-linked-lazylist, I'd use it but untill then, I'll stick to Enum + dllist :)
walter has joined #ocaml
<companion_cube>
oh oO
<companion_cube>
I didn't thnk it would be assuming the enums could be infinite
Myk267 has quit [Quit: Myk267]
<gasche>
xavierm02: note that you could reuse you dllist trick with lazylists as well
<xavierm02>
companion_cude : well otherwise, you would just get them in the lexicographical order and it wouldn't be funny :D
<gasche>
but lazylist have the same problems as enums here: enumerating elements of the cartesian product consumes and ever-growing amount of memory
<xavierm02>
yes
<gasche>
(square root of the output size for a good impl. such as yours, but nonetheless)
Yoric has quit [Ping timeout: 248 seconds]
<xavierm02>
it only happens when both are infinite though
<gasche>
I don't understand, it happens each time you use this implementation
<xavierm02>
no
<xavierm02>
the infinite amount of memory is only if both sets are infinite
<gasche>
infinite, yes
<xavierm02>
and otherwise
<gasche>
but "ever-growing as long as there are still elements" holds even in the finite case
<xavierm02>
yes
<xavierm02>
but the size of the dllist is the size of the smallest enum
<companion_cube>
it looks reasonable to ask one of the enum to be finite, to me
<gasche>
I think as well, but xavierm02 has a different usecase where an infinite-resilient enum is important
<gasche>
I'm fine with having an implementation for this as well, but I'm saying that I suspect Enum are not the right level of abstraction because of this memory-consumption issue
<xavierm02>
what would the right level of abstraction be?
<companion_cube>
gasche: what do you think of the idea of just using standard streams, as in biocaml ?
dnm has joined #ocaml
<gasche>
standard streams don't support cloning and fast-counting
<gasche>
if you don't need any of those, I'm fine with streams
<gasche>
that said
<gasche>
the Enum implementation is insane
<gasche>
but Stream is not much better
<gasche>
If you want to keep things simple even under the abstraction boundary, I don't think any of those library meet the goal
<gasche>
(maybe your Sequence is better)
<gasche>
as I said, I think there is an open research problem
<gasche>
(at least a research problem; I'm not certain that I have looked at related work hard enough)
<gasche>
xavierm02: I mostly don't know your problem domain so I couldn't recommend an abstraction level
<gasche>
but for the *specific* task of computing diagonals of infinite structure, Seq looks like a better choice, if you indeed can make this purity assumption I'm talking about
<gasche>
(I don't know)
<companion_cube>
gasche: yes, but I feel like Enum is trying to do too much
<gasche>
I think we proper understanding of the principles, it should be doable
<gasche>
people implement concurrent copy-on-write data structures
<gasche>
Enum is perhaps surprisingly close in terms of difficulty, but definitely not harder
<companion_cube>
otoh, a good iterator abstraction should also be lightweight
<gasche>
hm
<companion_cube>
I read some code of format.ml, and the defintion of formatter was awfully *big*
<gasche>
if I had enough time, I would suggest we band together to do the basics of an Enum formalization by the JFLA deadline :]
<gasche>
unfortunately I'll be leaving next week and my plate is full until then
<gasche>
and I feel it's rather a few months' work than a few weeks
<gasche>
companion_cube: the new code by Benoît Vaugon ?
bjorkintosh has joined #ocaml
bjorkintosh has left #ocaml []
<companion_cube>
no, the old one in 4.00
<gasche>
ah
<companion_cube>
it's just the type formatter itself, an huge record
<companion_cube>
a*
<gasche>
ah you mean the pretty-printer
<gasche>
yeah, it's hairy code
<gasche>
PPrint is maybe a bit nicer
<companion_cube>
yeah
<companion_cube>
the thing I like in Sequence is how lightweight it is ^^
<companion_cube>
but it's not powerful enough for many uses
<xavierm02>
Well I don't have a "problem". I just want (mostly for fun) to represent set, monoids, groups, rings, fields in ocaml. And since I want to be able to "see" what set I have, I want to be able to print a few elements and therefore to enumerate the elements of the set. Also, being able to enumerate the elements make it easier to run some tests etc.
walter has quit [Quit: This computer has gone to sleep]
<companion_cube>
then, can't you take a few elements for each set, and take their product?
<companion_cube>
if they're infinite it won't make any difference, you can't compute the full product
<xavierm02>
well I could do that
<xavierm02>
but I can also have my thing listing them all and just take the first n elements when I print and add ...
walter has joined #ocaml
<xavierm02>
the only problem with my script is the memory it uses on big sets but If I only compute 20 elements, I don't have this problem
<xavierm02>
and I like that idea that If I run my script long enough, I'll actually cover all elements
<companion_cube>
listing them all is impossible if they're infinite
<xavierm02>
(because since int is bounded, the sets are in fact finite)
Yoric has joined #ocaml
<xavierm02>
(not just, int, all the types, because they have a finite representation, only have a finite number of elements so the sets are finite)
<ggole>
Excepts some are more finite than others.
xavierm02 has quit [Ping timeout: 256 seconds]
<mrvn>
except lists are infinite. you can make the longer and longer (in theory, until you exhaust the address space)
<Anarchos>
mrvn well if i remember, lists have a max number of elements, is it 16384 ?
<mrvn>
no. A list node is a block containing a pointer to the next and a value.
<mrvn>
As long as you have ram you can make the list as long as you like
<Anarchos>
mrvn make sense
<ggole>
Arrays are somewhat limited on 32-bit machines.
<mrvn>
nope.
shinnya has quit [Ping timeout: 245 seconds]
<mrvn>
strings are
* Anarchos
points to the manual for such limitations
<mrvn>
16MB for strings on 32bit.
<ggole>
Why do you think BigArray exists?
<mrvn>
strings are the smallest, arrays are larger, same as records and tuples and pretty much everything else is limited by the size of a value.
Snark has quit [Quit: leaving]
ggole has quit []
Yoric has quit [Ping timeout: 248 seconds]
<mfp>
wut? max 2**22 array elms on 32-bit
<mfp>
-1
xavierm02 has joined #ocaml
<mrvn>
The size of the "size" part in the blocks metadata
<xavierm02>
did gasche answer me?
<xavierm02>
I timed out -,-
Yoric has joined #ocaml
<mrvn>
apart from the cleaning up part linux has already done that
<mrvn>
ups, ewin
<gasche>
21:07 < gasche> xavierm02: I mostly don't know your problem domain so I couldn't recommend an abstraction level
<gasche>
21:08 < gasche> but for the *specific* task of computing diagonals of infinite structure, Seq looks like a better choice, if you indeed can make this purity assumption I'm talking about
walter has quit [Quit: This computer has gone to sleep]
<xavierm02>
then I asked what you meant exactly by unit tests and if using the code I have that outputs a finite number of elements of AxB for all cpossible A and B (empty, one element, two element, infinite) and checking the resulting string would be ok
Yoric has joined #ocaml
<mrvn>
on RPI I use 1ns.
xavierm02 has quit [Remote host closed the connection]
<beginner42>
i try to describe a C structure from zeromq and map it to an ocaml record, but what can i do when the c structure member has as name the underscore sign ?