No title

1
2
3
4
5
6
7
8
9
breadth1st : (t -> t -> Bool) -> List (t -> t) -> List t -> List t -> List t
breadth1st _ _ [] best_ts = best_ts
breadth1st is_better_t actions (t_list_top :: t_list_tail) best_ts =
 let
 expanded_t_list : List t = map (\ x : (t -> t) => x t_list_top) actions ++ t_list_tail
 (is_better_bool, is_better_best_ts) : (Bool, List t) = foldr (\ x : t, acc : (Bool, List t) => if is_better_t t_list_top x then (True, snd acc) else (fst acc, x :: snd acc)) (False, []) best_ts
 in if is_better_bool then breadth1st is_better_t actions expanded_t_list is_better_best_ts
 else if any (\ x => is_better_t x t_list_top) best_ts then breadth1st is_better_t actions t_list_tail best_ts
 else breadth1st is_better_t actions expanded_t_list (t_list_top :: best_ts)