Hi,
In Python I can write this:
if (4 <= 5 <= 6):
print ("OK")
-
http://rextester.com/NNAM70713
In D, I can only write this:
import std.stdio;
void main() {
if (4 <= 5 && 5 <= 6)
puts("OK");
}
-
http://rextester.com/FICP83173
I wanted to ask what is the reason? Maybe
On Thursday, 21 May 2015 at 16:57:16 UTC, Dennis Ritchie wrote:
Hi,
In Python I can write this:
if (4 <= 5 <= 6):
print ("OK")
-
http://rextester.com/NNAM70713
In D, I can only write this:
import std.stdio;
void main() {
if (4 <= 5 && 5 <= 6)
puts("OK");
}
-
http://re
On Thursday, 21 May 2015 at 17:17:29 UTC, Alex Parrill wrote:
http://wiki.dlang.org/Language_Designs_Explained#Why_does_D_not_support_chaining_comparison_operators.3F
Backward compatibility with C is nice but on the other hand it is
a road to nowhere!
Because of this compatibility, I'm compell
On Thursday, May 21, 2015 16:57:14 Dennis Ritchie via Digitalmars-d-learn wrote:
> Hi,
> In Python I can write this:
>
> if (4 <= 5 <= 6):
> print ("OK")
> -
> http://rextester.com/NNAM70713
>
> In D, I can only write this:
>
> import std.stdio;
>
> void main() {
>
> if (4 <= 5 && 5 <
On Thursday, 21 May 2015 at 17:43:25 UTC, Jonathan M Davis wrote:
No C-based language allows what python does, and based on
operators work in
C-based languages, what python is doing simply doesn't fit or
make sense.
What happens in C/C++/D/Java/C#/etc. land is that 4 <= 5
results in a bool,
at
Dennis Ritchie wrote:
> if (4 <= 5 <= 6):
> print ("OK")
> -
I would rather write:
if( isSorted![4,5,6])
-manfred
On Thursday, 21 May 2015 at 18:26:28 UTC, Dennis Ritchie wrote:
elif instead of else if:
http://rextester.com/WOSH30608
The parallel exchange values:
http://rextester.com/TPUD51604
wow!
On Thursday, 21 May 2015 at 18:26:28 UTC, Dennis Ritchie wrote:
On Thursday, 21 May 2015 at 17:43:25 UTC, Jonathan M Davis
wrote:
No C-based language allows what python does, and based on
operators work in
C-based languages, what python is doing simply doesn't fit or
make sense.
What happens in
On 5/21/15 12:57 PM, Dennis Ritchie wrote:
Hi,
In Python I can write this:
if (4 <= 5 <= 6):
print ("OK")
-
http://rextester.com/NNAM70713
In D, I can only write this:
import std.stdio;
void main() {
if (4 <= 5 && 5 <= 6)
puts("OK");
}
-
http://rextester.com/FICP83
Something I sometimes do for strictly personal projects:
import std.typecons : ω = tuple;
import std.typetuple : Ω = TypeTuple;
void main()
{
auto a = 1, b = 2;
Ω!(a, b) = ω(b, a);
assert(a==2 && b==1);
}
On Thursday, 21 May 2015 at 19:05:16 UTC, Steven Schveighoffer
wrote:
On 5/
On Thursday, 21 May 2015 at 19:05:16 UTC, Steven Schveighoffer
wrote:
On 5/21/15 12:57 PM, Dennis Ritchie wrote:
Hi,
In Python I can write this:
if (4 <= 5 <= 6):
print ("OK")
-
http://rextester.com/NNAM70713
In D, I can only write this:
import std.stdio;
void main() {
if (4 <=
On 05/21/2015 12:44 PM, Meta wrote:
All we need is user-defined opIs and then we're really cooking with gas.
if (5 is between(4, 6))
{
//...
}
We're almost there. :)
bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max)
{
return (what >= min) && (what <= max);
}
void main()
{
i
On Thursday, 21 May 2015 at 21:35:22 UTC, Ali Çehreli wrote:
We're almost there. :)
bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max)
{
return (what >= min) && (what <= max);
}
void main()
{
if (5.is_between(4, 6)) {
// ...
}
}
Ali
A condition is that if, for example,
On Thursday, 21 May 2015 at 23:14:47 UTC, Dennis Ritchie wrote:
On Thursday, 21 May 2015 at 21:35:22 UTC, Ali Çehreli wrote:
We're almost there. :)
bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max)
{
return (what >= min) && (what <= max);
}
void main()
{
if (5.is_between(4, 6)) {
On 5/21/15 2:35 PM, Ali Çehreli wrote:
On 05/21/2015 12:44 PM, Meta wrote:
All we need is user-defined opIs and then we're really cooking with gas.
if (5 is between(4, 6))
{
//...
}
We're almost there. :)
bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max)
{
return (what >= min)
On Sat, 2015-05-23 at 10:17 -0700, Andrei Alexandrescu via Digitalmars-d-learn
wrote:
> […]
>
> if (ordered(4, 5, 6)) { ... }
> if (strictlyOrdered(4, 5, 6)) { ... }
So the latter means the integers have to lashed as well as ordered? ;
-)
--
Russel.
===
On Saturday, 23 May 2015 at 17:17:17 UTC, Andrei Alexandrescu
wrote:
On 5/21/15 2:35 PM, Ali Çehreli wrote:
On 05/21/2015 12:44 PM, Meta wrote:
All we need is user-defined opIs and then we're really
cooking with gas.
if (5 is between(4, 6))
{
//...
}
We're almost there. :)
bool is_be
17 matches
Mail list logo