type.inline_function_placement
Inline function is not an argument to a collection operation.
Area 3, Logic; not declinable; the next step is usually the agent's.
An inline function is written only as an argument to a standard-library collection operation:
type Stock = Int { min: 0}function same_price(per_pack: Stock) -> Stock { return per_pack}function passed_on(per_pack: Stock) -> Stock { return same_price(item -> per_pack)}
error An inline function is only an argument to a collection operation
--> main.jadpo:10:23
|10 | return same_price(item -> per_pack) | ^^^^^^^^^^^^^^^^ inline function
- reason
- Functions aren't values:
item -> expressionis written only as an argument to a standard-library collection operation, such aslist.maporlist.filter. - next
- Write the expression on its own, or pass it to a collection operation (agent)
- rule
- type.
inline_ function_ placement - help
- https://jadpo.
dev/docs/errors/type. inline_ function_ placement
Two parameters, (a, b) -> expression, are only for a standard operation
that gives its function two values (area 19):
type Stock = Int { min: 0}function larger(first: Stock, second: Stock) -> Stock { if (first > second) { return first } return second}function dearer(per_pack: Stock) -> Stock { return larger((a, b) -> a, per_pack)}
error An inline function is only an argument to a collection operation
--> main.jadpo:13:19
|13 | return larger((a, b) -> a, per_pack) | ^^^^^^^^^^^ inline function
- reason
- Functions aren't values:
(key, value) -> expressionis written only as an argument to a standard operation that gives its function two values,list.zip_with,map.filterormap.map_values. - next
- Write the expression on its own, or pass it to a collection operation (agent)
- rule
- type.
inline_ function_ placement - help
- https://jadpo.
dev/docs/errors/type. inline_ function_ placement
Markdown for agents: /docs/errors/type.inline_function_placement.md.Built from Jadpo main at aee2e8f.