[ library(lists) | Reference Manual | Alphabetic Index ]

middle_out(+List, -Reordered)

Reorder a list such that the middle elements come first
List
A list
Reordered
A variable or list

Modes and Determinism

Examples

?- middle_out([1,2,3,4,5], Zs).
Zs = [3, 2, 4, 1, 5]
Yes (0.00s cpu)

?- middle_out([1,2,3,4,5,6], Zs).
Zs = [3, 4, 2, 5, 1, 6]
Yes (0.00s cpu)
	

See Also

reverse / 2