OK, good replies. Cool. So the two places I thought I'd need to use
explicit types are in parameter and return types. Say, a function returns
the result of map, and another consumes it to print it. The consuming
function seems to work with templating:
void printSquares(T)(T squares) {
On Fri, Jul 8, 2011 at 4:06 PM, James Fisher jameshfis...@gmail.com wrote:
So ... stuff works, but I'm not really sure why one uses function
templating and the other uses return type inference. Any answers?
... Wait, brain malfunction; I think I do understand. The type is inferable
purely
On Fri, 08 Jul 2011 11:08:14 -0400, James Fisher jameshfis...@gmail.com
wrote:
On Fri, Jul 8, 2011 at 4:06 PM, James Fisher jameshfis...@gmail.com
wrote:
So ... stuff works, but I'm not really sure why one uses function
templating and the other uses return type inference. Any answers?
On Fri, Jul 8, 2011 at 4:49 PM, Steven Schveighoffer schvei...@yahoo.comwrote:
On Fri, 08 Jul 2011 11:08:14 -0400, James Fisher jameshfis...@gmail.com
wrote:
On Fri, Jul 8, 2011 at 4:06 PM, James Fisher jameshfis...@gmail.com
wrote:
So ... stuff works, but I'm not really sure why one
To date, I've been using D in much the same way I used C++, without heavy
use of templates. Now I'm trying out a more functional style using
std.algorithm. However I'm pretty much stuck at the first hurdle: map.
With type inference, this works:
import std.algorithm;
import std.stdio;
void
On 2011-07-07 07:00, James Fisher wrote:
To date, I've been using D in much the same way I used C++, without heavy
use of templates. Now I'm trying out a more functional style using
std.algorithm. However I'm pretty much stuck at the first hurdle: map.
With type inference, this works:
James Fisher:
To date, I've been using D in much the same way I used C++, without heavy
use of templates. Now I'm trying out a more functional style using
std.algorithm. However I'm pretty much stuck at the first hurdle: map.
Welcome to functional D :-)
The most general interfaces I can
On Thu, 07 Jul 2011 10:00:48 -0400, James Fisher jameshfis...@gmail.com
wrote:
To date, I've been using D in much the same way I used C++, without heavy
use of templates. Now I'm trying out a more functional style using
std.algorithm. However I'm pretty much stuck at the first hurdle: map.