Reversing a List

To reverse a non empty list we reverse its tail and then append a singleton list consisting of just its head to the right.
reverse: list(alpha) -> list(alpha);
reverse [] <= [];
reverse (x::m) <= append(reverse(m),[x]);



s.danicic@gold.ac.uk
Sebastian Danicic BSc MSc PhD (Reader in Computer Science)
Dept of Computing, Goldsmiths, University of London, London SE14 6NW
Last updated 2010-12-29