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

Paul Backus snarwin at gmail.com
Sun Jun 2 15:55:46 UTC 2019


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])
      ^         ^
      |         |
      |         +- This array is a normal function argument
      |
      +- This lambda is a template argument


More information about the Digitalmars-d-learn mailing list