Re:How Eve unifies your entire programming stack
by jononor on Tuesday November 22, 2016 @06:37AM
(#13013347)
Thinking about it, it is possible that this proposal would not work, because in the nothing-matches cases then the function would not be executed at all... But maybe this could work, by widening the matching pattern.
all-checked = all[in: [#todo], where: [completed: true] ]
none-checked = none[in: [#todo], where: [completed: true] ]
todo-count = count[in: [#todo], where: [completed: false], default: 0]
Personally I think we would be much better off with a dedicated aggregate function instead of using if/else here. And count (which is an aggregate function), should have a default value for when no records match. Then could get rid of the if/else there also, and have something like:
Disclaimer: I'm just an Eve user/contributor