ethereum / langlab

MIT License
8 stars 5 forks source link

Domain Analysis of Decisions #7

Open markusvoelter opened 6 years ago

markusvoelter commented 6 years ago

Build a feature model of the domain of decisions and design a DSL around it. A starting point are the following points mentioned by @chriseth

markusvoelter commented 6 years ago

Some considerations:

bj2015 commented 6 years ago

Some additional points:

Examples: consensus(set<bool> votes): bool = votes.count(true) >= votes.count(false)

consensus(set<Enum> votes): Enum = votes.select{|it| (it, votes.count(it)) }.max{ |it| it.second }.first

consensus(set<integer> votes): integer = votes.sum() / votes.size() # works also for float

# everybody has 2 votes and every element with more that 25% is in
consensus(set<set<string>> votes): set<string> = let valid = votes.where{ |it| it.size() == 2 }, all = valid.inject(union) in 
    all.where{ |e| valid.count{ |it| e in it } >= (valid.size() / 4) }