Implementation and Sub-specifications
Please hover over different parts of the implementation to see the corresponding sub-specifications.
def f(i1):
def aux1(i2):
return g1(i1, i2+1)
return list(map(aux1, range(len(i1))))
f([9, 2, 7, 1]) = [1, 2, 7, 9]
def g1(i1, i2):
def aux2(i3):
def aux3(i4):
return i3>i4
return i2>len(list(filter(aux3, i1)))
return g2(list(filter(aux2, i1)))
g1([9, 2, 7, 1], 1) = 1
g1([9, 2, 7, 1], 2) = 2
g1([9, 2, 7, 1], 3) = 7
g1([9, 2, 7, 1], 4) = 9
def g2(i1):
def aux4(i2):
def aux5(i3):
return i2 < i3
return len(list(filter(aux5, i1)))==0
return list(filter(aux4, i1))[0]
g2([9, 2, 7, 1]) = 9
g2([2, 7, 1]) = 7
g2([2, 1]) = 2
g2([1]) = 1