(defun remove-nil (&rest args)
 (def mat (apply #'bind-columns args))
 (def mat (row-list mat))
 (def mat (no-nil-list mat))
 (def mat (apply #'bind-rows mat))
 (def mat (mapcar #'(lambda (x) (coerce x 'list)) (column-list mat))))
;; this function remove the nil and thus some lists become shorter,
;; then select the observations which is not shorter
(defun no-nil-list (lis)
 (setq length-list (length (select lis 0)))
 (setq new-list nil)
 (loop
 (cond ((null lis) (return new-list)))
 (setq new-list (cons (remove 'nil (coerce (car lis) 'list)) new-list))
 (setq lis (cdr lis)))
 (setq new-length (mapcar 'length new-list))
 (setq no-nil-list (select new-list (which (= new-length length-list)))))
Return to front page