# A pure sort/2

**URL:** <https://swi-prolog.discourse.group/t/a-pure-sort-2/2438>\
**Category:** Help!\
**Tags:** discussion\
**Created:** [May 30, 2020, 8:53pm UTC](https://swi-prolog.discourse.group/t/a-pure-sort-2/2438 "2020-05-30T20:53:57Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [May 31, 2020, 8:21am UTC](https://swi-prolog.discourse.group/t/a-pure-sort-2/2438/12 "2020-05-31T08:21:42Z")

</div>

> [@grossdan](#):
>
> - pure prolog
> - high performance prolog

In the story I tell typically, there is a _logical_ subset and a _procedural_ one. The first you may call _pure_, but it seems I’m not the only one disliking this term. Prolog is based on the, from a logical viewpoint, rather native SLD resolution. SLD gives proper logical resolution for a rather small subset. Constraints and SLG extend this subset. SLD is also a bit limited procedural language. Cuts, ==/2, sort/2, and many many more extend this.

If you want pure declarative (logic) programming, go Datalog or ASP. Datalog handles a subset that is also covered by SLG as we find it in XSB and SWI-Prolog (several other Prolog systems do SLG, but without sound negation). ASP handles a much richer set of logic. Neither is Turing complete though, so if you want to make it do something you typically need to embed it in Lua/Python/Java/… Calling a non-Turing complete language _Programming_ has always sounded a bit weird to me …

In my view, Prolog is an elegant sweet spot combining logical and procedural aspects. It doesn’t suffer from the mismatch you get combining databases, ASP or Datalog to (object oriented) procedural languages. The fact that the boundary is smooth but also fluid has both an advantage and disadvantage though. It makes the code more uniform, it allows for procedural tweaks while retaining logical correctness (and thus use your own knowledge to work around limitations any fully declarative language has) but it is also easy to cross the logic boundary while this was not intended, getting an incorrect result.

For short, Prolog is a versatile and pragmatic multi-paradigm language. This, in my view, has little to do with _purity_.

---

_[View the full topic](https://swi-prolog.discourse.group/t/a-pure-sort-2/2438)._
