-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
fun a(name: string) = | => name|
test case Error [fail] {
assert a("test")() equals "test" [C] [1 ms] [error]
} Error message: invalid value detected: invalid null value detected
In the ArgRef interpreter, the value can't be looked up in the environment because it is probably only searched in the context of the lambda expression and not in the parameter list of the function.
If you return a function with at least one argument, there is a workaround:
Assuming you want to return a function with signature number => string, you can bind the parameters to the inner lambda and create a curried function as a result:
fun a(name: string) = |innerName: string, count: number => innerName + " " + count|.bind(name)
Metadata
Metadata
Assignees
Labels
No labels