# Generating ASTs with SSU, not working as expected

**URL:** <https://swi-prolog.discourse.group/t/generating-asts-with-ssu-not-working-as-expected/4922>\
**Category:** Help!\
**Tags:** ssu\
**Created:** [January 20, 2022, 12:01pm UTC](https://swi-prolog.discourse.group/t/generating-asts-with-ssu-not-working-as-expected/4922 "2022-01-20T12:01:07Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 20, 2022, 9:08pm UTC](https://swi-prolog.discourse.group/t/generating-asts-with-ssu-not-working-as-expected/4922/4 "2022-01-20T21:08:36Z")

</div>

@peter.ludemann Thanks.

I tried this

```prolog
s_ssu(0, Ast) => Ast = [].
s_ssu(I, Ast), I >= 1 => true_or_false(Ast).
true_or_false(true).
true_or_false(false).
s_ssu(I0,Ast), I0 > 1 =>
    succ(I,I0),
    s_ssu(I,T1),
    s_ssu(I,T2),
    s_ssu(I,T3),
    Ast = if(T1,T2,T3).

```

It gave me a different answer but did not duplicate what the normal example did with 10 results.

```prolog
̯?- s_ssu(2,Ast).
Ast = true ;
Ast = false

```

Jan W. gave me the information I needed which is that in this [post](https://swi-prolog.discourse.group/t/dcgs-with-single-sided-unification/3768/22) where the idea of generators is conveyed, I was thinking of generators as noted in “The Craft of Prolog” but he noted that the word _serialize_ is more appropriate.

The nice thing is that I will now try to use SSU where appropriate now that I tried them the first time.

---

_[View the full topic](https://swi-prolog.discourse.group/t/generating-asts-with-ssu-not-working-as-expected/4922)._
