Blazebit / blaze-expression

Apache License 2.0
5 stars 6 forks source link

Function type syntax #30

Open beikov opened 3 years ago

beikov commented 3 years ago

There are some use cases in the collection functions area where it would be beneficial if a user could provide some kind of user defined function for extracting values. I'm proposing to add a Function type for this purpose that has two type parameters, input and output type. Collection functions could then use that type as argument type. Syntax-wise I would allow the user to provide a custom name for the input i.e. the following: priceHistory.sum(entry -> entry.price). Not sure yet if a short-hand syntax is a good idea, but maybe we could allow priceHistory.sum(#price).