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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:02:17+00:00 2026-06-14T05:02:17+00:00

I have this iterative process in Scheme. (In fact I don’t really know what

  • 0

I have this iterative process in Scheme. (In fact I don’t really know what kind of process it really is)

(define (contains-double? lst)
 (cond
  ((or (null? lst) (null? (cdr lst))) #f)
  ((eq? (car lst) (cadr lst)) #t)
  (else (contains-double? (cdr lst)))))

It checks If there are 2 of the same numbers next to each other.
For example:

(contains-double? '(1 2 3 3 3 5 2))    => #t
(contains-double? '(1 2 3 5 3 2))      => #f
(contains-double? '(1 2 3 2 2))        => #t

Can I make this process recursive?

Thanks in advance

  • 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-14T05:02:20+00:00Added an answer on June 14, 2026 at 5:02 am

    The procedure in the question is recursive (contains-double? is calling itself), but the process it generates is iterative because the procedure is written in a tail-recursive style – meaning that there is nothing to do after the procedure returns from the recursive call, except return its value.

    The process generated by this procedure can be made recursive by removing the tail recursion:

    (define (contains-double? lst)
      (if (or (empty? lst) (empty? (rest lst)))
          #f
          (or (contains-double? (rest lst))
              (= (first lst) (second lst)))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this array for doctrine to process many to many form and save
I have following recursive algorithm needed to redactor into iterative process. CvSeq is a
How can I process PagedListHolder in JSP? In my controller I have this: PagedListHolder<Logo>
noob here. I have a (kind of) binary image that contains a known number
I have been having this issue in iterating through an array of keys and
I have a std::vector<std::string> m_vPaths; I iterate over this vector and call ::DeleteFile(strPath) as
I have a list iteration in python defined like this: for i in range(5):
I have loop and each iteration of Hash looks like this: [1, {:clid=>1, :nvz=>4,
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in

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.