Comments (3)
I would prefer $all
or $forall
, since $foreach
would normally be a distribution function.
This amounts, in the general case, to TOSCA supporting lambdas, and there are two different functionalities that you may want to achieve: distribution and aggregation.
- Both
$foreach
and$exists
are examples of aggregation, using AND and OR respectively. You could just as well want an aggregating SUM. - Alternatively, you would could want distribution - a function that applies the expression to each element in a list and returns the results in a new list.
Consider now that functions $and
, $or
, $sum
, etc. applied to a list of booleans/numbers automatically aggregate. So @and: <list-expression>*
returns the conjunction of the elements of the lists (potentially skipping any null
elements?), and @or: <list-expression>*
returns the disjunction of the list elements.
Now if we define $each: [ <list of nodes>, <variable name>, <expression> ]
as evaluating the expression for each element of the list expanded with the variable name into the expression, then you can express $forall
as:
$and:
- $each:
- colo-group
- X
- $foreach:
- colo-group
- Y
- $equal:
- [ X, RELATIONSHIP, host, TARGET, uuid ]
- [ Y, RELATIONSHIP, host, TARGET, uuid ]
You may of course still have shorthand functions $forall
and $exists
for this.
from tosca-community-contributions.
Yes, I believe we want aggregation semantics, not distribution.
By the way, Calin raised a concern about the fact that the proposal above uses the same function syntax for defining function values (i.e. values that are obtained by evaluating a function) and for function arguments ("function pointers") to the $forall
and $exists
functions. Any opinions on that?
from tosca-community-contributions.
Related Issues (20)
- TOSCA needs to be specific about where function values are allowed.
- Clarify `function refinement` syntax
- Add support for declarative policies HOT 1
- Remove domain specific scalars HOT 2
- Mix type compatible unit values HOT 3
- Define scalar-units as float or integer HOT 1
- Generalise scalar-units defintions HOT 10
- Dynamic group membership HOT 3
- State machine for interfaces HOT 11
- Repository definitions need a way to specify credentials HOT 1
- remove `properties` keyword underneath the `allocation` keyword in requirement assignments
- Is the node field optional or mandatory in a requirement assignment? HOT 1
- Change TOSCA Path relationship traversal semantics HOT 1
- Contribution guidelines are inconsistent HOT 4
- Placing glossary at the document start could make a new reader feel unwelcome HOT 2
- Representation Model is poorly defined HOT 1
- Definition of terms section is in no particular order
- Some comments have not been correctly handled when converting to markdown HOT 4
- Are TOSCA reserved keywords are case-sensitive?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tosca-community-contributions.