blob: 0738683111ee8ec0c6278d78153053b64651409d (
plain)
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
|
# -----------------------------------------------------------------------------
# Utils
def id(a):
return a
def eq(x):
return lambda y,z=x: y == z
def neq(x):
return lambda y,z=x: y != z
def append(x,y):
return x + y
def concat(xs):
return reduce(append,xs,[])
def chop(s):
if s[len(s)-1:] == '\n':
return s[:len(s)-1]
else:
return s
def all(p,xs):
for x in xs:
if not p(x):
return False
return True
def elem(xs):
return lambda x: x in xs
def notElem(xs):
return lambda x: x not in xs
def version_to_ints(v):
return [ int(x) for x in v.split('.') ]
def version_lt(x, y):
return version_to_ints(x) < version_to_ints(y)
def version_le(x, y):
return version_to_ints(x) <= version_to_ints(y)
def version_gt(x, y):
return version_to_ints(x) > version_to_ints(y)
def version_ge(x, y):
return version_to_ints(x) >= version_to_ints(y)
|