Created
December 17, 2011 17:20
-
-
Save Baha/1490798 to your computer and use it in GitHub Desktop.
A well functioning definiton for the add function in a partial evaluator.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> add :: [(String,[Expr])] -> [(String,[Expr])] -> [(String,[Expr])] -> [(String,[Expr])] | |
> | |
> add succ pending marked = difference (union pending succ) marked | |
> | |
> union pending [] = pending | |
> union pending (call:res) | |
> | elem call pending = union pending res | |
> | otherwise = union (call:pending) res | |
> | |
> difference pend marked = [x | x <- pend, not (elem x marked)] | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment