Changing output of Prolog from a list to individual values -


i want alter following code genn(3,r) outputs: r=0. r=1. r=2.

instead of list r=[0,1,2]. how go completing this?

genn(0,[]). genn(n,r) :-     n > 0,     n1 n-1,     genn(n1,r1),     append(r1,[n1],r),     !. 

use genn/2 , member/2 in conjunction, this:

?- genn(3,rs), member(r,rs). rs = [0,1,2], r = 0 ; rs = [0,1,2], r = 1 ; rs = [0,1,2], r = 2. 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -