title: Matrix Transpose Common Lisp
body: <p>Well, i've been told to make a Matrix Transpose function in common lisp. I'm a beginner, so i don't know so much of it.</p>
  
  <p>My Matrix is a list of lists, and i can't use apply, mapcar or similar to solve it, just CONS, CAR and CDR. If not, my solution would be this (I put this solution so someone can use it):</p>
  
  <pre><code>(DEFUN transpose (List)
      (apply #'mapcar #'list List)
  )
  </code></pre>
  
  <p>But I can't use anything of the above.</p>
  
  <p>The function has to be recursive, no loops or similar.</p>
  
  <p>So, the question is, how could this be done?</p>
  
  <p>This is how far i've gone, but it gets me an overflow error. I don't really know how to do it (i could have done it in C++ or Java, but i'm asked to do it in Lisp...)</p>
  
  <pre><code>    (DEFUN transpose (Matrix)
          (COND   ((NULL Matrix) NIL
                  ) 
                  (T (CONS (CAR(CAR Matrix))(transpose (CONS (CAR(CDR Matrix)) (CDR Matrix))))
                  )
          )
      )
  </code></pre>
  
  <p>Any help would be thanked!</p>