You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
Hello, im learning scheme now for one week. And i have a Problem with one programm. I have to create a programme, which validate a given date witout year and give bach true or false.
So for example (valid-date? 31 4) has to return #f
The condition is no years and the feb always has 28 days. Ive tried the hole night with the function cond equal but no idea how it can be work.
Does anyone have ideas please ?
- Posts: 1
- Joined: Tue Nov 04, 2014 10:25 am
I don't know Scheme but I'm guessing COND works the same way as in CL. You can test the month number with COND and, within the matching clause, validate the day number like so:
- Code: Select all
(cond ((= month 1) (<= day 31))
((= month 2) (<= day 28))
((= month 3) (<= day 31))
And, of course, return false if the month number is out of range.
- Posts: 20
- Joined: Tue May 27, 2014 10:56 am
- Location: Portland, OR
Return to Homework
Who is online
Users browsing this forum: No registered users and 1 guest