Error codes

E0204: closure parameter count mismatch

In a terminal: auk explain E0204 prints this page.

On this page

The closure takes a different number of parameters than the function it is passed to expects. For example, map passes one item, reduce passes two values.

Wrong#

auk
fn total(xs: [int]): [int] = xs.map((a, b) => a + b)

Fixed#

auk
fn total(xs: [int]): [int] = xs.map(a => a + 1)

Common causes#

  • Using (i, x) => with map to get the index: write xs.enum().map((i, x) => ...).
  • Mixing up map (one parameter) and reduce (two).
  • A closure with zero parameters is written () => ....

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page