Next: , Previous: Cat, Up: List Functions


2.7.14.2 Reverse

The function that reverses a list has the following representation in virtual code.

T29
[[reverse]] = ((nil,nil),(nil,(nil,nil)))

This function takes a list as an argument, and returns a the list consisting of the same items in the reverse order. The semantics is given by the following properties.

P37
[[reverse]] nil = nil
P38
[[reverse]] (x,y) = [[cat]] ([[reverse]] y,(x,nil))