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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:45:56+00:00 2026-06-14T12:45:56+00:00

Hi I got the error mcar: contract violationexpected: mpair? given: () while running these

  • 0

Hi I got the error mcar: contract violationexpected: mpair? given: () while running these code:

(define helpy 
  (lambda (y listz)
    (map (lambda (z) (list y z))
         listz)))

(define print
  (lambda (listy)
    (cond
      ((null? list) (newline))
      (#t (helpy (car listy) (cdr listy))
          (print (cdr listy))))))

My code is trying to return pairs in a list. For example, when I call
(print '(a b c)) it should return ((a b) (a c) (b c)).

I just fix and update my code, now it don’t return error but I can only get pair ( (a b) (a c), when running these code:

(define helpy

(lambda (y listz)

(map (lambda (z) (list y z))

listz)))

(define print

(lambda (listy)

(cond

((null? listy) (newline))

(#t (helpy (car listy) (cdr listy)))

(print (cdr listy)))))

I think that I got something wrong with the recursion

  • 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-14T12:45:57+00:00Added an answer on June 14, 2026 at 12:45 pm

    There are a couple of problems with the code. First, by convention the “else” clause of a cond should start with an else, not a #t. Second, the null? test in print should receive listy, not list. And third, you’re not doing anything with the result returned by helpy in print, you’re just advancing print over the cdr of the current list without doing anything with the value returned by the recursive call. Try this instead:

    (define print
      (lambda (listy)
        (cond
          ((null? listy) (newline))
          (else
           (displayln (helpy (car listy) (cdr listy)))
           (print (cdr listy))))))
    

    displayln is just an example, do something else with the returned result if necessary.

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

Sidebar

Related Questions

while compiling the following code i have got error @Override public void routeCustomerRequest (int
I got error when I write this code @Html.X().ResourceManager() in view error message :
I got error Access Violation when the following code is execute : void NoAction()
I'm trying to shake a window, but got error mess in console. My code:
Hi i got error in Registration using asmack library . code of Registration Log.d(TAG,
i've found this line of code got error if the input not an number
i always got error: Code Sign error: A valid provisioning profile matching the application's
when I run the below code I got error in line echo $attribute; The
when I run the below code, I got error Fatal error: Call to undefined
HI while trying to use soapUI, I got error; SOAP RESPONSE FAILED: this is

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.