Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6898209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:16:00+00:00 2026-05-27T07:16:00+00:00

I am looking for a function that compares or checks if 2 lists are

  • 0

I am looking for a function that compares or checks if 2 lists are equal.

It should ignore number order and duplicated numbers…

I already created a function that checks if a element is part of a list on another block, but I am having some problems with this one now.

Here’s what I have

(define (ispart? x b)
      (cond ((null? b) #f)
            ((= x (car b)) #t)
             (else (ispart? x (cdr b)))))

    (define (check=? c1 c2)


(define (verification-1 c1 c2) 
        (cond((null? c1) 
            #t)
        ((ispart? (car c1) c2) (check=? (cdr c1) c2))))
   (define (verification-2 c1 c2) 
    (cond((null? c2) 
        #t)
  ((ispart? (car c2) c1) (check=? c1 (cdr c2)))))
    (if (equal? (and verification-1 verification-2) #t)
        #t
  (#f)))

I’m having problems with the conditions mainly, I am creating a check for each element of the first list to see if it belongs to the second list and then a check for each element of the second list. If any element fails that check then the lists are different.

I also tried this one but it doesn’t ignore duplicated numbers or number order, so (3 2 1) is different from (1 2 2 3) and I don’t want that to happen

    (define (lists=? lst1 lst2)
  (cond ((null? lst1) (null? lst2))
        ((null? lst2) #f)
        ((= (car lst1) (car lst2))
         (lists=? (cdr lst1) (cdr lst2)))
        (else #f)))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:16:01+00:00Added an answer on May 27, 2026 at 7:16 am

    Given a function all, which says if all elements of a list are true,

    (define (all l)
       (cond ((null? l) #t)
             ((equal? #f (car l)) #f)
             (else (all (cdr l)))))
    

    and given your ispart? function,

    You can simply see if every element in the first list passes the ispart? test in the second list, and vice-versa:

    (define (set_equal l0 l1)
       (and (all (map (lambda (x) (ispart? x l1))
                      l0))
            (all (map (lambda (x) (ispart? x l0))
                      l1))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im looking for a xpath function that compares two sequences and checks if the
I am looking to write a function in Jquery that compares two strings and
I'me looking for a function that would receive a time and would round it
I'm looking for a function that calculates years from a date in format: 0000-00-00.
I am looking for a function that would be the alphabetic equivalent of is_numeric.
I am looking for a function that will tell me, for a list of
I am Looking for a Function that insert Any form values to mysql ,
Original Question I am looking for a function that attempts to quantify how distant
Similar in concept to Math.Abs() - I'm looking for a function that when given
I am not that familiar with Javascript, and am looking for the function that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.