I am trying to implement the following specification:
busca.v.xs = <Min i : 0 ≤ i < #xs ∧ xs.i = v : i>
I wrote something like the following.
busca :: Int -> [Int] -> Int
busca v [] = 1000000
busca v (x:xs) | x==v = min x (busca v xs)
| otherwise = busca v xs
When I was deriving, the case [] is infinity, so I tried making something that is somewhat similar. The expected result should be the minimun number in a list. For example, busca 2 [4,3,2,2,7] should return 2. Can i use Maybe and simulate that infinity in a way?
vin the listxs, not for getting the minimum number in the list.