Re: Differences between lambda function and regular functions in higher order functions

2022-02-21 Thread steve via Digitalmars-d-learn
thanks a lot both! Yes I'm aware that map exists already. This was didactic. I had tried to find out whether lambdas generate function pointers but also couldn't figure that one out :D

Re: Differences between lambda function and regular functions in higher order functions

2022-02-21 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:04:16 UTC, steve wrote: I am trying to implement a simple map function. I found code to do this in another post but it only seems to work with lambda functions and I do not understand why. Any help would be greatly appreciated ``` import std.stdio; T[]

Re: Differences between lambda function and regular functions in higher order functions

2022-02-21 Thread partypooper via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:04:16 UTC, steve wrote: I am trying to implement a simple map function. I found code to do this in another post but it only seems to work with lambda functions and I do not understand why. Any help would be greatly appreciated ``` import std.stdio; T[]

Differences between lambda function and regular functions in higher order functions

2022-02-21 Thread steve via Digitalmars-d-learn
I am trying to implement a simple map function. I found code to do this in another post but it only seems to work with lambda functions and I do not understand why. Any help would be greatly appreciated ``` import std.stdio; T[] map_vals(T,S)(scope T function(S) f, S[] a){ auto b = new