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

  • Home
  • SEARCH
  • 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 8105971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:19:05+00:00 2026-06-06T00:19:05+00:00

Look at the function below. I want to pass a vector of factors and

  • 0

Look at the function below. I want to pass a vector of factors and test if any of the elements in the vector is a factor of x. How do I do that?

(defn multiple?
  "Takes a seq of factors, and returns true if x is multiple of any factor."
  ([x & factors] (for [e m] ))
  ([x factor] (= 0 (rem x factor))))
  • 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-06T00:19:06+00:00Added an answer on June 6, 2026 at 12:19 am

    You could try using some and map:

    (defn multiple? [x & factors]
      (some zero? (map #(rem x %) factors)))
    

    Also some returns nil if all tests fail, if you need it to actually return false, you could put a true? in there:

    (defn multiple? [x & factors]
      (true? (some zero? (map #(rem x %) factors))))
    

    Note that some short-circuits and map is lazy, so multiple? stops as soon as a match is found. e.g. the following code tests against the sequence 1,2,3,4,....

    => (apply multiple? 10 (map inc (range)))
    true
    

    Obviously this computation can only terminate if multiple? doesn’t test against every number in the sequence.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a function here that is meant to look through a list of
I am using the below code to look up for any new process started.
Look at the lower part of my function: I want to repeat info(url_part1 +
Please take a look at the code snippet below. I want the 2nd MongoDB
I am using spl_autoload_register() function to include all files . What i want that
Look at the code below: $(.head img).hover(function(){ var id = $(this).attr('id'); $(this).attr(src,images/+id+_hover.gif); },function(){ var
I have successfully worked with jQuery DataTables and they look and function great. But
First, I am not looking for ignore_user_abort. Instead, I look for a function to
Look at this: $('form).submit(function (event) { $(':input.required').trigger('blur'); var num = $('.warning', this).length; alert(num);//Focus here!
Please look at this code: @interface myObject:NSObject -(void)function:(id)param; @end @implementation myObject -(void)function:(id)param { NSLog(@BEFORE);

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.