Cannot deduce function types for argument

ARaspiK arav1025 at gmail.com
Sun Feb 25 18:39:31 UTC 2018


I'm making a calendar (basically improvements to 
https://wiki.dlang.org/Component_programming_with_ranges) and I'm 
getting a lot of `cannot deduce function from argument types` 
errors when using range-based mapping code.
Here's my current code: https://pastebin.com/TqAkggEw
My testing: `rdmd --eval='import calendar; dateList!(a => a.year 
 > 2013)(2013).chunkBy!myMonth.chunks(3).map!(r => 
r.map!formatMonth.array().blockMonths(" 
").join("\n")).join("\n\n").writeln();'`

My errors:
```
template std.array.array cannot deduce function from argument 
types !()(MapResult!(formatMonth, Take!(ChunkByImpl!(myMonth, 
Until!(__lambda2, Recurrence!(__lambda2, Date, 1LU), void))))), 
candidates are:
std.array.array(Range)(Range r) if (isIterable!Range && 
!isNarrowString!Range && !isInfinite!Range)
std.array.array(Range)(Range r) if (isPointer!Range && 
isIterable!(PointerTarget!Range) && !isNarrowString!Range && 
!isInfinite!Range)
std.array.array(String)(scope String str) if 
(isNarrowString!String)
  instantiated from here: MapResult!(__lambda3, 
Chunks!(ChunkByImpl!(myMonth, Until!(__lambda2, 
Recurrence!(__lambda2, Date, 1LU), void))))
  instantiated from here: map!(Chunks!(ChunkByImpl!(myMonth, 
Until!(__lambda2, Recurrence!(__lambda2, Date, 1LU), void))))
```

Please, can you get this code to work?
The commented out function formatYear needs to work properly. The 
rdmd command-line simply emulates it.


More information about the Digitalmars-d-learn mailing list