#### 24 Aug 2010 tampe»(Journeyer)

So a couple of weeks of working and this was the result,

```
prun() :- L = [1,[3,[7,[15],8,[16]],
4,[9,[17],10,[18]]],
2,[5,[11,[19],12,[20]]],
6,[13,[21],14,[22]]],
postpone_frame(30,0.8),
f(L).

f([H|L]) :- !,
sub-tree-max([H|L],X),
postpone(X),
g(H,L).

f(H)         :- postpone(H),pk(H), fail.

g(H,L)       :- f(H).
g(_,[H|L])   :- g(H,L).
g(_,[])      :- fail.
```

where sub-tree-max represents the maximum value in a specific subtree. We get the result:

```
(18) (19) (20) (21)
(22) (15) (16) (17)
(14) (11) (12) (13)
(8)  (9)  (10) (7)
(6)  (4)  (5)  (3)
(2)  (1)
```

Note, the intention is to make an addition to a prolog engine to accomplish the above.

postpone_frame(Level,Fraction) will start executing all postpones above Level*Fraction. Then it will execute all postpones above Level*Fraction*Fraction and so on. You may want to change the algorithm at your taste but the main idea is not to use a full sort but tasty chunks of code which basically flows from most interesting to least interesting. I will add a lower level as well for which a direct Cut is taken.

Actually the current working implementation is very costly, e.g. every postpone is visited and if criteria is not met (the state is still recalculated!!!) it will again postpone (stupid, yea I know, but I wanted a working simple starting point)

Have fun