name = 'divide/3' slug = 'split a list into parts of roughly equal length' description = '''\
divide(L, L1, L2)
: the list L1
contains elements at odd positions in L
, and the list L2
contains the elements at even positions in L
.
?- divide([a,b,c,d,e,f,g], X, Y). X = [a,c,e,g], Y = [b,d,f]. ?- divide([a,b,c,d,e,f], X, Y). X = [a,c,e], Y = [b,d,f].''' hint = {}