Re: Python's features, which requires D

2015-06-11 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 10:58:33 UTC, Kagamin wrote: On Saturday, 23 May 2015 at 02:36:14 UTC, Dennis Ritchie wrote: For example, the code in Python looks quite natural: a = [[int(j) for j in input().split()] for i in range(n)] About D-code, I can not say: auto a = stdin .byLine

Re: Python's features, which requires D

2015-05-24 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 24 May 2015 at 02:43:47 UTC, Idan Arye wrote: I'm a fan of lisp(Clojure being my favorite. Too bad it takes about a century just to load the runtime...), and yet I find it quite ironic that Paul Graham claims lisp to be the most powerful language right after claiming that

Re: Python's features, which requires D

2015-05-24 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 24 May 2015 at 11:07:19 UTC, Dennis Ritchie wrote: On Sunday, 24 May 2015 at 02:43:47 UTC, Idan Arye wrote: I'm a fan of lisp(Clojure being my favorite. Too bad it takes about a century just to load the runtime...), and yet I find it quite ironic that Paul Graham claims lisp to be

Re: Python's features, which requires D

2015-05-24 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 24 May 2015 at 14:15:55 UTC, Idan Arye wrote: This IS ironic, because Paul Graham claims lisp to be the most powerful, but if he have ever encounter a more powerful language he couldn't accept it is more powerful than lisp due to the very same Blub Paradox he describes himself.

Re: Python's features, which requires D

2015-05-24 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 24 May 2015 at 15:40:21 UTC, Dennis Ritchie wrote: On Sunday, 24 May 2015 at 14:15:55 UTC, Idan Arye wrote: This IS ironic, because Paul Graham claims lisp to be the most powerful, but if he have ever encounter a more powerful language he couldn't accept it is more powerful than

Re: Python's features, which requires D

2015-05-24 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 24 May 2015 at 15:53:24 UTC, Idan Arye wrote: But according to the Blub Paradox, your(Or mine. Or Paul Graham's) opinion on whether or not a stronger language than Lisp has appeared can not be trusted! Based on an article Graham about Blub Paradox, I can conclude that Blub Paradox

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 21:09:45 UTC, weaselcat wrote: After another review, I think some of these conversions to D could be expressed much easier if the built-in slice had multidimensional slicing It was added in 2.066* but I don't think there's any plans to add support for it to

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 20:44:37 UTC, cym13 wrote: Not sure what kind of meat you mean, but I really don't see much meat in ranges. Of course, this is 10 times better and easier to use than STL iterators C++. For me the most important feature D are mixins, which I, unfortunately, rarely

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 21:32:51 UTC, anonymous wrote: On Saturday, 23 May 2015 at 21:08:19 UTC, Dennis Ritchie wrote: Perhaps that's not the site, and in Windows. That's what gives me in CMD: 456 4 4 8 99 456 [[456, 4, 4, 8, 99, 456]13 546

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 19:22:40 UTC, Alex Parrill wrote: import std.algorithm; import std.range; import std.stdio; import std.conv; void main() { enum n1 = 5; writeln(stdin.byLine .map!(line = line.split( ).map!(x = to!int(x))) );

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 19:22:40 UTC, Alex Parrill wrote: You seem to be focusing on D's arrays only, but the real meat is in ranges, which are more generic. Also note that the above solution doesn't allocate any of the ranges in the heap; they're all on the stack (as opposed to Python,

Re: Python's features, which requires D

2015-05-23 Thread cym13 via Digitalmars-d-learn
Not sure what kind of meat you mean, but I really don't see much meat in ranges. Of course, this is 10 times better and easier to use than STL iterators C++. For me the most important feature D are mixins, which I, unfortunately, rarely use. I'm waiting for new features from D: for new

Re: Python's features, which requires D

2015-05-23 Thread cym13 via Digitalmars-d-learn
(just noticed a weird typo trend with know/now %s/know/now/g)

Re: Python's features, which requires D

2015-05-23 Thread anonymous via Digitalmars-d-learn
On Saturday, 23 May 2015 at 20:25:18 UTC, Dennis Ritchie wrote: This does not work! enum n1 = 5; writeln(stdin.byLine .map!(line = line.split( ).map!(x = to!int(x))) ); - http://rextester.com/VGHZF81178 The code itself is ok. That site has broken newlines. You can see here that

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 20:57:10 UTC, anonymous wrote: On Saturday, 23 May 2015 at 20:25:18 UTC, Dennis Ritchie wrote: This does not work! enum n1 = 5; writeln(stdin.byLine .map!(line = line.split( ).map!(x = to!int(x))) ); - http://rextester.com/VGHZF81178 The code itself is

Re: Python's features, which requires D

2015-05-23 Thread weaselcat via Digitalmars-d-learn
On Friday, 22 May 2015 at 00:23:30 UTC, Dennis Ritchie wrote: Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR After another review, I think some of these conversions to D could be

Re: Python's features, which requires D

2015-05-23 Thread anonymous via Digitalmars-d-learn
On Saturday, 23 May 2015 at 21:08:19 UTC, Dennis Ritchie wrote: Perhaps that's not the site, and in Windows. That's what gives me in CMD: 456 4 4 8 99 456 [[456, 4, 4, 8, 99, 456]13 546 std.conv.ConvException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2013): Unexpected end of input

Re: Python's features, which requires D

2015-05-23 Thread Idan Arye via Digitalmars-d-learn
On Saturday, 23 May 2015 at 22:01:42 UTC, Dennis Ritchie wrote: You may find it nonsense, but Paul Graham says that each language has its own power. He believes that Lisp is the most powerful language, and programmers who write in other languages, he said Blub programmers. Learn more about The

Re: Python's features, which requires D

2015-05-23 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 23 May 2015 at 10:58:33 UTC, Kagamin wrote: Well, list comprehension is built into language in python (and not in D), such level of support is definitely more streamlined. Well, what's to keep D more functions to work with slist and dlist ? In my opinion, lists in D completely

Re: Python's features, which requires D

2015-05-23 Thread Kagamin via Digitalmars-d-learn
On Saturday, 23 May 2015 at 02:36:14 UTC, Dennis Ritchie wrote: For example, the code in Python looks quite natural: a = [[int(j) for j in input().split()] for i in range(n)] About D-code, I can not say: auto a = stdin .byLine .map!(l = l.splitter.map!(to!int).array)

Re: Python's features, which requires D

2015-05-23 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 22 May 2015 at 00:23:30 UTC, Dennis Ritchie wrote: Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR import std.algorithm; import std.range; import std.stdio; import std.conv;

Re: Python's features, which requires D

2015-05-22 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 22 May 2015 at 05:31:38 UTC, Ali Çehreli wrote: Here is my attempt: import std.stdio; import std.algorithm; import std.conv; import std.range; void main() { // Replace 'none' with 'all' to activate. version (none) { const n = 5; auto a = stdin

Re: Python's features, which requires D

2015-05-22 Thread Dennis Ritchie via Digitalmars-d-learn
By the way, Python has deepDup :) http://rextester.com/KBFA82886

Re: Python's features, which requires D

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Friday, 22 May 2015 at 00:23:30 UTC, Dennis Ritchie wrote: Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR D doesn't have list comprehensions, so it's difficult to directly port

Re: Python's features, which requires D

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 22 May 2015 at 01:17:17 UTC, weaselcat wrote: D doesn't have list comprehensions, so it's difficult to directly port these. I can not imagine how difficult it is to implement it in D, but I'm pretty sure that nested for loops to fill arrays (in D, you can call them differently,

Re: Python's features, which requires D

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Friday, 22 May 2015 at 01:52:30 UTC, Dennis Ritchie wrote: On Friday, 22 May 2015 at 01:17:17 UTC, weaselcat wrote: D doesn't have list comprehensions, so it's difficult to directly port these. I can not imagine how difficult it is to implement it in D, but I'm pretty sure that nested for

Re: Python's features, which requires D

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 22 May 2015 at 02:18:23 UTC, weaselcat wrote: On Friday, 22 May 2015 at 01:52:30 UTC, Dennis Ritchie wrote: off the top of my head, the last one can easily be done with std.range.stride import std.stdio, std.range; void main() { int[] a = [ 1, 2, 3, 4, 5, 6 ];

Python's features, which requires D

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR

Re: Python's features, which requires D

2015-05-21 Thread Ali Çehreli via Digitalmars-d-learn
On 05/21/2015 05:23 PM, Dennis Ritchie wrote: Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR Here is my attempt: import std.stdio; import std.algorithm; import std.conv; import std.range;