BayesianLogic / blog

The BLOG programming language
http://bayesianlogic.github.io/
BSD 4-Clause "Original" or "Old" License
98 stars 31 forks source link

New set list comprehension #203

Closed lileicc closed 10 years ago

lileicc commented 10 years ago
  1. removed Implicit set. Set will be either explicit set or tuple set e.g.
{age(x) for Person x: height(x) > 6}
  1. added List comprehension, similar to tuple set
[age(x) for Person x: height(x) > 6]
  1. need to remove ImplicitSetSpec

@cberzan @chrisgioia64

lileicc commented 10 years ago

@jxwuyi please note that case-expression branch already support the new set and list comprehension

lileicc commented 10 years ago

@cberzan @chrisgioia64 Do we need to support the CardinalitySpec, it seems not necessary. Instead we can just add size() builtin function.

Of course, for syntax, we can still keep something like

obs #Person = 23;

It is equivalent to

obs size({x for Person x}) = 23;

@StuartRussell Please vote if you like it or not

lileicc commented 10 years ago

@chrisgioia64

  1. please add support for CardinalitySpec, (@cberzan do you think we should use size() instead?)
  2. please also support symbol evidence
  3. Add iota buildin function that return the single element of a singleton set.
  4. add support of list comprehension (the syntax already supports)