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.
Forum rules
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.
by Ehsan » Thu Jul 12, 2012 7:44 am
Hi every one
I need a function count numbers in a list for example
(count-numbers '(3 4 5 a b c d 6 ) ) -> 4
-
Ehsan
-
- Posts: 8
- Joined: Thu Jul 12, 2012 7:39 am
by Goheeca » Fri Jul 13, 2012 8:31 am
You can use the loop macro (search for a count clause) with a numberp predicate.
-

Goheeca
-
- Posts: 271
- Joined: Thu May 10, 2012 12:54 pm
-
by nuntius » Fri Jul 13, 2012 9:04 am
let, dolist, incf, and numberp would also work.
A recursive helper function could be used to eliminate the let, dolist, and incf; some classes prefer recursive solutions.
-

nuntius
-
- Posts: 532
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
by Ehsan » Sat Jul 14, 2012 12:12 am
Tnxxxxxxxxxxxxxxxxxxxxxxxx
-
Ehsan
-
- Posts: 8
- Joined: Thu Jul 12, 2012 7:39 am
Return to Homework
Who is online
Users browsing this forum: No registered users and 0 guests