Skip to main content
Commonmark migration
Source Link

#Common Lisp

Common Lisp

(defun which-lines-are-removed (&aux (x (list 1 2 3 4 5))) 
  (setq x (remove-if #'(lambda (x) (eql x 1)) x))
  (setq x (remove-if #'(lambda (x) (eql x 2)) x))
  (setq x (remove-if #'(lambda (x) (eql x 3)) x))
  (setq x (remove-if #'(lambda (x) (eql x 4)) x))
  (setq x (remove-if #'(lambda (x) (eql x 5)) x))
)

It works for removal of 1-4 lines. If you remove all lines it will return the same as if you remove none.

NB: Having ending parenthesis on it's own line is considered bad style, but since other languages has end and } I assume it is allowed.

#Common Lisp

(defun which-lines-are-removed (&aux (x (list 1 2 3 4 5))) 
  (setq x (remove-if #'(lambda (x) (eql x 1)) x))
  (setq x (remove-if #'(lambda (x) (eql x 2)) x))
  (setq x (remove-if #'(lambda (x) (eql x 3)) x))
  (setq x (remove-if #'(lambda (x) (eql x 4)) x))
  (setq x (remove-if #'(lambda (x) (eql x 5)) x))
)

It works for removal of 1-4 lines. If you remove all lines it will return the same as if you remove none.

NB: Having ending parenthesis on it's own line is considered bad style, but since other languages has end and } I assume it is allowed.

Common Lisp

(defun which-lines-are-removed (&aux (x (list 1 2 3 4 5))) 
  (setq x (remove-if #'(lambda (x) (eql x 1)) x))
  (setq x (remove-if #'(lambda (x) (eql x 2)) x))
  (setq x (remove-if #'(lambda (x) (eql x 3)) x))
  (setq x (remove-if #'(lambda (x) (eql x 4)) x))
  (setq x (remove-if #'(lambda (x) (eql x 5)) x))
)

It works for removal of 1-4 lines. If you remove all lines it will return the same as if you remove none.

NB: Having ending parenthesis on it's own line is considered bad style, but since other languages has end and } I assume it is allowed.

Source Link
Sylwester
  • 3.8k
  • 15
  • 28

#Common Lisp

(defun which-lines-are-removed (&aux (x (list 1 2 3 4 5))) 
  (setq x (remove-if #'(lambda (x) (eql x 1)) x))
  (setq x (remove-if #'(lambda (x) (eql x 2)) x))
  (setq x (remove-if #'(lambda (x) (eql x 3)) x))
  (setq x (remove-if #'(lambda (x) (eql x 4)) x))
  (setq x (remove-if #'(lambda (x) (eql x 5)) x))
)

It works for removal of 1-4 lines. If you remove all lines it will return the same as if you remove none.

NB: Having ending parenthesis on it's own line is considered bad style, but since other languages has end and } I assume it is allowed.