digitalmars.D.learn - Looking for an equivalent to C++ std::getline in D
- k-five (23/23) May 05 2017 Hi all.
- Stanislav Blinov (22/45) May 05 2017 So, you need to consume input one element at a time (delimited),
- k-five (10/11) May 06 2017 ======================================================
- Jonathan M Davis via Digitalmars-d-learn (26/37) May 06 2017 It's a range. The exact type is a "voldemort" type in that its declared
- k-five (39/43) May 06 2017 ---------------------------------------------------------
- Stanislav Blinov (12/56) May 06 2017 str.split('/') is eager, that is, it will iterate the input and
- k-five (6/14) May 06 2017 -----------------------------------------------------------
- Patrick Schluter (6/11) May 07 2017 If you want to learn the basis of the range concept and their
- k-five (16/22) May 07 2017 ---------------------------------------------------
- Stanislav Blinov (11/33) May 07 2017 Because everyone is asking this question instead of actually
- Patrick Schluter (2/15) May 07 2017 Some of them have started to appear already 3 hours ago.
- bachmeier (21/25) May 07 2017 If by popular you mean C++ or Java levels of usage, that's a
- Patrick Schluter (8/33) May 07 2017 If you look on TIOBE [1] newest stats, D does not look so bad
- k-five (22/24) May 08 2017 -------------------------------------------------------
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (9/11) May 08 2017 Tiobe is a "hoax".
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (14/14) May 08 2017 Here is another metric, number of star the main compiler has on
- Daniel N (7/18) May 08 2017 Stack-Overflow usage is clearly not representative of language
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (4/10) May 08 2017 But D is much older... Anyway look at Github:
- Jonathan M Davis via Digitalmars-d-learn (11/32) May 09 2017 There are a lot of different metrics that can be used to measure how pop...
- Moritz Maxeiner (2/6) May 09 2017 AKA confirmation bias. Not unique to D folks :)
- Jonathan M Davis via Digitalmars-d-learn (4/10) May 10 2017 True enough. :)
- Stanislav Blinov (15/16) May 06 2017 Jonathan covered the type part. As for that last bit, the filter
- =?UTF-8?Q?Ali_=c3=87ehreli?= (5/9) May 08 2017 Not necessarily better but worth mentioning:
- k-five (10/12) May 09 2017 It may D has this philosophy as Perl has: There's more than one
- =?UTF-8?Q?Ali_=c3=87ehreli?= (15/24) May 10 2017 D does not try to limit the programmer but there aren't many ways of
- k-five (3/15) May 10 2017 -----------------------------------------------------
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 2017
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? ThanksSo, 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 2017
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 2017
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: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 DavisOn 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 2017
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:--------------------------------------------------------- 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 threeOn 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:
May 06 2017
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: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.On Saturday, May 6, 2017 8:34:11 AM CEST k-five via Digitalmars-d-learn 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 threeOn 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:
May 06 2017
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:----------------------------------------------------------- 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.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:
May 06 2017
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 2017
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 2017
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: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.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.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 2017
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:Some of them have started to appear already 3 hours ago.[...]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.
May 07 2017
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 2017
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: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/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 2017
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:------------------------------------------------------- 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.On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote:
May 08 2017
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 soTiobe 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 2017
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 2017
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: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).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 soTiobe 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 2017
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 2017
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: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 DavisOn Sunday, 7 May 2017 at 20:50:10 UTC, Patrick Schluter 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).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 soTiobe 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 09 2017
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 2017
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:True enough. :) - Jonathan M DavisLOL. 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 10 2017
On Saturday, 6 May 2017 at 08:34:11 UTC, k-five wrote:Also what is the parameter "a.empty" for template filterJonathan 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 2017
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 2017
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 2017
On 05/09/2017 01:17 AM, k-five wrote:On Monday, 8 May 2017 at 21:37:17 UTC, Ali Çehreli wrote:D certainly does not have such a philosophy. :)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 itI 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 2017
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 2017