This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns spiral) | |
| (def matrix1 [[1 2 3][8 9 4][7 6 5]]) | |
| (def matrix2 [[1 2 3 4][12 13 14 5][11 16 15 6][10 9 8 7]]) | |
| (defn spiral-print [matrix result] | |
| (let [[row & rows] (seq matrix)] | |
| (if (seq rows) | |
| (recur | |
| (reverse (apply map vector rows)) | |
| (concat result row)) | |
| result))) |