common.aiddl 991 Bytes
Newer Older
Uwe Köckemann's avatar
Uwe Köckemann committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
(#mod self org.aiddl.common)

(#nms EVAL "eval.aiddl")

(#def Map
  (and
    (type #self {list set})
      (forall ?e #self
        (and
          (type ?e key-value) ))))
            
(#def MapGen
  (match (?KT ?VT) #self
    ^(lambda ?M ($MapOf (?KT ?VT ?M)))))

(#def MapOf
  (match (?KeyType ?ValueType ?Map) #self
    (and
      (type ?Map {^list ^set})
      (forall ?k:?v ?Map
        (and
          (type ?k ?KeyType)
          (type ?v ?ValueType)
       )))))

(#def SetGen
  ^(lambda ?Set
    ($SetOf #self ?Set) ))

(#def (SetOf ?Type ?Set)
  (and
    (type ?Set ^set)
    (forall ?e ?Set (type ?e ?Type))))
(#def ListGen
  ^(lambda ?List
    (ListOf ?List #self) ))

(#def (ListOf ?Type)
  (and
    (type #self ^list)
    (forall ?e #self (type ?e ?Type))))


(#def Composite
  (match (?S ?Arg) #self
    (and
      (type ?S ^collection)
      (forall ?e ?S (type ?Arg ?e))
    )))

(#def KeyValuedType
  ^(lambda ?x
    (forall ?k:?t #self
      (call ?t (get-key ?k ?x))) ))