Message 1 of 22
[LISP] Simplify the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Who can help me simplify the code below, the one that is between the START and END tags.
(setq L
(list
(list 0 1 2)
(list 0 1 2)
(list 0 1 2)
(list 0 1 2)
)
)
(setq e 2)
(setq L1 nil)
(foreach
x
L
; START
(setq t nil)
(setq i 0)
(while (< i (length x))
(if (not (equal i e))
(setq t (reverse (cons (nth i x) (reverse t))))
)
(setq i (1+ i))
)
(setq L1 (reverse (cons t (reverse L1))))
; END
)
(princ L1)
(princ)