What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Rnd via Digitalmars-d-learn
I have recently started using Dlang, hence this basic question. Thanks for your insight.

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 2 June 2019 at 15:48:54 UTC, Rnd wrote: I have recently started using Dlang, hence this basic question. Thanks for your insight. map and filter are templates in D, and !(...) is D's syntax for passing arguments to templates: map!(x => x*x)([1, 2, 3, 4, 5]) ^ ^ |

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Cym13 via Digitalmars-d-learn
On Sunday, 2 June 2019 at 15:48:54 UTC, Rnd wrote: I have recently started using Dlang, hence this basic question. Thanks for your insight. To know more about D you should take the time to do the D tour [1] which provides you with general knowledge of most of D's functionalities and vocabular

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Rnd via Digitalmars-d-learn
On Sunday, 2 June 2019 at 15:55:46 UTC, Paul Backus wrote: On Sunday, 2 June 2019 at 15:48:54 UTC, Rnd wrote: I have recently started using Dlang, hence this basic question. Thanks for your insight. map and filter are templates in D, and !(...) is D's syntax for passing arguments to templates

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 2 June 2019 at 16:39:57 UTC, Rnd wrote: Is it not possible in the language to have template map function also to called as map(x=>... ? It could be done pretty easily, but you will have to learn what template arguments are eventually anyway. You'll see this pattern all over, like `

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 2 June 2019 at 16:39:57 UTC, Rnd wrote: Is it not possible in the language to have template map function also to called as map(x=>... ? This will reduce complexity which will attract more people to this language. Easy languages have great mass appeal as has been shown with Ruby

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Dennis via Digitalmars-d-learn
On Sunday, 2 June 2019 at 16:39:57 UTC, Rnd wrote: Is it not possible in the language to have template map function also to called as map(x=>... ? That would be slower, and std.algorithm generally disallows easy but slow functions. In Java, you can sort a linked list. In D, sort requires an