Many binary built-in functions in DaphneDSL could naturally be extended to n-ary functions. For instance, cbind concatenates two data object vertically. Instead of cbind(cbind(x, y), z), it would be more intuitive to write cbind(x, y, z). Other examples include: elementwise min/max, rbind, intersect/merge/except, and cartesian.
DaphneDSL (and optionally also DaphneLib, the Python API) should support that. It could be achieved in several ways, e.g.
by creating a tree of binary operations in the DaphneDSL parser, or
by allowing n-ary operations in DaphneIR, which are lowered to a tree of binary operations in a new compiler pass, or
by allowing n-ary operations in DaphneIR and providing n-ary kernels for the runtime
Note that operator symbols like + can already be used in an intuitive way (e.g., a + b + c). The DaphneDSL parser creates a tree of binary operations out of them. If approach 3. from above is chose, those binary trees could even be rewritten to n-ary operations.
In GitLab by @pdamme on Mar 8, 2022, 17:28
Many binary built-in functions in DaphneDSL could naturally be extended to n-ary functions. For instance,
cbind
concatenates two data object vertically. Instead ofcbind(cbind(x, y), z)
, it would be more intuitive to writecbind(x, y, z)
. Other examples include: elementwisemin
/max
,rbind
,intersect
/merge
/except
, andcartesian
.DaphneDSL (and optionally also DaphneLib, the Python API) should support that. It could be achieved in several ways, e.g.
Note that operator symbols like
+
can already be used in an intuitive way (e.g.,a + b + c
). The DaphneDSL parser creates a tree of binary operations out of them. If approach 3. from above is chose, those binary trees could even be rewritten to n-ary operations.