Help With Scheme Procedure

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 65
Reputation: vileoxidation is an unknown quantity at this point 
Solved Threads: 0
vileoxidation vileoxidation is offline Offline
Junior Poster in Training

Help With Scheme Procedure

 
0
  #1
Oct 22nd, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 65
Reputation: vileoxidation is an unknown quantity at this point 
Solved Threads: 0
vileoxidation vileoxidation is offline Offline
Junior Poster in Training
 
0
  #2
Oct 25th, 2009
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!
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum


Views: 729 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Legacy and Other Languages
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC