Syntactische suiker

Issue #29 new
Bart Bogaerts created an issue

Sets - arrays - lists Binary quantifiers Type definitions (UNA) Renaming symbols and blocks Boolean equality Object-oriented flavour (object with fields) If-then-else

one = ?1 lone = ?<2 no = ~? algemene "implies" => ?x: P(x) | Q(x) = ?x: P(x) & Q(x) !x: P(x) | Q(x) = !x: P(x) => Q(x)

#{P} = 3 => het totaal aantal tupels dat aan P voldoet is drie

structure for 3 of all => alle types hebben drie elementen

Voorstel voor sets-arrays-lists: type elem type tuple<elem, elem> elemtuple type set<elemtuple> elemset type array<elemset> elemsetarray

P(elemsetarray)

zou gecompileerd kunnen worden naar

type elem

type int tuple partial first(tuple): elem partial second(tuple): elem

type int elemset type int essize contains(elemset, tuple) size(elemset): essize //size of set, nb of elements it contains

type int elemsetarray type int esaindex partial contains(elemsetarray, esaindex): elemset //array[index] -> elemset size(elemsetarray): esaindex //size of array (beyond is empty)

P(elemsetarray)

//Constraints constraint on the arraysize constraint on the set size

Comments (7)

  1. Sven Verdoolaege

    Other requested syntactic sugar:

    "and" -> "&"

    "or" -> "|"

    "not" -> ""

    "implies" -> "=>"

    "if" -> "<="

    "iff" -> "<=>"

    "forall" -> "!"

    "exists" -> "?"

    "in <predicate>" -> "[<predicate>]"

    Also, it would be nice if variables could be separated by a comma in a quantifier expression. That is, allow

    forall x in S, y in U:

    as syntactic sugar for

    !x[S] y[U]:

  2. Broes De Cat

    Allow ( ) around sets of variables. E.g. for queries it is quite natural to write { (x,y) : ... }

  3. Log in to comment