24 Aug 2010 tampe   » (Journeyer)

What's growing on your head old moose

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

prun() :- L = [1,[3,[7,[15],8,[16]],

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

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!