www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Looking for an equivalent to C++ std::getline in D

reply k-five <vhsu30 yahoo.com> writes:
Hi all.
I have a simple command-line program utility in C++ that can 
rename or remove files, based on regular expression.
After finding D that is more fun than C++ is, I want to port the 
code, but I have problem with this part of it:

         std::getline( iss, match, delimiter );
         std::getline( iss, substitute, delimiter );

I need to read from iss ( = std::istringstream iss( argv[ 1 ] ) 
and separate them by delimiter.

Since the program gets the input from a user, and it can be 
something like: 's/\d+[a-z]+ (?=\.)//g'  or '/[A-Za-z0-9]+//'

So for: s/\d+[a-z]+ (?=\.)//g
I need:
s
\d+[a-z]+ (?=\.)
g

and for: /[A-Za-z0-9]+/
It should be:
[A-Za-z0-9]+

---

I tired ( std.string: split or format ) or ( std.regex split ). 
In fact I need to read from a stream up to a delimiter.

Does someone knows a way to do this in D? Thanks
May 05
parent reply Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Friday, 5 May 2017 at 09:54:03 UTC, k-five wrote:
 Hi all.
 I have a simple command-line program utility in C++ that can 
 rename or remove files, based on regular expression.
 After finding D that is more fun than C++ is, I want to port 
 the code, but I have problem with this part of it:

         std::getline( iss, match, delimiter );
         std::getline( iss, substitute, delimiter );

 I need to read from iss ( = std::istringstream iss( argv[ 1 ] ) 
 and separate them by delimiter.

 Since the program gets the input from a user, and it can be 
 something like: 's/\d+[a-z]+ (?=\.)//g'  or '/[A-Za-z0-9]+//'

 So for: s/\d+[a-z]+ (?=\.)//g
 I need:
 s
 \d+[a-z]+ (?=\.)
 g

 and for: /[A-Za-z0-9]+/
 It should be:
 [A-Za-z0-9]+

 ---

 I tired ( std.string: split or format ) or ( std.regex split ). 
 In fact I need to read from a stream up to a delimiter.

 Does someone knows a way to do this in D? Thanks
So, you need to consume input one element at a time (delimited), dropping empty elements? Try std.algorithm.iteration splitter and filter: auto advance(Range)(ref Range r) { assert(!r.empty); auto result = r.front; r.popFront(); return result; } void main(string[] args) { import std.algorithm.iteration : splitter, filter; import std.range : empty; auto input = args[1].splitter('/').filter!"!a.empty"(); import std.stdio : writeln; while (!input.empty) writeln(input.advance()); } The advance() function reads the next delimited element and pops it from the range.
May 05
parent reply k-five <vhsu30 yahoo.com> writes:
On Friday, 5 May 2017 at 17:07:25 UTC, Stanislav Blinov wrote:
 On Friday, 5 May 2017 at 09:54:03 UTC, k-five wrote:
====================================================== Thanks. I only needed this part since it filters the empty elements and this is enough for me: auto input = args[1].splitter('/').filter!"!a.empty"(); but if your are wailing please explain what is the type of "input" since I think this is an array but after testing it has no [] - index operator ( imput[ 0 ] is fail ) Also what is the parameter "a.empty" for template filter
May 06
next sibling parent reply Jonathan M Davis via Digitalmars-d-learn writes:
On Saturday, May 6, 2017 8:34:11 AM CEST k-five via Digitalmars-d-learn 
wrote:
 On Friday, 5 May 2017 at 17:07:25 UTC, Stanislav Blinov wrote:
 On Friday, 5 May 2017 at 09:54:03 UTC, k-five wrote:
====================================================== Thanks. I only needed this part since it filters the empty elements and this is enough for me: auto input = args[1].splitter('/').filter!"!a.empty"(); but if your are wailing please explain what is the type of "input" since I think this is an array but after testing it has no [] - index operator ( imput[ 0 ] is fail ) Also what is the parameter "a.empty" for template filter
It's a range. The exact type is a "voldemort" type in that its declared internally to filter, and you can't reference it by name. Rather, it has a known API, so you don't need to name it. You just use it. But that does require that you know about D ranges (since you can't use the API if you're not familiar with it). If you're not familiar with D's ranges, I would suggest reading this: http://ddili.org/ders/d.en/ranges.html There's also this talk from dconf 2015: https://www.youtube.com/watch?v=A8Btr8TPJ8c But if you don't have at least a basic understanding of what ranges are, a good chunk of D's standard library (std.algorithm in particular) is likely to be confusing. Now, if you want to get a dynamic array out of a range, then you can call std.array.array on it, and array will allocate a dynamic array. So, if you call array on input, then you'll have a dynamic array to operate on instead. In general though, if you're able to operate on ranges rather than dynamic arrays specifically, the code will be more efficient (e.g. both splitter and filter return lazy ranges, so they're not actually doing any work until you iterate over the range, and converting the range to a dynamic array would mean iterating through the entire range as well as allocating memory). So, while converting to a dynamic array is often the right solution, it's usually better to avoid it if you don't need it. But obviously, you'll need to be familiar with ranges first. - Jonathan M Davis
May 06
parent reply k-five <vhsu30 yahoo.com> writes:
On Saturday, 6 May 2017 at 08:53:12 UTC, Jonathan M Davis wrote:
 On Saturday, May 6, 2017 8:34:11 AM CEST k-five via 
 Digitalmars-d-learn wrote:
 On Friday, 5 May 2017 at 17:07:25 UTC, Stanislav Blinov wrote:
 On Friday, 5 May 2017 at 09:54:03 UTC, k-five wrote:
--------------------------------------------------------- Although I am not sure but it may Range in D, has the same concept that C++ has on iterator, like InputIterator or OutputIterator, since I realized that the output of [ filter ] does not have RandomAccessRange so I can not use input[ 0 ]. But I can use input.front(). Also thank you Stanislav Blinov, I am familiar with lambda but have never seen a lambda in shape of string :) --------------------------------------------------------- Solving the problem by using split and empty in std.string or splitter in std.algorithm or splitter in std.regex plus filter in std.algorithm, and accessing the elements by: input.front() input.popFront() --------------------------------------------------------- for input: import std.stdio : print = writeln; import std.algorithm: filter; import std.string: split, empty; void main() { immutable (char)[] str = "one//two//three"; auto input = str.split( '/' ).filter!( element => !element.empty )(); print( input.front ); input.popFront(); print( input.front ); input.popFront(); print( input.front ); } the output is: one two three
May 06
next sibling parent reply Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Saturday, 6 May 2017 at 10:15:03 UTC, k-five wrote:
 On Saturday, 6 May 2017 at 08:53:12 UTC, Jonathan M Davis wrote:
 On Saturday, May 6, 2017 8:34:11 AM CEST k-five via 
 Digitalmars-d-learn wrote:
 On Friday, 5 May 2017 at 17:07:25 UTC, Stanislav Blinov wrote:
 On Friday, 5 May 2017 at 09:54:03 UTC, k-five wrote:
--------------------------------------------------------- Although I am not sure but it may Range in D, has the same concept that C++ has on iterator, like InputIterator or OutputIterator, since I realized that the output of [ filter ] does not have RandomAccessRange so I can not use input[ 0 ]. But I can use input.front(). Also thank you Stanislav Blinov, I am familiar with lambda but have never seen a lambda in shape of string :) --------------------------------------------------------- Solving the problem by using split and empty in std.string or splitter in std.algorithm or splitter in std.regex plus filter in std.algorithm, and accessing the elements by: input.front() input.popFront() --------------------------------------------------------- for input: import std.stdio : print = writeln; import std.algorithm: filter; import std.string: split, empty; void main() { immutable (char)[] str = "one//two//three"; auto input = str.split( '/' ).filter!( element => !element.empty )(); print( input.front ); input.popFront(); print( input.front ); input.popFront(); print( input.front ); } the output is: one two three
str.split('/') is eager, that is, it will iterate the input and return the array of delimited elements. So in fact you're getting an array of all elements (even empty ones), and then filtering it, ignoring empty elements. If you want to get the output as an array, it's better to use std.array as Jonathan mentioned: import std.array : array; auto inputArray = str.splitter('/').filter!(a => !a.empty)().array; This will eagerly consume the results of filter and put them into an array.
May 06
parent k-five <vhsu30 yahoo.com> writes:
On Saturday, 6 May 2017 at 10:35:05 UTC, Stanislav Blinov wrote:
 On Saturday, 6 May 2017 at 10:15:03 UTC, k-five wrote:
 On Saturday, 6 May 2017 at 08:53:12 UTC, Jonathan M Davis 
 wrote:
 On Saturday, May 6, 2017 8:34:11 AM CEST k-five via 
 Digitalmars-d-learn wrote:
 On Friday, 5 May 2017 at 17:07:25 UTC, Stanislav Blinov 
 wrote:
 On Friday, 5 May 2017 at 09:54:03 UTC, k-five wrote:
----------------------------------------------------------- Oh! So much better, Many thanks. I am only reading about D for two weeks. To be honest I did not understand what Jonathan M Davis mentioned, but your example clarified it to me.
May 06
prev sibling parent reply Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Saturday, 6 May 2017 at 10:15:03 UTC, k-five wrote:
 Although I am not sure but it may Range in D, has the same 
 concept that C++ has on iterator, like InputIterator or 
 OutputIterator, since I realized that the output of [ filter ] 
 does not have RandomAccessRange so I can not use input[ 0 ]. 
 But I can use input.front().
If you want to learn the basis of the range concept and their link to C++ Iterators, you should definitively read Andrei's article on them in the InformIT magazine. Here is the link http://www.informit.com/articles/printerfriendly/1407357 required read for every aspiring D programmer ;-)
May 07
parent reply k-five <vhsu30 yahoo.com> writes:
On Sunday, 7 May 2017 at 09:46:22 UTC, Patrick Schluter wrote:
 On Saturday, 6 May 2017 at 10:15:03 UTC, k-five wrote:
 If you want to learn the basis of the range concept and their 
 link to C++ Iterators, you should definitively read Andrei's 
 article on them in the InformIT magazine. Here is the link
 http://www.informit.com/articles/printerfriendly/1407357
 required read for every aspiring D programmer ;-)
--------------------------------------------------- Thanks for the article. Although I found D for being more better, nicer,and fun than C++ is, but there is a few questions on Stack-Over-Flow, videos on Youtube, and some other forums in my country. So, why D is not popular? I am a big fan of Perl-one-liner and after seeing rdmd --evel='one-line-code' I gasped! Oh, really? a one-liner with D! Or even Unix Command Line, that D has Uniform Function Call Syntax. line.sort.uniq.writeln(); It may you know about the future of D or may introduce some other articles about the future of D to me. Since after learning C++ I am not very comfortable with.
May 07
next sibling parent reply Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote:
 On Sunday, 7 May 2017 at 09:46:22 UTC, Patrick Schluter wrote:
 On Saturday, 6 May 2017 at 10:15:03 UTC, k-five wrote:
 If you want to learn the basis of the range concept and their 
 link to C++ Iterators, you should definitively read Andrei's 
 article on them in the InformIT magazine. Here is the link
 http://www.informit.com/articles/printerfriendly/1407357
 required read for every aspiring D programmer ;-)
--------------------------------------------------- Thanks for the article. Although I found D for being more better, nicer,and fun than C++ is, but there is a few questions on Stack-Over-Flow, videos on Youtube, and some other forums in my country. So, why D is not popular?
Because everyone is asking this question instead of actually doing something about it :) To be fair, D has a good amount of usage even today, it's just not being screamed about ecstatically.
 I am a big fan of Perl-one-liner and after seeing
 rdmd --evel='one-line-code'
 I gasped! Oh, really? a one-liner with D!

 Or even Unix Command Line, that D has Uniform Function Call 
 Syntax.
 line.sort.uniq.writeln();

 It may you know about the future of D or may introduce some 
 other articles about the future of D to me. Since after 
 learning C++ I am not very comfortable with.
Today is the last day of the D Conference 2017, last three days it was livestreaming. There were quite a bit of talks on current developments and future progress. The videos from those streams should appear at https://www.youtube.com/user/sociomantic/videos hopefully early next week. They also have previous conference videos out there.
May 07
parent Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Sunday, 7 May 2017 at 12:29:20 UTC, Stanislav Blinov wrote:
 On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote:
 [...]
Because everyone is asking this question instead of actually doing something about it :) To be fair, D has a good amount of usage even today, it's just not being screamed about ecstatically.
 [...]
Today is the last day of the D Conference 2017, last three days it was livestreaming. There were quite a bit of talks on current developments and future progress. The videos from those streams should appear at https://www.youtube.com/user/sociomantic/videos hopefully early next week. They also have previous conference videos out there.
Some of them have started to appear already 3 hours ago.
May 07
prev sibling parent reply bachmeier <no spam.net> writes:
On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote:

 Although I found D for being more better, nicer,and fun than 
 C++ is, but there is a few questions on Stack-Over-Flow, videos 
 on Youtube, and  some other forums in my country. So, why D is 
 not popular?
If by popular you mean C++ or Java levels of usage, that's a pretty high standard. While D is not among the most used languages in large enterprises, it is definitely not an obscure language. For example, just a few days ago I was reading about the new Scala Native project. Among the motivations for that project is "Scala Native provides an interop layer that makes it easy to interact with foreign native code. This includes C and other languages that can expose APIs via C ABI (e.g. C++, D, Rust etc.)" [0] You have to be careful about using stackoverflow as a measure of language popularity. Most activity takes place on this mailing list, which was going long before stackoverflow, and there was little motivation to move there (Google searches will bring you here). One of the few quantitative measures (and even that's of limited use) is DMD downloads from this site. Most recently they have been at about 50,000 per month.[1] [0] http://www.scala-native.org/en/latest/user/interop.html [1] http://erdani.com/d/downloads.daily.png
May 07
parent reply Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Sunday, 7 May 2017 at 13:16:16 UTC, bachmeier wrote:
 On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote:

 Although I found D for being more better, nicer,and fun than 
 C++ is, but there is a few questions on Stack-Over-Flow, 
 videos on Youtube, and  some other forums in my country. So, 
 why D is not popular?
If by popular you mean C++ or Java levels of usage, that's a pretty high standard. While D is not among the most used languages in large enterprises, it is definitely not an obscure language. For example, just a few days ago I was reading about the new Scala Native project. Among the motivations for that project is "Scala Native provides an interop layer that makes it easy to interact with foreign native code. This includes C and other languages that can expose APIs via C ABI (e.g. C++, D, Rust etc.)" [0] You have to be careful about using stackoverflow as a measure of language popularity. Most activity takes place on this mailing list, which was going long before stackoverflow, and there was little motivation to move there (Google searches will bring you here). One of the few quantitative measures (and even that's of limited use) is DMD downloads from this site. Most recently they have been at about 50,000 per month.[1] [0] http://www.scala-native.org/en/latest/user/interop.html [1] http://erdani.com/d/downloads.daily.png
If you look on TIOBE [1] newest stats, D does not look so bad after all. It's ranked 23 with a 1.38% share. The so fashionable and noisy Rust is only ranked 40 with 0.41% of share and classics like COBOL, FORTRAN, Lisp, Scala, Ada, bash are all behind. So it's not yet in the top 20 but I think that it will continue growing, slowly and steadily. [1]: https://www.tiobe.com/tiobe-index/
May 07
next sibling parent k-five <vhsu30 yahoo.com> writes:
On Sunday, 7 May 2017 at 20:50:10 UTC, Patrick Schluter wrote:
 On Sunday, 7 May 2017 at 13:16:16 UTC, bachmeier wrote:
 On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote:
------------------------------------------------------- When I want to learn to code, I asked in some forums about it, and almost everyone told: Learn C++, C++ is powerful, and so. After practicing and collecting more than 2000 example on my githum with C++, I founded even though C++ is not so powerful, it is a kind of dirty or messy. A collection of modern code after C++11 beside of old C code. No standard library for time, for socket, for file, or .... For learning C++ I printed out the whole website: en.cppreference.com and cplusplus.com. They really have a lot examples for each part. Whereas some pages of reference library here, even have no examples in the entire page! I downloaded a pdf 2015 from tutorialspoint.com, but some of its examples would not even compile. The pest part of here in my opinion is tour part. https://tour.dlang.org/ And the best way (in my opinion ) to make D more popular than now is sharing so many practical examples or nice code. I am now trying to port my C++ code to D and share a collection of examples in my github. Hopefully it can help even though I got familiar with D for two weeks.
May 08
prev sibling parent reply Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Sunday, 7 May 2017 at 20:50:10 UTC, Patrick Schluter wrote:
 If you look on TIOBE [1] newest stats, D does not look so bad 
 after all. It's ranked 23 with a 1.38% share. The so
Tiobe is a "hoax". Stack overflow counts for alternative languages: "swift": 146,374 "scala": 65,594 "go": 22,212 "rust": 6,596 "d": 2,211 "nim": 167
May 08
next sibling parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
Here is another metric, number of star the main compiler has on 
github:

Chapel: 437
Coq: 618
Ocaml: 1,258
Dmd: 1,574
Haxe: 1,865
Nim: 3,598
Crystal: 8,064
Scala: 8,158
Julia: 8,569
Rust: 21,684
TypeScript:  21,748
Go: 27,702
May 08
prev sibling parent reply Daniel N <no public.email> writes:
On Monday, 8 May 2017 at 10:51:52 UTC, Ola Fosheim Grøstad wrote:
 On Sunday, 7 May 2017 at 20:50:10 UTC, Patrick Schluter wrote:
 If you look on TIOBE [1] newest stats, D does not look so bad 
 after all. It's ranked 23 with a 1.38% share. The so
Tiobe is a "hoax". Stack overflow counts for alternative languages: "swift": 146,374 "scala": 65,594 "go": 22,212 "rust": 6,596 "d": 2,211 "nim": 167
Stack-Overflow usage is clearly not representative of language usage. 1) Our forum is flourishing, why would any D developer use SO? 2) The number of questions is directly proportional with the difficulty of the language.(D is quite easy to learn, especially compared to rust).
May 08
next sibling parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Monday, 8 May 2017 at 11:41:02 UTC, Daniel N wrote:
 Stack-Overflow usage is clearly not representative of language 
 usage.
 1) Our forum is flourishing, why would any D developer use SO?
 2) The number of questions is directly proportional with the 
 difficulty of the language.(D is quite easy to learn, 
 especially compared to rust).
But D is much older... Anyway look at Github: Idris: 1770 stars ...and that is a brand new and odd language.
May 08
prev sibling parent reply Jonathan M Davis via Digitalmars-d-learn writes:
On Monday, May 08, 2017 11:41:02 Daniel N via Digitalmars-d-learn wrote:
 On Monday, 8 May 2017 at 10:51:52 UTC, Ola Fosheim Grřstad wrote:
 On Sunday, 7 May 2017 at 20:50:10 UTC, Patrick Schluter wrote:
 If you look on TIOBE [1] newest stats, D does not look so bad
 after all. It's ranked 23 with a 1.38% share. The so
Tiobe is a "hoax". Stack overflow counts for alternative languages: "swift": 146,374 "scala": 65,594 "go": 22,212 "rust": 6,596 "d": 2,211 "nim": 167
Stack-Overflow usage is clearly not representative of language usage. 1) Our forum is flourishing, why would any D developer use SO? 2) The number of questions is directly proportional with the difficulty of the language.(D is quite easy to learn, especially compared to rust).
There are a lot of different metrics that can be used to measure how popular a language is. Tiobe and SO are just two of them. And with each metric, you have to keep in mind how they get those numbers in order to figure out what they indicate. It's easy to tell that D is not as big as languages like C/C++, but it can be much harder to tell how its usage compares to languages like Rust. LOL. I get the impression that it's often the tendancy of D folks is to get excited when D shows up as high in a list like Tiobe and to argue that the list doesn't mean much if D isn't high in the list. - Jonathan M Davis
May 09
parent reply Moritz Maxeiner <moritz ucworks.org> writes:
On Tuesday, 9 May 2017 at 19:11:08 UTC, Jonathan M Davis wrote:
 LOL. I get the impression that it's often the tendancy of D 
 folks is to get excited when D shows up as high in a list like 
 Tiobe and to argue that the list doesn't mean much if D isn't 
 high in the list.
AKA confirmation bias. Not unique to D folks :)
May 09
parent Jonathan M Davis via Digitalmars-d-learn writes:
On Tuesday, May 09, 2017 21:37:19 Moritz Maxeiner via Digitalmars-d-learn 
wrote:
 On Tuesday, 9 May 2017 at 19:11:08 UTC, Jonathan M Davis wrote:
 LOL. I get the impression that it's often the tendancy of D
 folks is to get excited when D shows up as high in a list like
 Tiobe and to argue that the list doesn't mean much if D isn't
 high in the list.
AKA confirmation bias. Not unique to D folks :)
True enough. :) - Jonathan M Davis
May 10
prev sibling parent reply Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Saturday, 6 May 2017 at 08:34:11 UTC, k-five wrote:

 Also what is the parameter "a.empty" for template filter
Jonathan covered the type part. As for that last bit, the filter template takes a predicate as parameter. This predicate is called for each input element, and if returns false, the element is ignored. The predicate can be a function, or, for example, a lambda: auto input = args[1].splitter('/').filter!((string s) { return !s.empty; })(); or a template lambda: auto input = arga[1].splitter('/').filter!((s) => !s.empty)(); By convention, predicates in Phobos can also be compile-time strings. In that case, std.functional.unaryFun is used to turn that string into a function. By default, unaryFun names the argument 'a', so the "!a.empty" will be expanded by unaryFun into (a) => !a.empty.
May 06
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 05/06/2017 02:24 AM, Stanislav Blinov wrote:

 auto input = args[1].splitter('/').filter!((string s) { return !s.empty;
 })();

 or a template lambda:

 auto input = arga[1].splitter('/').filter!((s) => !s.empty)();
Not necessarily better but worth mentioning: import std.functional : not; auto input = args[1].splitter('/').filter!(not!empty)(); Ali
May 08
parent reply k-five <vhsu30 yahoo.com> writes:
On Monday, 8 May 2017 at 21:37:17 UTC, Ali Çehreli wrote:
 On 05/06/2017 02:24 AM, Stanislav Blinov wrote:
------------------------------------------------
It may D has this philosophy as Perl has: There's more than one way to do it I found more than 5 ways. another way: string[] input = [ "", "", "", "", "" ]; // reserve for 5 elements args[ 1 ].split( '/' ).remvoe!( element => element.empty ).copy( input ); Thanks anyway
May 09
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 05/09/2017 01:17 AM, k-five wrote:
 On Monday, 8 May 2017 at 21:37:17 UTC, Ali Çehreli wrote:
 On 05/06/2017 02:24 AM, Stanislav Blinov wrote:
 ------------------------------------------------
It may D has this philosophy as Perl has: There's more than one way to do it
D certainly does not have such a philosophy. :)
 I found more than 5 ways.

 another way:

 string[] input = [ "", "", "", "", "" ];  // reserve for 5 elements
 args[ 1 ].split( '/' ).remvoe!( element => element.empty ).copy( input );
D does not try to limit the programmer but there aren't many ways of reading a line. Note that the difference in the above case is what the programmer is doing with the results. For example, copying the splitted lines into a pre-existing array should not count as a different way. Plus, wrapping steps of the same sollution in a function should not count as a different way. Otherwise, we can have infinite number of ways of doing the same things. For example, not!empty is the equivalent of the following function: auto notEmpty_0(T)(T a) { return !a.empty; } Change 0 above to 1, 2, ... :) Ali
May 10
parent k-five <vhsu30 yahoo.com> writes:
On Wednesday, 10 May 2017 at 10:47:13 UTC, Ali Çehreli wrote:
 On 05/09/2017 01:17 AM, k-five wrote:
 On Monday, 8 May 2017 at 21:37:17 UTC, Ali Çehreli wrote:
 On 05/06/2017 02:24 AM, Stanislav Blinov wrote:
 ------------------------------------------------
 Plus, wrapping steps of the same sollution in a function should 
 not count as a different way. Otherwise, we can have infinite 
 number of ways of doing the same things. For example, not!empty 
 is the equivalent of the following function:

 auto notEmpty_0(T)(T a) {
     return !a.empty;
 }

 Change 0 above to 1, 2, ... :)
----------------------------------------------------- Yes you are right. I admit.
May 10