github vmware/differential-datalog v0.37.0
DDlog v0.37.0

latest releases: v1.2.3, v1.2.2, v1.2.1...
3 years ago

[0.37.0] - Feb 15, 2021

Language improvements

  • Enable pattern matching in for loops and FlatMap. One can now write:

    for ((k,v) in map) {}
    

    instead of

    for ((kv in map) { var k = kv.0}
    

    and

    (var x, var y) = FlatMap(expr)
    

    instead of:

    var xy = FlatMap(expr),
    var x = xy.0
    
  • Remove the hardwired knowledge about iterable types from the compiler.
    Until now the compiler only knew how to iterate over Vec, Set,
    Map, Group, and TinySet types. Instead we now allow the programmer
    to label any extern type as iterable, meaning that it implements iter()
    and into_iter() methods, that return Rust iterators using one of two
    attributes:

    #[iterate_by_ref=iter:<type>]
    

    or

    #[iterate_by_val=iter:<type>]
    

    where type is the type yielded by the next() method of the iterator
    The former indicates that the iter() method returns a by-reference
    iterator, the latter indicates that iter() returns a by-value
    iterator.

    As a side effect of this change, the compiler no longer distinguishes
    maps from other cotnainers that over 2-tuples. Therefore maps are
    represented as lists of tuples in the Flatbuf-based Java API.

  • Groups now iterate with weight. Internally, all DDlog relations are
    multisets, where each element has a weight associated with it. We change
    the semantics of groups to expose these weights during iteration.
    Specifically, when iterating over a group in a for-loop or flattening it
    with FlatMap, each value in the iterator is a (v, w) tuple, where w
    is the weight of element v.

    We keep the semantics of all existing library aggregates unchanged,
    i.e., they ignore weights during iteration. This means that most existing
    user code is not affected (custom aggregates are not that common).

  • The group_by operator now works on streams and produces a stream of groups,
    one for each individual transaction.
    (Tutorial section)

  • Two new DDlog operators: delay and differentiation. The former refers
    to the contents of a relation from N transactions ago, where N is a positive
    integer constant. The latter converts a stream into a relation that contains new
    values added to the stream byt the last transaction.
    (Tutorial section)

Don't miss a new differential-datalog release

NewReleases is sending notifications on new releases.