definition:
|
grep :: (Data a, Ord a) => RegExp a -> [a] -> [Int]
grep re s = grep' re s 0
where
-- grep' :: (Data a, Ord a) => RegExp a -> [a] -> Int -> [Int]
grep' _ [] _ = []
grep' r (x : xs) n = if match (r ++ [Star ([AnyLiteral])]) (x : xs)
then (n : grep' r xs (n+1))
else grep' r xs (n+1)
|
demand:
|
argument 4
|
deterministic:
|
possibly non-deterministic operation
|
documentation:
|
--- The operation `grep` returns a list with starting positions of substrings
--- that match the regular expression.
--- @param r - The regular expression
--- @param s - The input list
--- @result l - The list of startingpositions of matching substrings
|
failfree:
|
<FAILING>
|
indeterministic:
|
might be indeterministic
|
infix:
|
no fixity defined
|
iotype:
|
{(_,_,_,_) |-> {:,[]}}
|
name:
|
grep
|
precedence:
|
no precedence defined
|
result-values:
|
{:,[]}
|
signature:
|
(Prelude.Data a, Prelude.Ord a) => [ORegExp a] -> [a] -> [Prelude.Int]
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|