Strain in Common Lisp

Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.

Strain

Implement the keep and discard operation on collections. Given a collection
and a predicate on the collection's elements, keep returns a new collection
containing those elements where the predicate is true, while discard returns
a new collection containing those elements where the predicate is false.

For example, given the collection of numbers:

1, 2, 3, 4, 5

And the predicate:

is the number even?

Then your keep operation should produce:

2, 4

While your discard operation should produce:

1, 3, 5

Note that the union of keep and discard is all the elements.

The functions may be called keep and discard, or they may need different
names in order to not clash with existing functions or concepts in your
language.

Restrictions

Keep your hands off that filter/reject/whatchamacallit functionality
provided by your standard library! Solve this one yourself using other
basic tools instead.

Setup

Check out Exercism Help for instructions to
get started writing Common Lisp. That page will explain how to install and setup
a Lisp implementation and how to run the tests.

Formatting

While Common Lisp doesn't care about indentation and layout of code,
nor whether you use spaces or tabs, this is an important consideration
for submissions to exercism.io. Excercism.io's code widget cannot
handle mixing of tab and space characters well so using only spaces is recommended to make
the code more readable to the human reviewers. Please review your
editors settings on how to accomplish this. Below are instructions for
popular editors for Common Lisp.

VIM

Use the following commands to ensure VIM uses only spaces for
indentation:

(or as a oneliner :set tabstop=2 shiftwidth=2 expandtab). This can
be added to your ~/.vimrc file to use it all the time.

Emacs

Emacs is very well suited for editing Common Lisp and has many
powerful add-on packages available. The only thing that one needs to
do with a stock emacs to make it work well with exercism.io is to
evaluate the following code:

(setq indent-tab-mode nil)

This can be placed in your ~/.emacs (or ~/.emacs.d/init.el) in
order to have it set whenever Emacs is launched.

One suggested add-on for Emacs and Common Lisp is
SLIME which offers tight integration
with the REPL; making iterative coding and testing very easy.