February 25, 2018 Cannot deduce function types for argument | ||||
---|---|---|---|---|
| ||||
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. |
February 26, 2018 Re: Cannot deduce function types for argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to ARaspiK | 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.
|
Copyright © 1999-2021 by the D Language Foundation