adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Upcoming OCaml MOOC: https://huit.re/ocamlmooc | OCaml 4.03.0 release notes: http://ocaml.org/releases/4.03.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
sh0t has quit [Ping timeout: 244 seconds]
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.40/20160120202951]]
<andy__> Is there any tool that will help me detect unused values in my module signatures?
Orion3k has quit [Quit: Leaving]
<andy__> I am writing an application, not a library.
LiamGoodacre has quit [Quit: Leaving]
sh0t has joined #ocaml
silver has quit [Quit: rakede]
nicholas_ has quit []
<Drup> rgrinberg: no idea, I don't know the semantics of Str :D
<Drup> andy__: locally (in a module), ocaml will do it if you have an mli. There are some warnings that you can enable to improve that
<rgrinberg> Drup: seems like it doesn't.
<Drup> andy__: globally, there is dead_code_analysis (an opam package)
<andy__> Drup: Thanks!!
noddy has joined #ocaml
sh0t has quit [Ping timeout: 240 seconds]
Denommus` has joined #ocaml
fluter has quit [Ping timeout: 260 seconds]
Denommus has quit [Ping timeout: 264 seconds]
andy__ has quit [Quit: Leaving]
Denommus` is now known as Denommus
fluter has joined #ocaml
<rgrinberg> Drup: some simple str fixes, https://github.com/ocaml/ocaml-re/pull/110, need a second l ook
sdothum has quit [Ping timeout: 250 seconds]
sdothum has joined #ocaml
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 252 seconds]
Algebr`` has quit [Remote host closed the connection]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
nicholasf has joined #ocaml
noddy has quit [Ping timeout: 276 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
noddy has joined #ocaml
govg has quit [Ping timeout: 258 seconds]
SilverKey has joined #ocaml
nicholas_ has joined #ocaml
darkf has joined #ocaml
noddy has quit [Quit: "it's a bit backwards around here"]
nicholasf has quit [Ping timeout: 258 seconds]
dwwoelfel has joined #ocaml
dwwoelfe_ has joined #ocaml
dwwoelfel has quit [Ping timeout: 260 seconds]
mcspud has joined #ocaml
pyon has joined #ocaml
dwwoelfe_ has quit [Remote host closed the connection]
ygrek_ has quit [Ping timeout: 258 seconds]
wtetzner has joined #ocaml
wtetzner has quit [Remote host closed the connection]
pierpa has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
tmtwd has joined #ocaml
larhat has quit [Quit: Leaving.]
Nahra has quit [Read error: Connection reset by peer]
Nahra has joined #ocaml
SilverKey has quit [Quit: Cheerio!]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
tmtwd has quit [Ping timeout: 258 seconds]
Denommus has quit [Ping timeout: 265 seconds]
tmtwd has joined #ocaml
MercurialAlchemi has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 252 seconds]
tmtwd has quit [Ping timeout: 244 seconds]
copy` has quit [Quit: Connection closed for inactivity]
govg has joined #ocaml
Simn has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
nore has quit [Ping timeout: 265 seconds]
nore has joined #ocaml
AltGr has joined #ocaml
dexterph has joined #ocaml
ocalm has joined #ocaml
ocalm has quit [Remote host closed the connection]
tennix has joined #ocaml
tennix has quit [Client Quit]
Algebr` has joined #ocaml
pyon has quit [Quit: Good night.]
two_wheels has quit [Ping timeout: 276 seconds]
<Algebr`> Anyone done any bindings with bucklescript yet
<Algebr`> to js libs
nore has quit [Ping timeout: 276 seconds]
johnelse has joined #ocaml
nore has joined #ocaml
<Leonidas> anyone used ocaml-webmachine? I'm using liberator in clojure which is similar to the original webmachine, so ocaml-webmachine is potentially the perfect solution for me :)
<Algebr`> Leonidas: I will be very interested in seeing a real world usage
<Leonidas> Algebr`: I plan a project with webmachine in the backend and Elm in the frontend, but not entirely sure it will happen.
Algebr` has quit [Ping timeout: 258 seconds]
nicholas_ has quit [Remote host closed the connection]
nicholasf has joined #ocaml
kev has joined #ocaml
bronsen has quit [Quit: WeeChat 1.6-dev]
wolfcore has quit [Ping timeout: 244 seconds]
nicholasf has quit [Remote host closed the connection]
wolfcore has joined #ocaml
johnelse has quit [Ping timeout: 264 seconds]
nicholasf has joined #ocaml
hay207__ has joined #ocaml
hay207_ has quit [Ping timeout: 258 seconds]
johnelse has joined #ocaml
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
caw has quit [Ping timeout: 260 seconds]
caw has joined #ocaml
Algebr` has joined #ocaml
Leonidas has quit [Ping timeout: 250 seconds]
lpaste has quit [Ping timeout: 264 seconds]
ousado has quit [Ping timeout: 264 seconds]
zozozo has quit [Ping timeout: 258 seconds]
Algebr` has quit [Ping timeout: 244 seconds]
Jaxan has quit [Ping timeout: 264 seconds]
ousado has joined #ocaml
zozozo has joined #ocaml
lpaste has joined #ocaml
Jaxan has joined #ocaml
Leonidas_ has joined #ocaml
Leonidas_ has quit [Client Quit]
Leonidas_ has joined #ocaml
Leonidas_ is now known as Leonidas
Algebr` has joined #ocaml
Leonidas_ has joined #ocaml
Leonidas_ has quit [Client Quit]
Algebr` has quit [Ping timeout: 240 seconds]
ggole has joined #ocaml
manizzler has quit [Read error: Connection timed out]
regnat has quit [Quit: WeeChat 1.5]
johnelse has quit [Ping timeout: 250 seconds]
regnat has joined #ocaml
manizzler has joined #ocaml
manizzler has quit [Max SendQ exceeded]
Algebr` has joined #ocaml
manizzler has joined #ocaml
silver has joined #ocaml
fluter has quit [Ping timeout: 258 seconds]
Algebr` has quit [Ping timeout: 264 seconds]
fluter has joined #ocaml
johnelse has joined #ocaml
kev has quit [Ping timeout: 240 seconds]
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 265 seconds]
thizanne has joined #ocaml
thizanne has quit [Client Quit]
manizzler has quit [Read error: Connection timed out]
manizzler has joined #ocaml
thizanne has joined #ocaml
_andre has joined #ocaml
manizzler has quit [Max SendQ exceeded]
manizzler has joined #ocaml
sdothum has joined #ocaml
voglerr has joined #ocaml
thizanne has quit [Ping timeout: 244 seconds]
hay207__ has quit [Quit: Konversation terminated!]
<voglerr> is there a way to get all type errors from the compiler for a signature mismatch instead of just the first one?
kev has joined #ocaml
gasche has joined #ocaml
<gasche> seliopou, hannes: could you send me a link to your OCaml 2016 abstracts?
<gasche> ( https://ocaml.org/meetings/ocaml/2016/#Presentations is currently sad with only links to two abstracts )
<gasche> AltGr: same!
<gasche> dinosaure, def`: same!
manizzler has quit [Read error: Connection timed out]
manizzler has joined #ocaml
<flux> voglerr, sadly no, the OCaml compiler is only able to produce one error at a time
voglerr_ has joined #ocaml
voglerr has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
<AltGr> gasche: yes, sorry for the lag (was away until last monday)
Algebr` has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
manizzler has quit [Read error: Connection timed out]
<gasche> AltGr: you're forgiven :-)
johnelse has quit [Ping timeout: 250 seconds]
manizzler has joined #ocaml
<AltGr> We only got 20 minutes for opam + platform though
<AltGr> that'll be short
<AltGr> (although one review suggested we skip the platform part because they felt it got repetitive...)
thizanne has joined #ocaml
kev has quit [Ping timeout: 240 seconds]
kev has joined #ocaml
_y has joined #ocaml
hay207 has joined #ocaml
manizzler has quit [Read error: Connection timed out]
manizzler has joined #ocaml
freusque has joined #ocaml
shinnya has joined #ocaml
tvynr has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
manizzler has quit [Read error: Connection timed out]
manizzler has joined #ocaml
nicholasf has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
Algebr` has quit [Ping timeout: 264 seconds]
manizzler has quit [Read error: Connection timed out]
manizzler has joined #ocaml
cschneid has quit [Ping timeout: 250 seconds]
sdothum has joined #ocaml
cschneid has joined #ocaml
johnelse has joined #ocaml
voglerr has joined #ocaml
voglerr_ has quit [Read error: Connection reset by peer]
johnf_ has joined #ocaml
manizzler has quit [Read error: Connection timed out]
<Leonidas> Algebr: https://ocaml.org/meetings/ocaml/2016/ check out Spiridon Eliopoulos' talk
manizzler has joined #ocaml
johnf has quit [Ping timeout: 258 seconds]
kev has quit [Ping timeout: 240 seconds]
thizanne has quit [Ping timeout: 260 seconds]
Algebr` has joined #ocaml
manizzler has quit [Ping timeout: 258 seconds]
Algebr` has quit [Ping timeout: 265 seconds]
shinnya has quit [Ping timeout: 258 seconds]
Algebr` has joined #ocaml
bcj has joined #ocaml
voglerr has quit [Remote host closed the connection]
bcj has left #ocaml [#ocaml]
bcj has joined #ocaml
pyon has joined #ocaml
al-damiri has joined #ocaml
silver has quit [Quit: rakede]
ChristopheT has joined #ocaml
voglerr has joined #ocaml
nicholasf has joined #ocaml
voglerr has quit [Remote host closed the connection]
shinnya has joined #ocaml
nicholasf has quit [Ping timeout: 240 seconds]
voglerr has joined #ocaml
GemmaG_ has joined #ocaml
voglerr has quit [Ping timeout: 244 seconds]
voglerr has joined #ocaml
voglerr has quit [Ping timeout: 258 seconds]
Algebr` has quit [Ping timeout: 250 seconds]
nicholasf has joined #ocaml
bcj has left #ocaml ["Be back later..."]
shinnya has quit [Ping timeout: 240 seconds]
ontologiae has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 244 seconds]
copy` has joined #ocaml
Algebr` has joined #ocaml
<ontologiae> Hi !
<ontologiae> I wrote a function to generate all combinations from a list
<ontologiae> but I failed to make it tail-recursive : I've got a stack overflow if i give more than 18 items in the list
<ontologiae> any advices ?
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<companion_cube> well it's hard to write this properly
<companion_cube> use iterators, if you cann
<companion_cube> -n
<gasche> well using (List.rev_append (List.rev_map f li) ...) instead of (List.map f li @ ...) is a good first step
<gasche> but indeed, you should rather implement a fold function over the combinations, or a get-next-combination function
<ontologiae> I uses batteries as List lib
<gasche> ah
<gasche> doesn't your function return all subsets of the list?
Algebr` has quit [Ping timeout: 240 seconds]
<gasche> sublists
nicholasf has quit [Remote host closed the connection]
<gasche> in that case the get-next-elem function is rather easy, just increment binary digits of the list's length
<companion_cube> this should be faster than producing a list ;)
<gasche> (but it returns permutations rather than something else ontologiae is computing)
<companion_cube> oh sorry
<ontologiae> gasche: it seems, yes
<ontologiae> comb [A;B;C];; ===> [[A; B; C]; [A; B]; [A; C]; [A]; [B; C]; [B]; [C]; []]
<gasche> usually when people say "combinations" they mean only sublists of a fixed length
<ontologiae> note that I then filter the result to only keep result which have two elements
<companion_cube> much simpler
Helo_E has joined #ocaml
<gasche> if you implement your enumeration with binary-digits number incrementation, it's easy to reject those of the wrong size and recur
<ontologiae> when I say combinations, it's cartesian product but removing all commutative doublons
Helo_E has quit [Client Quit]
yegods has joined #ocaml
<companion_cube> anyway, what I mean is that using lists as iterators is slow
<Drup> (by pure curiosity, how much faster is that one ? :p)
<ontologiae> companion_cube: it works ! Thx !
<companion_cube> ontologiae: if you want only those with a given lenght, wait
<companion_cube> ontologiae: I updated it, the version `int -> 'a list -> 'a list Sequence.t` should be much better than filtering
<companion_cube> (of course it needs a bit more testing)
<companion_cube> but I think it's challenging to build something faster in OCaml ;-)
<ontologiae> trying to understand your very clever code ;-)
<ontologiae> I tested it, it gives the same count of items than mine for 18 items
<companion_cube> it's not clever, it just uses iterators ;-)
<companion_cube> (I'm interested in time comparisons if you have time)
yegods has quit [Ping timeout: 258 seconds]
voglerr has joined #ocaml
<ontologiae> companion_cube: I can take the time ;-)
yegods has joined #ocaml
<Drup> obj_magic: I promised you that post almost a year ago, here is it: https://drup.github.io/2016/08/02/difflists/ :3
<companion_cube> ontologiae: compile in native, if you can
voglerr has quit [Ping timeout: 264 seconds]
martintrojer has quit [Quit: ZNC - 1.6.0 - http://znc.in]
Algebr` has joined #ocaml
myst|fon has joined #ocaml
<ontologiae> companion_cube: stranges results
Algebr` has quit [Ping timeout: 258 seconds]
<ontologiae> mine : 0.22 WALL ( 0.22 usr + 0.01 sys = 0.22 CPU)
<ontologiae> sequences : 0.35 WALL ( 0.35 usr + 0.00 sys = 0.35 CPU)
<ontologiae> I can't test with more than 18 elements, I've got my stack overflow
<companion_cube> if you increase the size?
<companion_cube> ah
<companion_cube> (also, Sequence.to_list is only to be included if you need it)
<ontologiae> unless you have a way to increase the stack size
<ontologiae> I need it
<companion_cube> (Sequence.to_rev_list should be faster)
<companion_cube> what do you do with the combinations?
<ontologiae> I can try, I don't care the order
<companion_cube> (the point with iterators is that you don't need to build the list in the end, you can `length`, `fold, `iter` directly)
<ontologiae> it isn't better with to_rev_list
<ontologiae> but nevermind, the only important point is it works
<ontologiae> but it takes a LOT of memory, it kills my 16GB systems :-D
<companion_cube> wut
<companion_cube> (and with the more "naive" version of sequence? if you Sequence.filter before building the list?)
<gasche> Drup: you could link to my post explaining the 6 format6 parameters
<Drup> hum, I'm not sure I know that post
<gasche> also, ("%s | %s" : _ format6) in a toplevel may be an easier approach to see the GADT value
zpe has joined #ocaml
<Drup> that has much more stuff in it, I wanted to keep things simple and avoid getting into the details of the billions of format parameters
<ontologiae> Slower : 1.04 WALL ( 1.03 usr + 0.01 sys = 1.04 CPU)
tane has joined #ocaml
<ontologiae> companion_cube: Sequence.filter for what ?
<companion_cube> to remove the combinations that do not have the length you want
<ubertaco> I've heard some passing references to iterators. It sounds like there's work on them for 4.04? Anywhere I could read up on what the general plans are?
voglerr has joined #ocaml
<gasche> Drup: sure, but people may be curious when reading your post to know more details about the actual format datatypes
govg has quit [Ping timeout: 265 seconds]
<Drup> gasche: can you give me a link to your post ?
zpe has quit [Ping timeout: 265 seconds]
<gasche> Drup: a last thing that might be worth mentioning eventually (but also possibly too advanced here) is that binary functions on difference-list GADTs are not -rectypes-safe
<gasche> (same with Prolog and the possibility to create cyclic difference lists by unification)
<Drup> Yeah, rectypes
voglerr has quit [Ping timeout: 244 seconds]
<Drup> (honestly, I don't really consider rectypes, because it's very rare to use it in practice except to say "you see, you can do that", and also because it's quite hard to use it to do what you actually want to do)
<gasche> I think you should get a non-exhaustive warning in recent OCaml versions if you write code that is not safe against clients using -rectypes themselves
<ontologiae> what ">|=" meens ?
kev has joined #ocaml
<Drup> ontologiae: map
<flux> >|= fun x -> y is like >>= fun x -> return y
Christop` has joined #ocaml
<flux> I guess most useful with non-lambda-functions, adding a 'return' is not that big a deal?
<ontologiae> I don't know >>= too :)))
<gasche> sometimes I suspect that using "bind" and "map" directly would be more readable
<Drup> gasche: thanks, I added a link
ChristopheT has quit [Ping timeout: 244 seconds]
<gasche> flux: map is more efficient
<flux> a >>= fun x -> y is the same as bind a (fun x -> y)
<flux> gasche, how much more efficient?-o
<Drup> defining map in term of bind is extremly inneficient.
<gasche> (also it requires less structure on the type)
<ubertaco> companion_cube: thanks! Been reading over it
<gasche> well for example for lists it will allocate exactly twice as much
<companion_cube> flat_map on lists is terrible
MercurialAlchemi has joined #ocaml
yegods has quit [Read error: Connection reset by peer]
<gasche> hm
<gasche> uberTaco, companion_cube: note that this PR won't end up in 4.04 which is in feature freeze already
<ubertaco> aw, bummer
yegods has joined #ocaml
<companion_cube> gasche: I'm not surprised, I need to write tests anyway
yegods has quit [Remote host closed the connection]
<companion_cube> but feeling a bit demotivated
<Bluddy[m]> companion_cube: cheer up. It'll get it in the next cycle.
<companion_cube> heh, who knows
<ontologiae> companion_cube: Benchmarking your algo, it's strange, to produce 325 elements from a list of 26 elements, it take 6GB of memory
<companion_cube> wow, really?
* companion_cube must have missed something
<companion_cube> ah well it produces a lot of intermediate lists
<companion_cube> ah, through benchmarking I found a better function
<ontologiae> companion_cube: yeah :-D
<ontologiae> I probably will have to write it imperatively
<companion_cube> it's called "combs2" in the gist
<gasche> uberTaco: note that you could use one of the many extensions to the standard library that provide these functions
<companion_cube> ontologiae: https://gist.github.com/c-cube/ec1cfc67b4ec1a1f9e9cde783d8a1f97 here is my bench
<companion_cube> http://paste.isomorphis.me/KiV here are the results
<ubertaco> gasche: yeah, I know. Not a big deal at all, really. Just neat to see something simple in the stdlib
<companion_cube> so indeed the two previous versions were bad (because they were duplicating results, essentially, unlike the list version)
<ubertaco> not neding another dependency
XDERT has joined #ocaml
<companion_cube> note that my benchmark just computes the length (i.e. the number of permutations)
Mercuria1Alchemi has joined #ocaml
<companion_cube> so it doesn't generate a list at all for sequences
<companion_cube> it's pretty fun :D
voglerr has joined #ocaml
<ontologiae> companion_cube: wow
<companion_cube> heh! :D
<companion_cube> but it's a good thing you benchmarked, indeed
<companion_cube> the relevant issue is sharing sub-computations
<companion_cube> which your implem did
<Drup> "doubleton" ? :D
<companion_cube> like singleton :p
<companion_cube> let doubleton x y yield = yield x; yield y
<companion_cube> comes in handy quite often
<companion_cube> otherwise I'd have used `of_list`
<Drup> I know, the name is transparent, just amusing :D
<companion_cube> I think I have the same for maps
<companion_cube> aww, no
XDERT has left #ocaml [#ocaml]
voglerr has quit [Ping timeout: 260 seconds]
yegods has joined #ocaml
<ontologiae> the problem is that in my real world use case, input list will have more than 500 elements... Wondering if it is possible, actually...
<companion_cube> and what will you do with combinations?
<companion_cube> (and combinations of how many elements?)
<companion_cube> you can easily compute the size of the result :-)
bitbckt has quit [Ping timeout: 250 seconds]
jyc has quit [Ping timeout: 250 seconds]
<ontologiae> I use it to generate all the possible binary tree acording to a depth
slash^ has joined #ocaml
<Drup> ontologiae: you really want to use sequence for that, to avoid building the whole list in advance
<mrvn> And you do that for 500 elements? How many billion years do you have?
jyc has joined #ocaml
<ontologiae> Drup: you're right, probably not the good solution
<ontologiae> mrvn: I have some months ;-)
bitbckt has joined #ocaml
<companion_cube> and what will you do with the binary trees? :D
silver has joined #ocaml
<companion_cube> at least now I have a better function for generating combinations 0:-)
MercurialAlchemi has quit [Ping timeout: 250 seconds]
<ontologiae> companion_cube: I'm generating all possible calculations from operators and constants
<companion_cube> I see
<chelfi> ontologiae: like in the countdown game ?
<ontologiae> chelfi: sort of, but gpu oriented ;-)
<mrvn> I've been thinking of generating all possible way to wire inputs to a number of gates to find the combination with the least number of gates and wires for a given set of functions. But for anything usable that is just so many combinations ...
<ontologiae> mrvn: genetic algorithms, taboo methods, ... ?
<mrvn> ontologiae: genetic algorithms? How do you score a result? How many values in the truth table are correct?
<companion_cube> mrvn: maybe something based on SAT (or max-SAT) would be better
<ontologiae> mrvn: you can take the better result you have, to define how many values in the truth table is correct enought to keep the genotype
<companion_cube> yeah :D
<companion_cube> a bit old
<mrvn> ontologiae: And how do I mutate? Add a random wire or random gate? I don't think that would modify the truth table anything but randomly.
<ontologiae> mrvn: imho, you could better by viewing the problem in terms of "how I explore better the solution space"
<ontologiae> and define what is "better"
<companion_cube> this is a possible way to generate all the expressions from some basic integers
<ontologiae> companion_cube: wow !!
<companion_cube> well it takes some time…
<mrvn> ontologiae: For a genetic algorithm you need something where small changes may move a small way towards the goal. I just don't see that for circuits. A small change like adding a NOT gate can completly reverse the truth table but still be the right thing eventually.
<companion_cube> it's probably not the most efficient
<companion_cube> http://paste.isomorphis.me/Gfp with 3 base elements
<companion_cube> of course it's quite redundant since + and * are commutative
<ontologiae> companion_cube: it's great, so I have to understand your lib and work from your code :-)
<mrvn> only + and *, no - or /?
<companion_cube> ah come on :D
<companion_cube> it's not hard to add though
<ontologiae> +,*,-,/
<companion_cube> obviously, div_by_zero -_-
<mrvn> companion_cube: does your code output Mult (Add (Int 1, Int 2), Add (Int 3, Int 4))?
rgrinberg has quit [Ping timeout: 264 seconds]
<companion_cube> http://paste.isomorphis.me/JMQ yayay
SilverKey has joined #ocaml
<companion_cube> mrvn: no
<companion_cube> I don't know how to do this…
<companion_cube> actually I have ideas
<companion_cube> but well
<ontologiae> mrvn: you're right. But I know some guys worked on that, on small circuits of course ;-)
<mrvn> companion_cube: don't forget that a+b == b+a
<companion_cube> I know
<mrvn> If you could avoid the duplicates that would ave a lot of time.
<chelfi> I was asking mostly because of http://www.cs.nott.ac.uk/~pszgmh/countdown.pdf
<companion_cube> yeah, it was a first draft
<ontologiae> and we can improve the code to use previously generated expression
dexterph has quit [Ping timeout: 250 seconds]
<mrvn> You can go top down. Try all operands and all partitions of the input numbers. Recursivley try the first partition for the first argument of the operator and the second partition for the second.
<mrvn> Obviously if there is only one input only Int is valid.
<mrvn> For Add and Mul you can limit the partitionings to solutions that have the smallest number in the first partition.
<mrvn> Problem is you still get as lot results where sub becomes negative or div is a fraction.
mcspud has quit [Ping timeout: 250 seconds]
dexterph has joined #ocaml
<companion_cube> I'm trying to do something based on a stack language
<ontologiae> companion_cube: how do you control the depth of the expression, ie. the number of operators you can generate ?
<companion_cube> in the current code?
pierpa has joined #ocaml
<ontologiae> yes
<mrvn> companion_cube: so you push N numbers and N-1 operastors on the stack in all possible orders that don't cause a stack underflow on eval?
<companion_cube> yeah
<companion_cube> I think so
<companion_cube> give me a few more minutes
<ontologiae> companion_cube: thank you so much
<companion_cube> well it doesn't mean it will be usable
mcspud has joined #ocaml
sh0t has joined #ocaml
<companion_cube> http://paste.isomorphis.me/kSr the result
<companion_cube> it's still quite naive
<companion_cube> memoization might be better in this particular case
<companion_cube> but I don't see how one could avoid the permutations
<companion_cube> omg so many possibilities
kev has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
<ontologiae> companion_cube: I'm sorry, but I don't find where you define the depth
johnelse has quit [Ping timeout: 265 seconds]
johnelse has joined #ocaml
AltGr has left #ocaml [#ocaml]
<mrvn> Without avoiding duplicates or invalids: https://gist.github.com/mrvn/31eb2497bb98f1cb95971a0d87e5a2ae
<mrvn> ontologiae: The depth is defined by all inputs being used up and the stack being size 1.
<mrvn> ontologiae: or what depth do you mean?
<mrvn> companion_cube: if you want memoization then that means remembering all the values. Doesn't work for too many inputs.
ontologiae has quit [Ping timeout: 265 seconds]
<mrvn> companion_cube: you could make pick_op more selective. + and * are only valid if the operands are sorted. That would cut out all the a+b == b+a duplicates.
rgrinberg has quit [Quit: WeeChat 1.5]
rgrinberg has joined #ocaml
<companion_cube> yeah
<companion_cube> it's not easy
<companion_cube> mrvn: side note, string_of_stack would be better with Format ;-)
<mrvn> The question also is: For an expression resulting in X do you want all expressions or just one?
pierpa has quit [Ping timeout: 260 seconds]
<mrvn> e.g. 4 - 2 and 4 / 2 or just one of them?
shinnya has joined #ocaml
ygrek_ has joined #ocaml
govg has joined #ocaml
johnelse has quit [Ping timeout: 244 seconds]
dhil has joined #ocaml
ontologiae has joined #ocaml
Christop` has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
ChristopheT has joined #ocaml
<tvynr> I have a module with a variant type defined in it. I'd like to open *just* that type's constructors into my local namespace (and none of the rest of the stuff from the module). Is this possible?
<ChristopheT> whois asm89
<mrvn> tvynr: pythons from module import type?
<mrvn> tvynr: I think you can only do that by repeating the types signature.
<tvynr> mrvn: Sorta. The module carries a variant data type as well as functions named things like "pp" and "compare". I'm trying to bring in *just* the constructors while still referring to Module.compare for the functions.
<tvynr> mrvn: Ew. That's disappointing. Thanks, tho.
<mrvn> tvynr: can you change the source module?
<tvynr> mrvn: I appreciate the help; finding out for sure that you *can't* do something usually requires a community. :)
<tvynr> mrvn: Yeah. So I'm thinking I can declare the type in the scope I need it and then create the module by e.g. "struct let compare = compare_foo let equal = equal_foo ... end".
<tvynr> It'll get the job done.
<tvynr> (I'm using ppx_deriving for a lot of these functions.)
<mrvn> tvynr: put the type in a submodule and then open that.
<tvynr> mrvn: The problem is that the PPX tool I'm using to generate the e.g. compare function always generates the code adjacent to the type declaration. So I write "type t = Foo | Bar of int [@@deriving ord]" and I get "type t = ...;; let compare = ...;;".
<tvynr> mrvn: If I put the type in the submodule, I can't use the deriving tool without duplicating the signature. And I love my code generator enough that I'll put up with the noise.
<tvynr> The submodule's a good idea if I'm not using this PPX extension, tho. I'll bear that in mind. :)
kev has joined #ocaml
<mrvn> yeah, doesn't work for deriving
<mrvn> tvynr: you could make a PPX extension that puts the type in a submodule.
<mrvn> or modify the deriving to put the helper in a module
<tvynr> mrvn: Fair points. In my limited experience, it's pretty messy to write a PPX extension inside of the same project that wants to use it; it messes with the Atom Merlin plugin pretty badly and I have to write some pretty goofy-looking and unintuitive stuff in my _oasis file. So I tend to avoid that unless it's really important.
<tvynr> mrvn: Fair points. In my limited experience, it's pretty messy to write a PPX extension inside of the same project that wants to use it; it messes with the Atom Merlin plugin pretty badly and I have to write some pretty goofy-looking and unintuitive stuff in my _oasis file. So I tend to avoid that unless it's really important.
<tvynr> oops - wrong window
<tvynr> sorry :-/
<mrvn> yeah, I would always do the extension as separate project and then use it.
pierpa has joined #ocaml
tvynr has quit [Ping timeout: 264 seconds]
soupault has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
soupault has quit [Remote host closed the connection]
soupault has joined #ocaml
avsej has quit [Ping timeout: 250 seconds]
dxtr has quit [Ping timeout: 276 seconds]
avsej has joined #ocaml
avsej has quit [Changing host]
avsej has joined #ocaml
dxtr has joined #ocaml
johnelse has joined #ocaml
avsej has quit [Ping timeout: 250 seconds]
avsej has joined #ocaml
avsej has quit [Changing host]
avsej has joined #ocaml
johnelse has quit [Ping timeout: 260 seconds]
sh0t has quit [Remote host closed the connection]
SilverKey has quit [Quit: Halted.]
theblatte has joined #ocaml
GemmaG_ has quit [Ping timeout: 250 seconds]
sh0t has joined #ocaml
voglerr has joined #ocaml
voglerr has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 276 seconds]
dhezfmoiezh has joined #ocaml
dhezfmoiezh has quit [Client Quit]
ggole has quit []
dhil has quit [Ping timeout: 244 seconds]
kev has quit [Ping timeout: 240 seconds]
thizanne has joined #ocaml
orbifx has joined #ocaml
AlexRussia has joined #ocaml
milodavis has joined #ocaml
orbifx1 has joined #ocaml
orbifx has quit [Ping timeout: 244 seconds]
myst|fon has quit [Quit: Connection closed for inactivity]
Algebr` has joined #ocaml
tvynr has joined #ocaml
kev has joined #ocaml
tvynr has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
ChristopheT has quit [Ping timeout: 250 seconds]
tvynr has joined #ocaml
_andre has quit [Quit: Lost terminal]
kakadu has joined #ocaml
regnat has quit [Quit: WeeChat 1.5]
regnat has joined #ocaml
soupault has quit [Remote host closed the connection]
AlexRussia has quit [Ping timeout: 244 seconds]
myst|fon has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
Simn has quit [Quit: Leaving]
Mercuria1Alchemi has quit [Ping timeout: 265 seconds]
<rgrinberg> Drup: were you not made an ocaml-re maintainer before? :O
<Drup> no
<rgrinberg> wtf, for the longest time i thought you were a maintainer
<rgrinberg> Alright, i should ask avsm to make you part of the team
<rgrinberg> oh nvm i might be able to do it myself.
tane has quit [Quit: Leaving]
tvynr has quit [Ping timeout: 250 seconds]
Druuup has joined #ocaml
<Druuup> This is cool, there is a link to this chat on the first page in http://ocaml.org/ :D
Druuup has left #ocaml [#ocaml]
orbifx1 has quit [Ping timeout: 250 seconds]
dexterph has quit [Remote host closed the connection]
dexterph has joined #ocaml
Boom has joined #ocaml
Boom has quit [Client Quit]
dexterph has quit [Ping timeout: 252 seconds]
nicholasf has joined #ocaml
Kakadu2 has joined #ocaml
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
seangrove has joined #ocaml
zpe has joined #ocaml
pyon has quit [Ping timeout: 244 seconds]
zpe has quit [Ping timeout: 260 seconds]
ChristopheT has joined #ocaml
<_y> \o/
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
<_y> shall i guess it is the concluding act of the “how to encourage the adoption of OCaml?”
<Drup> Doubt it's directly related :)
al-damiri has quit [Quit: Connection closed for inactivity]
jhaberku has joined #ocaml
d0nn1e has quit [Ping timeout: 250 seconds]
<jhaberku> Let's say I define `let agent m = let rec loop () = Lwt.wrap (fun () -> print_string m) >> loop () in loop ()`
<jhaberku> and then `let prog () = Lwt.nchoose [agent "A"; agent "B"]`
d0nn1e has joined #ocaml
kev has quit [Ping timeout: 258 seconds]
<jhaberku> What output would you expect if you executed the result of `prog ()`?
<jhaberku> Because what you get is certainly not what I would have expected.
<Drup> without any flushing, I have no idea
<jhaberku> Drup: I would have expected the "A" and "B" threads to interleave to at least some extent, but only the "A" gets executed. In other words, in the recursive `loop ()` execution, the engine never yields control to the "B" thread.
<jhaberku> If I insert a manual call to `Lwt_unix.yield ()` before recursing, then the cooperative thing happens.
<ChristopheT> I put a link on ocaml.org front page to an application that makes it easy to join this IRC channel (some people want interactivity with tools that feel "modern"). I would be interested of a report in, say, 2–3 months about whether more people (especially newbies) have been joining the conversation. Please use https://github.com/ocaml/ocaml.org/issues for that. Thanks.
<jhaberku> ChristopheT: The KiwiIRC thing?
<ChristopheT> Yes.
djellemah_ has joined #ocaml
testest has joined #ocaml
testest has quit [Client Quit]
<jhaberku> Fewer barriers to entry than something like Gitter?
<Drup> jhaberku: more people here than on gitter
<ChristopheT> There is no barrier for entry—it's really simple.
<ChristopheT> There is nobody on https://gitter.im/ocaml
djellemah__ has quit [Ping timeout: 244 seconds]
<jhaberku> Drup: Is my mental model of how Lwt works wrong? I thought that `>>` is just sugar for `>>= fun () ->` and I thought that binds were cooperation points.
<ChristopheT> jhaberku: It is important that people who want live chat have people that respond fast. A arguably nice looking Gitter room that is empty is easily interpreted as the community being dead.
<jhaberku> ChristopheT: Definitely. I remember that there was talk of a Gitter/IRC bridge at one point. Wasn't that you?
<ChristopheT> Drup: You are way more here than me. May you take care of that matter?
<Bluddy[m]> ChristopheT: There is no gitter room for OCaml
Kakadu2 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<Drup> ChristopheT: sure :)
<ChristopheT> jhaberku: No. There is https://irc.gitter.im/ but it is β (and more for people who want to use their IRC client with Gitter).
<ChristopheT> Bluddy[m]: there is but it is locked.
<Drup> ChristopheT: do you want a precise acount or just impressions ?
<Drup> ChristopheT: I use the irc bridge for the oasis gitter channel, it's very annoying and doesn't really work well
bwar has joined #ocaml
<ChristopheT> Drup: Impressions are already good. The question to answer being:
<ChristopheT> Are there more people (especially beginners) participating to the conversion because of this?
<Drup> this is going to be a bit tricky to answer
<ChristopheT> Drup: Sure. That's why I said impressions are already good! :-)
<Drup> It would be good to record some metrics on the channel anyway
<Drup> (plotting people presents/people participating/new people/nb of messages, stuff like that)
<ChristopheT> Drup: Right. A nice side project? ;-)
<mrvn> gitter? Another chat room? Exactly what we need, more splitting of the community.
<Drup> ChristopheT: you are the metric person :3
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]