cgrand / enlivez

8 stars 0 forks source link

Relational expressions #40

Open cgrand opened 4 years ago

cgrand commented 4 years ago

A relational expression is an expression. I use the word expression in contrast to statement (see https://en.wikipedia.org/wiki/Expression_(computer_science) for example). Expressions nest, statements don't.

In typical datalog, clauses don't nest. To me it's a loss in expressivity because it means that you must name a lot more of variables.

In Datalog a predicate has no direction: it has no output or input attributes, all attributes are full duplex so to say. However while a predicate may not technically have a direction, it generally has a semantical one: that's why by default the last argument is considered to be the return attribute.

cgrand commented 4 years ago

I'm considering switching the whole surface syntax to expressions.

It means no and, or or not as we know them.

I'm looking at a special form taking a "binding" vector and then a single expression. Current candidate is such as it doesn't come loaded with preconceptions.

(ez/such [expr0 expr1
          ...,
          expr2n expr2n+1]
  expr-body)
cgrand commented 4 years ago

Ok let's try to list some ops:

It seems like or, such and no could be the three ops to which expressions should expand. Then these expanded expressions can be converted to statements.