# Update arg in the dynamic fact base

**URL:** <https://swi-prolog.discourse.group/t/update-arg-in-the-dynamic-fact-base/3794>\
**Category:** Request For Comments\
**Created:** [April 4, 2021, 4:02pm UTC](https://swi-prolog.discourse.group/t/update-arg-in-the-dynamic-fact-base/3794 "2021-04-04T16:02:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 5, 2021, 6:26am UTC](https://swi-prolog.discourse.group/t/update-arg-in-the-dynamic-fact-base/3794/2 "2021-04-05T06:26:05Z")

</div>

The more natural way to model “adjacent” in Prolog would be:

```prolog
:- dynamic adjacent/2.

adjacent(a, b).
adjacent(a, c).
adjacent(a, d).

```

Do you see how things got easier already, both for maintaining the adjacency matrix and for querying?

If you need to efficiently manipulate a list, look at the code that Jan kindly shared [in this post](https://swi-prolog.discourse.group/t/multiple-min-and-max-for-library-aggregate/3635/5).

---

_[View the full topic](https://swi-prolog.discourse.group/t/update-arg-in-the-dynamic-fact-base/3794)._
