help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove sublist


From: Robert L.
Subject: Re: remove sublist
Date: Thu, 12 Apr 2018 09:36:12 +0000 (UTC)
User-agent: XanaNews/1.18.1.6

On 4/7/2018, Robert L. wrote:

> On 4/2/2018, Emanuel Berg wrote:
> 
> > 
> >     (cl-remove-if
> >      (lambda (s) (or (string= "a" s)
> >                      (string= "b" s) ))
> >      '("0" "a" "b" "c" "d") )
> 
> (defun remove-these (targets xs)
>   (let (result)
>     (dolist (x xs (reverse result))
>       (unless (member x targets)
>         (push x result)))))
> 
> (remove-these '(a e) '(a b e f o a g))
>  ===>
> (b f o g)


(defun remove-these (targets xs)
  (if targets
    (remove-these (cdr targets) (remove (car targets) xs))
    xs))

(remove-these '(a e) '(a b e f o a g))
 ===>
(b f o g)

-- 
When the Israeli bombers and torpedo-planes were sent to attack and destroy the
ship, the Jewish commander, seeing that it was an American vessel, had
misgivings and reported to the High Command, which simply repeated the orders
to attack and sink the Liberty.
I have a graphic from ... the oldest daily newspaper of Israel, ... Haaretz....
The headline reads, "But, sir, it's an American ship."  "Never mind. Hit her."
http://archive.org/details/nolies


reply via email to

[Prev in Thread] Current Thread [Next in Thread]