You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noir currently has generics, but no way to abstract over operations to perform on these generics. With the absence of traits, another method to provide functionality is by manually passing in functions. This requires higher-order functions in noir, or in other words, for functions to accept other functions as parameters and return them as return values.
Solution
Add higher-order functions including function types and lambdas to Noir.
Function types:
fn()fn(Field) -> Fieldfn(i32,T) -> (T, i32)// function takes a function and returns a functionfn(fn(T) -> U) -> fn(T) -> U
Lambdas:
|| {}
|x| x
|x, t| (x, t)
|f:fn(T) -> U| f
The text was updated successfully, but these errors were encountered:
Problem
Noir currently has generics, but no way to abstract over operations to perform on these generics. With the absence of traits, another method to provide functionality is by manually passing in functions. This requires higher-order functions in noir, or in other words, for functions to accept other functions as parameters and return them as return values.
Solution
Add higher-order functions including function types and lambdas to Noir.
Function types:
Lambdas:
The text was updated successfully, but these errors were encountered: