c = true.
d = false.
things = [1, [2, 2], [3, 4]].
+thingsbag = [1, 1, 2, "three"].
+thingset = [1, 2, "three"].
d/1
===
% this one checks if the value of f(A) is in the list, (note: 1 == True, in python).
goo(A) := true for f(A) in [1,2,&f("a"),3].
+
+thingsbag bag= "three".
+thingsbag bag= 1.
+thingsbag bag= 1.
+thingsbag bag= 2.
+
+thingset set= "three".
+thingset set= 1.
+thingset set= 1.
+thingset set= 2.
\ No newline at end of file
import re
from term import Term, Cons, Nil
+from collections import Counter
try:
from numpy import log, exp, sqrt
return todyna(x)
def todyna(x):
- if isinstance(x, (set, list, tuple)):
+ if isinstance(x, (list, tuple, set, Counter)):
return todynalist(x)
return x
return x
def todynalist(x):
+ if isinstance(x, (set, Counter)):
+ x = list(x)
+ x.sort()
+ return todynalist(x)
return _todynalist(list(x))
def _todynalist(x):
else:
yield a, (None,), a
- def __eq__(self, other):
+ def __cmp__(self, other):
try:
- return self.aslist == other.aslist
+ return cmp(self.aslist, other.aslist)
except AttributeError:
- return False
+ return 1
class _Nil(Term):