www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot deduce function types for argument

reply ARaspiK <arav1025 gmail.com> writes:
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.
Feb 25 2018
parent ARaspiK <arav1025 gmail.com> writes:
On Sunday, 25 February 2018 at 18:39:31 UTC, ARaspiK wrote:
 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();'`

 [...]
I figured it out. I had passed incorrect parameters, and it works now. Thanks for reading.
Feb 25 2018