Jump to content

I'M REALLY PUZZLED FOR COMPARING


hosyn

Recommended Posts

Assuming

 

(setq block-list '(("A-old" . 1) ("B-old" . 1) ("C-old" . 1) ("D-old" . 1) ("E-old" . 1) ("F-old" . 1) ("G-old" . 1) ("H-old" . 1)))
(setq compare-list '((rgt "A-old" "A-new") (rgt "C-old" "C-new") (rgt "K-old" "K-new") (rgt "E-old" "E-new") (rgt "D-old" "D-new")  (rgt "H-old" "H-new")))

 

Then the inelegant

 

(mapcar '(lambda (x) (cons (cadr (assoc (car x) (mapcar 'cdr compare-list))) (cdr x))) (vl-remove-if-not '(lambda (x) (vl-position (car x) (mapcar 'cadr compare-list))) block-list))

 

produces the desired result

  • Thanks 1
Link to comment
Share on other sites

20 minutes ago, Jonathan Handojo said:

I'm not quite sure what you mean though. The function I wrote above should return the desired result

Dear Jonathan Handojo 

Your code in example checked and its pretty good , but one issue in my data at the compare list there are space like that 

 (rgt "PP" "PT SOCKET IP 54")

These space can be conflict and mismatch running ?

Link to comment
Share on other sites

Hi and in continue (vl-...) function how should modified

      
(setq compare-list '((rgt "A-old" "A-new") (rgt "C-old" "C-new") (rgt "K-old" "K-new") (rgt "E-old" "E-new") (rgt "D-old" "D-new")  (rgt "H-old" "H-new")))
if blk-name be "c-old"  give us "c-new"
if blk-name be "k-old"  give us "k-new"
and ......
if blk-name theres not in compare-list give us nil

So many thanks Thanks for any cooperating  🙏

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...