E07860: require a function or function delegate
What went wrong
This context requires a function or function delegate but one wasn't provided.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 857 (Why does stream split require a function or delegate?)
How to fix it
- Provide function or delegate
- Or use named function reference
Common causes
- Missing function argument
- Wrong type passed (value instead of function)
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07860: require a function or function delegate
#!ek9 defines module error.e07860.bad defines function doubleAll() <- rtn as List of Integer: List() doubler <- 42 //map needs a function to apply to each item cat [1, 2, 3] | map with doubler > rtn
Fixed: Give map a function
#!ek9 defines module error.e07860.good defines function doubler() -> number as Integer <- rtn as Integer: number * 2 doubleAll() <- rtn as List of Integer: List() cat [1, 2, 3] | map with doubler > rtn
Questions and answers
These Q&A entries show E07860 and its fix: