# When does assert fail? Running out of space?

**URL:** <https://swi-prolog.discourse.group/t/when-does-assert-fail-running-out-of-space/1681>\
**Category:** Help!\
**Created:** [December 31, 2019, 4:48pm UTC](https://swi-prolog.discourse.group/t/when-does-assert-fail-running-out-of-space/1681 "2019-12-31T16:48:23Z")\
**Posts on this page:** 1\
**Showing post:** 43

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [January 2, 2020, 2:23pm UTC](https://swi-prolog.discourse.group/t/when-does-assert-fail-running-out-of-space/1681/43 "2020-01-02T14:23:11Z")

</div>

> [@grossdan](#):
>
> take the simplest case possible and describe it in both ways – then add a pinch of non determinism to it 🙂

My problem is how to I translate an algebraic data type into Prolog. I visited this idea in these post ([A](https://swi-prolog.discourse.group/t/using-has-type-list-type-x-with-user-created-type-not-working-as-expected/1340), [B](https://swi-prolog.discourse.group/t/types-with-swi-prolog/1341)), but never made it past the point of getting it off the back burner.

Right now the cleanest way I see to put this into working Prolog code is to add state to the predicates with the state containing a compound term for the result, one part for the valid (happy) path and one part for the exception/error (unhappy) path.

---

_[View the full topic](https://swi-prolog.discourse.group/t/when-does-assert-fail-running-out-of-space/1681)._
