E07460: function must have a single parameter

Category: E07xxx Full resolution · Reported in phase: FULL_RESOLUTION · Classification: FUNCTION_MUST_HAVE_SINGLE_PARAMETER · All error codes

What went wrong

A function or operator requires EXACTLY one parameter but has a different number.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 824 (Why must stream functions have exactly one parameter in EK9?)

[UNARY OPERATORS (require single parameter)] ~, !, ++, --, ?, $

How to fix it

  1. Provide exactly one parameter

Common causes

  • Missing parameter
  • Extra parameters
  • Wrong function type

See also

  • E07460: single parameter required (this error)
  • E07470: two parameters required

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E07460: function must have a single parameter

#!ek9
defines module error.e07460.bad

  defines function

    justACouple()
      <- rtn as Integer: 2

    distinctNumbers()
      <- rtn as List of Integer: List()

      //uniq calls the function with each item
      cat [4, 3, 3, 4, 1] | uniq justACouple > rtn

Fixed: Give uniq a function of one parameter

#!ek9
defines module error.e07460.good

  defines function

    keyOf()
      -> number as Integer
      <- rtn as Integer: number

    distinctNumbers()
      <- rtn as List of Integer: List()
      cat [4, 3, 3, 4, 1] | uniq keyOf > rtn

Questions and answers

These Q&A entries show E07460 and its fix: