Re: Mutiple AliasSeq as input to template

2017-06-07 Thread David Sanders via Digitalmars-d-learn
On Thursday, 25 May 2017 at 17:56:12 UTC, jmh530 wrote: On Thursday, 25 May 2017 at 16:36:45 UTC, jmh530 wrote: [snip] I haven't played around with it fully, but it seems like the following resolves my issue in a sort of manual way: template Process1(A, B) { static if (!isIndex!B)

Re: Set Intersection and Set Difference on Compile-Time lists

2017-04-25 Thread David Sanders via Digitalmars-d-learn
On Tuesday, 25 April 2017 at 17:18:25 UTC, H. S. Teoh wrote: On Tue, Apr 25, 2017 at 05:08:36PM +, David Sanders via Digitalmars-d-learn wrote: I have two compile-time lists of types. How do I find their set intersection (to determine if one is a subset of the other) and their set

Set Intersection and Set Difference on Compile-Time lists

2017-04-25 Thread David Sanders via Digitalmars-d-learn
I have two compile-time lists of types. How do I find their set intersection (to determine if one is a subset of the other) and their set difference? See the block comments below: import std.variant; alias Zero = void; struct One{} struct Difference(T, U) { static if (is(U == Zero)) alia

Re: Algebra With Types

2017-04-24 Thread David Sanders via Digitalmars-d-learn
On Friday, 21 April 2017 at 20:49:27 UTC, Meta wrote: On Friday, 21 April 2017 at 18:54:38 UTC, David Sanders wrote: [...] As an aside, there's a less convoluted way to do type-level arithmetic which is IMO also more concise and looks nicer. You don't have to mess around with Algebraic at al

Re: Algebra With Types

2017-04-21 Thread David Sanders via Digitalmars-d-learn
On Friday, 21 April 2017 at 17:33:22 UTC, Meta wrote: On Friday, 21 April 2017 at 16:31:37 UTC, H. S. Teoh wrote: On Fri, Apr 21, 2017 at 04:16:30PM +, David Sanders via Digitalmars-d-learn wrote: I'm trying to do algebra with types ala http://chris-taylor.github.io/blog/2013/02/1

Algebra With Types

2017-04-21 Thread David Sanders via Digitalmars-d-learn
I'm trying to do algebra with types ala http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/ Below you will find my attempts at "adding" types in D. I've outlined the parts I'm having trouble with using block comments. 1) How do I figure out whether a type is an