cryptol/tests/issues/issue78.cry
2017-10-02 15:48:51 -07:00

7 lines
285 B
Plaintext

unique : {a,b} (fin a, fin b, a>=1) => [a][b] -> Bit
unique xs = [ exist x (i+1) | x <- xs | i <- [0..(a-1)] ] == 0
where exist : [b] -> [width a] -> Bit
exist x i = if(i>=`a) then False
else if(x==(xs@i)) then True
else exist x (i+1)