0

Hello, and thank you for taking the time to help me! I am working on a Scheme procedure right now, which is supposed to read in integers until 0 is entered, and display the minimum of the integers (0 included). I have a question about the procedure, which is below. Keep in mind, I have only written ONE Scheme procedure thus far, which displayed the minimum of two integers, so it was much easier. So here is my question:

In the header, what do I put for the conditions after lambda? How do I tell the procedure that it needs to read in ints until 0 is entered?

Thank you for any help you can provide!

1
Contributor
1
Reply
4
Views
7 Years
Discussion Span
Last Post by vileoxidation
0

Okay, I don't know if anyone on here programs in scheme really, but I am going to post my updated code anyway in hopes that someone can help me. I will be so appreciative to anyone who can help me out with this!

Here is what I have right now:

(define find_min (lambda args
                   (display (min args))                  
                 )
)

(display (find_min (read)))

But I have a feeling this is not right, because I get an error when I run the procedure. The error says this:

min: expects argument of type <real number>; given (1)

So I think that args is not what I really want after lambda. I want integers, not just arguments, so is there a way to do that? Otherwise, does this look somewhat right for finding the minimum of the ints entered?

Thank you, again!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.