S
Suresh Jeevanandam
Guest
In skill, I have a two dimensional array, and I want to swap the rows
and columns. Below is something I could come up. But I think there
should some other simpler and better way. Your suggestion is welcome.
procedure(lrange(num)
;return a list of numbers from 1 to num
let((rlist)
rlist = nil
while(num > 0
rlist = cons(num rlist)
num = num-1
)
rlist
))
procedure(swapRowCol(aList)
;Swap the columns and rows in a two dimensional array
mapcar(
lambda( (num)
mapcar(
lambda( (row)
nthelem(num row)
)
aList
)
)
lrange(length(aList))
)
)
regards,
Suresh
and columns. Below is something I could come up. But I think there
should some other simpler and better way. Your suggestion is welcome.
procedure(lrange(num)
;return a list of numbers from 1 to num
let((rlist)
rlist = nil
while(num > 0
rlist = cons(num rlist)
num = num-1
)
rlist
))
procedure(swapRowCol(aList)
;Swap the columns and rows in a two dimensional array
mapcar(
lambda( (num)
mapcar(
lambda( (row)
nthelem(num row)
)
aList
)
)
lrange(length(aList))
)
)
regards,
Suresh