samedi 9 novembre 2019

How to return element by element in a shuffled list and not having them returned all at once?

For example, if I have a code that goes like this:

randlist(X):- random_permutation([1,2,3,4,5,6,7,8],X).

And then consult it like this:

randlist(X).

It will return an answer (for example) like this, where the list is shuffled:

X = [7, 6, 8, 2, 4, 3, 5, 1].

Is there a way to return every element separately using ";" to manually display them?

Like this:

X = 7;
X = 6;
X = 8;
X = 2;
X = 4;
X = 3;
X = 5;
X = 1



Aucun commentaire:

Enregistrer un commentaire