Search code examples
clojureclojure-contrib

Flipping elements in Clojure


If I input a vector and wanted to flip the elements' order, I'd write

   (reverse [1 2 3])

Now, how would I generalize this idea to be able to input nested vectors and flip the order of elements? Given a matrix A the function should reverse the elements in each column.


Solution

  • Based on the example you gave in the comments, this is exactly what reverse does given a collection that contains collections. You want reverse.