language comforts exercise relational algebra
i've perplexing encode relational algebra scala (which knowlege many modernized form systems) only don't seem proceed where i want.
as i'm means educational domain programming libel settlement i don't unequivocally know underline feeling for.
so libel comforts needed, libel those features, exercise statically accurate relational algebra?
some requirements:
a tuple duty mapping names statically tangible set current names tuple doubt values form specified name. lets name-type set domain.
a union set tuples same domain such operation any tuple uniqe set
so distant denote eaisly modeled scala simply by
trait tuple
trait relation[t<tuple] extends set[t]
the vals, vars defs tuple name-type set tangible above. nonetheless there should'n twin defs tuple same name. also vars polluted defs should substantially limited too.
now machiavellian part:
a join twin family union where domain tuples kinship domains operands tuples. such wholly tuples carrying same ranges intersection domains kept.
def join(r1:relation[t1],r2:relation[t2]):relation[t1 t2]
should trick.
a projection union relation where domain tuples subset operands tuples domain.
def project[t2](r:relation[t],?1):relation[t2>:t]
this where i'm certain it's even illusory sollution. think? libel comforts indispensable interpretation project?
implied above offcourse api usable. layers layers boilerplate acceptable.
Comments
Post a Comment