On Friday, 27 March 2015 at 01:53:22 UTC, H. S. Teoh wrote:
On Fri, Mar 27, 2015 at 01:37:45AM +, Vladimir Panteleev
via Digitalmars-d wrote:
On Thursday, 26 March 2015 at 22:23:12 UTC, Andrei
Alexandrescu wrote:
>New idea:
>
>bool ordered(pred = "a < b")(T...)(T values)
So... isSorted for
On Fri, Mar 27, 2015 at 01:37:45AM +, Vladimir Panteleev via Digitalmars-d
wrote:
> On Thursday, 26 March 2015 at 22:23:12 UTC, Andrei Alexandrescu wrote:
> >New idea:
> >
> >bool ordered(pred = "a < b")(T...)(T values)
>
> So... isSorted for tuples?
That's pretty much what it is, and I'm wo
On Thursday, 26 March 2015 at 22:23:12 UTC, Andrei Alexandrescu
wrote:
New idea:
bool ordered(pred = "a < b")(T...)(T values)
So... isSorted for tuples?
On 3/26/15 4:03 PM, H. S. Teoh via Digitalmars-d wrote:
On Thu, Mar 26, 2015 at 03:48:26PM -0700, Andrei Alexandrescu via Digitalmars-d
wrote:
On 3/26/15 3:28 PM, H. S. Teoh via Digitalmars-d wrote:
Don't like the name, though. Prefer 'isOrdered', otherwise it sounds
like some kind of sorting
On Thu, Mar 26, 2015 at 03:48:26PM -0700, Andrei Alexandrescu via Digitalmars-d
wrote:
> On 3/26/15 3:28 PM, H. S. Teoh via Digitalmars-d wrote:
> >Don't like the name, though. Prefer 'isOrdered', otherwise it sounds
> >like some kind of sorting algorithm (as in, returns an ordered
> >sequence of
On 3/26/15 3:28 PM, H. S. Teoh via Digitalmars-d wrote:
Don't like the name, though. Prefer 'isOrdered', otherwise it sounds
like some kind of sorting algorithm (as in, returns an ordered sequence
of its arguments).
Must be single-word name or nothing per Andrei's Hierarchy Of Naming
Abstracti
On Thursday, 26 March 2015 at 22:30:54 UTC, H. S. Teoh wrote:
As for combinations of < and <=, what about taking multiple
template
arguments? E.g.:
if (isOrdered!("<", "<=")(0, x, 10)) { ... }
In that case, wouldn't it be more readable to just do:
if (0 < x <= 10) { ... }
?
On Thu, Mar 26, 2015 at 03:23:12PM -0700, Andrei Alexandrescu via Digitalmars-d
wrote:
> On 3/26/15 2:52 PM, Vladimir Panteleev wrote:
> >On Thursday, 26 March 2015 at 21:51:54 UTC, Vladimir Panteleev
> >wrote:
> >>Oh yeah, this assumes hi <= lo. I thought this was part of the
> >>function contrac
On 3/26/15 2:52 PM, Vladimir Panteleev wrote:
On Thursday, 26 March 2015 at 21:51:54 UTC, Vladimir Panteleev
wrote:
Oh yeah, this assumes hi <= lo. I thought this was part of the
function contract.
I meant lo <= hi
New idea:
bool ordered(pred = "a < b")(T...)(T values)
{
foreach (i, _;
On Thursday, 26 March 2015 at 21:09:16 UTC, Andrei Alexandrescu
wrote:
On 3/26/15 11:41 AM, Vladimir Panteleev wrote:
I don't know if it's been mentioned yet, but there exists an
optimization for between with integer arguments:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
if (is(T:long) && is
On Thursday, 26 March 2015 at 21:51:54 UTC, Vladimir Panteleev
wrote:
Oh yeah, this assumes hi <= lo. I thought this was part of the
function contract.
I meant lo <= hi
On 3/26/15 11:41 AM, Vladimir Panteleev wrote:
On Sunday, 15 March 2015 at 01:48:53 UTC, Andrei Alexandrescu wrote:
On 12/16/13 12:38 PM, Andrei Alexandrescu wrote:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
{
return v >= lo && v <= hi;
}
Add?
Looks like among() has proven its worth sinc
On 3/26/15 11:41 AM, Vladimir Panteleev wrote:
On Sunday, 15 March 2015 at 01:48:53 UTC, Andrei Alexandrescu wrote:
On 12/16/13 12:38 PM, Andrei Alexandrescu wrote:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
{
return v >= lo && v <= hi;
}
Add?
Looks like among() has proven its worth sinc
On Sunday, 15 March 2015 at 01:48:53 UTC, Andrei Alexandrescu
wrote:
On 12/16/13 12:38 PM, Andrei Alexandrescu wrote:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
{
return v >= lo && v <= hi;
}
Add?
Looks like among() has proven its worth since we introduced it.
Now I somehow forgot betwee
I think it would be a good addition. Would we want to allow
specifying the inclusion like below:
auto between(string inclusion = "[]")(int v, int a, int b) {
+1
On Sunday, 15 March 2015 at 01:48:53 UTC, Andrei Alexandrescu
wrote:
On 12/16/13 12:38 PM, Andrei Alexandrescu wrote:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
{
return v >= lo && v <= hi;
}
uint among(T, Us...)(T v, Us vals)
{
foreach (i, U; Us)
{
if (v == vals[i]) return
On 12/16/13 12:38 PM, Andrei Alexandrescu wrote:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
{
return v >= lo && v <= hi;
}
uint among(T, Us...)(T v, Us vals)
{
foreach (i, U; Us)
{
if (v == vals[i]) return i + 1;
}
return 0;
}
Add?
Looks like among() has prov
17 matches
Mail list logo