Replies: 1 comment
-
Thanks for bringing this up! We should explain this topic better in the tutorial. Let's consider an example of regular function use:
When compiling this Logica interprets value of F as
Then when F is used the call to F is replaced with
Now let's look at a situation when F is an aggregate function.
First of all let's make call to F less magical. It may be easier to understand what's going on if we write the same program in this form:
You can run this to check that result is the same. In this form function F is treated just as before:
Next step definition of F is substituted:
And finally we end up with:
Thus this form of defining aggregate functions is consistent with Datalog semantics once you extended Datalog with aggregation and functions. Hope this helps. I will spend more time thinking how to explain this concept in a way that's easier to understand. |
Beta Was this translation helpful? Give feedback.
-
Aggregates like List, count, Max have a syntax like
value? Max= val
when occurring in the left hand side in the predicate definition.In some functions like what you had mentioned we call it as Max(val) inside the function.
Are these aggregate syntax(es) consistent with say Datalog or is this very specific to Logica. ( like an syntax extension). And also having something like
value? Max = val
how would you explain this in terms of Logica syntax itself. It uses=
but does not feel like a function. Also when using Min inside the MinOrMax it does not feel like it is getting a column of values.So the question is are these aggreagate syntax a convenient syntax extensions or does the syntax arise from some more fundamental principle. If from a fundamental principle then what is it ?
Beta Was this translation helpful? Give feedback.
All reactions