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 9250689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:30:20+00:00 2026-06-18T10:30:20+00:00

Regarding to an older question Find if Duplicates Exist SML NJ , if I

  • 0

Regarding to an older question Find if Duplicates Exist SML NJ, if I want the opposite result:

[1,2,2,3,4,5,6] should return false
[1,2,3,4,5,6,7] should return true
[1,2,3,4,5,6,1] should return false

how can I have it with:

fun duplicated [] = false
| duplicated (x::xs) = (List.exists (fn y => x = y) xs) orelse (duplicated xs)

For example,

fun non_duplicated ps =
case ps of
[] => false
| x::xs' => (List.exists (fn y => x<>y) xs') andalso (non_duplicated xs')

doesn’t work.

Why???
Thanks.

  • 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-06-18T10:30:22+00:00Added an answer on June 18, 2026 at 10:30 am

    If you would like to obtain the opposite result, just define the function as follows:

    fun non_duplicated xs = not (duplicated xs)
    

    That said, you can push not inwards the body of duplicated function using De Morgan laws:

    not (a orelse b) <=> (not a) andalso (not b)
    not exists equal <=> forall (not equal)
    not false <=> true
    

    Then you arrive at the opposite version:

    fun non_duplicated [] = true
      | non_duplicated (x::xs) = 
          (List.forall (fn y => x <> y) xs) andalso (non_duplicated xs)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having searched regarding this issue beforehand, I can find many discussions regarding dynamically adding
Regarding the decorator [AllowHtml] on a property or even the [ValidateInput(false)] on a method,
Regarding the classic test pattern of Arrange-Act-Assert , I frequently find myself adding a
In an answer to an earlier question of mine regarding fixing the colorspace for
I had recently asked a question regarding the following code: Sending Email in Android
I'm sorry if this is a repeat, but I can't find anything that really
I didn't find much in tutorials on this specific question.. So I have a
I faced a question in an interview two days back regarding optimally finding the
I've got this question regarding Android activities and AndroidManifest.xml. The question arised when I
I have a question regarding DDD and the repository pattern. Say I have a

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.