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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:51:16+00:00 2026-06-12T14:51:16+00:00

(define min (lambda (l m c) (cond ((null? l) (print m)) (else ((c (car

  • 0
(define min
  (lambda (l m c)
    (cond ((null? l) (print m))
          (else ((c (car l))
                 if((< c m) (m c))
                 min((cdr l) m c))))))

I want to use the tail-recursive method to do it,but it doesn’t work. I’m very very new in Scheme, hope you can help me. Thank you!

  • 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-12T14:51:17+00:00Added an answer on June 12, 2026 at 2:51 pm

    This looks like homework, I’ll give you some pointers so you can solve it by yourself. Fill-in the blanks:

    (define (mymin lst minval)
      (cond ((null? lst)        ; If the list is empty
             ???)               ; return the minimum value.
            ((< ??? minval)     ; If current element < minimum value
             (mymin ??? ???))   ; advance recursion, current element is new minimum.
            (else               ; If current element >= minimum value
             (mymin ??? ???)))) ; advance recursion, keep the same minimum.
    

    In the above code, we’re implementing a two-parameter tail-recursive procedure called mymin (don’t use the name min, that’s a built-in procedure.) The first parameter is the list to traverse; the second parameter stores the minimum value found so far, and when the recursion ends, it will hold the answer.

    Call it like this, noticing that for the first call we need to pass in the second argument a number so big that all the other numbers are smaller:

    (mymin '(1 2 3 4 0 5) +inf.0)
    > 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

any tail-recursive version for the below mentioned pseudocode ? Thanks ! (define (min list)
(define (lcs lst1 lst2) (define (except-last-pair list) (if (pair? (cdr list)) (cons (car list)
Ive tried to use the rgba() to define a div's background color, but instead
I want to define a min and max methods in a Utils class. @interface
The stdint.h header at my company reads: #define INT64_MIN -9223372036854775808LL But in some code
I'm writing a bignum library, and I want to use efficient data types to
I'm trying to use the min_element for array of structures, but I simply can't
#include stdio.h #include conio.h #include stdlib.h #define RANGE(i, min, max) (i<min) || (i>max) ?
In kernel.h min is defined as: #define min(x, y) ({ \ typeof(x) _min1 =
#define MIN(A,B) ((A) <= (B) ? (A) : (B)) this is the macro ,

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.