IF Computer > MINERVA > Example Programs > MINERVA Features > Directives > dynamic

dynamic

MINERVA
ifcomputer logo
f
Expert Services on the Web

% use the directive 'dynamic' to declare a predicate that can be % modified during later program execution

:- dynamic(aa/1).

main(_) :- list_aa, nl, remove_first, list_aa, nl, add_top, list_aa, nl, add_bottom, list_aa.

list_aa :- aa(X), writeq(aa(X)),nl, flush_output, fail ; true.

remove_first :- retract(aa(_)).

add_top :- asserta(aa(300)).

add_bottom :- assertz(aa(xyz)).

aa(1). aa(2). aa(3).

document: http://www.ifcomputer.co.jp/MINERVA/ExamplePrograms/MinervaFeatures/Directives/dynamic/print_en.html
published 2008/7/7 update 2001/3/22 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS