I like to use maplist/2 with =/2 for this. For example,
maplist/2
=/2
| ?- length(L, 3), maplist(=(a), L). L = [a,a,a] yes | ?- length(L, 9), maplist(=(abc), L). L = [abc,abc,abc,abc,abc,abc,abc,abc,abc] yes | ?-