Re: Coding challenge! non-destructuve matrix transpose



On Sep 18, 7:34 am, namekuseijin <namekusei...@xxxxxxxxx> wrote:
On 18 set, 01:54, "John Thingstad" <jpth...@xxxxxxxxx> wrote:

På Thu, 18 Sep 2008 05:57:00 +0200, skrev jrwats <jrw...@xxxxxxxxx>:
Hi all - this is not for a school project or anything (I'm a full-
timer at the software company ppl love to hate), but I was trying to
do an exercise in the back of ch 6 of Wilensky's book, Comon
LISPcraft.  Anyway the challenge is to code up the solution to the
transposition of a matrix (with the underlying implementation being a
list - not a 2d - that is of course too easy).  My solution was a
DESTRUCTIVE one which actually accumulates and  REMOVES 1st column of...

(defun matrix-transpose (matrix)
   "Turn a matrix on its side."
   (if matrix (apply #'mapcar #'list matrix)))

Party pooper.  Well, at least he may have some fun reimplementing
mapcar or list...

Isn't that what they did with Ruby and other SLDJs?

Cheers
--
Marco

.



Relevant Pages