|
definition: |
addApplyRules :: [Rule] -> [Rule]
addApplyRules rules = rules ++ concatMap genAllApply funcArities
where
funcArities = nub (map (\ (Rule f args _) -> (f,length args)) rules)
genAllApply (f,n) = map genApplyRule [1..n]
where
genApplyRule i =
let pargs = map Var [1..(i-1)]
in Rule "apply" [Func Cons f pargs, Var i]
(Func (if i==n then Def else Cons) f (pargs++[Var i]))
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
add primitive apply rules to a TRS |
|
failfree: |
_ |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_) |-> _}
|
|
name: |
addApplyRules |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
[Rule] -> [Rule] |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |