|
definition: |
unboundVars :: Expr -> [VarIndex]
unboundVars (Var idx) = [idx]
unboundVars (Lit _) = []
unboundVars (Comb _ _ es) = unionMap unboundVars es
unboundVars (Or e1 e2) = union (unboundVars e1) (unboundVars e2)
unboundVars (Typed e _) = unboundVars e
unboundVars (Free vs e) = filter (not . flip elem vs) (unboundVars e)
unboundVars (Let bs e) =
let unbounds = unionMap unboundVars $ e : map snd bs
bounds = map fst bs
in filter (not . flip elem bounds) unbounds
unboundVars (Case _ e bs) =
union (unboundVars e) (unionMap unboundVarsInBranch bs)
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
Find all variables which are not bound in an expression. |
|
failfree: |
_ |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{({Var}) |-> {:} || ({Lit}) |-> {[]} || ({Comb}) |-> _ || ({Or}) |-> _ || ({Typed}) |-> _ || ({Free}) |-> {:,[]} || ({Let}) |-> {:,[]} || ({Case}) |-> _}
|
|
name: |
unboundVars |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
FlatCurry.Types.Expr -> [Prelude.Int] |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
reducible on all ground data terms |