943,970 Members | Top Members by Rank

Ad:
Oct 22nd, 2009
0

Help With Scheme Procedure

Expand Post »
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!
Similar Threads
Reputation Points: 23
Solved Threads: 0
Junior Poster in Training
vileoxidation is offline Offline
65 posts
since Feb 2008
Oct 25th, 2009
0
Re: Help With Scheme Procedure
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!
Reputation Points: 23
Solved Threads: 0
Junior Poster in Training
vileoxidation is offline Offline
65 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: HEX dump
Next Thread in Legacy and Other Languages Forum Timeline: Matlab problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC