Saturday, January 17, 2009

Adding Pluggable Search Strategies to Your Favourite Functional Programming Language


search3 :: !Bool !(u:a -> .(v:([u:a] -> w:[.b]) -> x:[.b])) u:a -> y:[.b], [v <= u,x v <= w,x v <= y]
search3 kind explorer root
| kind = do_all_depth [root] []
= do_all_breadth [root] []
where
do_all_depth [] t = t
do_all_depth [v:vs] t = explorer v \ vs` = do_all_depth vs` (do_all_depth vs t)

do_all_breadth [] t = t
do_all_breadth [v:vs] t = explorer v \ vs` = do_all_breadth vs (do_all_breadth vs` t)

No comments: