Prolog: between/3 with a list at the end

Viewed 7273

my question comes up because of this question Can you write between/3 in pure prolog?

would it be possible to make between/3 and the third argument is a list so if you ask

between(2,6,X).

it comes

X=[2,3,4,5,6]

and not like

X=2
X=3
X=4
....

I can’t figure out how this must work (all my solutions don’t work..) I’m a Prolog beginner so I have no idea..

sorry for the bad English..

Thanks for your help :)

1 Answers
Related