Scheme Homework Assignment

Posted by user1704677 on Stack Overflow See other posts from Stack Overflow or by user1704677
Published on 2012-09-27T21:36:41Z Indexed on 2012/09/27 21:37 UTC
Read the original article Hit count: 149

Filed under:
|

In a course I am taking we recently had to learn the programming language Scheme. I get all of the basics, which is pretty much all that we have gone though. I'm just having trouble learning to think in the different way that Scheme consists of.

I was given an assignment and really do not even know how to start. I have sat here for a few hours trying to figure out how to even get started, but I'm kind of stumped. For the record, I'm not asking for the code to solve this problem, but more of some thoughts to get me on the right track.

Anyway, here is the gist of the assignment...

We are given a list of ten numbers that represent a voter's votes. The numbers are -1, 0 or 1. Then we are given a list of lists of Candidates, with a name and then ten numbers corresponding to that candidate's votes. These numbers are also -1 0 and 1.

So for example.

'(0 0 0 -1 -1 1 0 1 0 -1) '(Adams 0 1 -1 0 1 1 0 -1 -1 0 0)

We are asked to implement a function called best_candidates that will take in a list of numbers (Voter) and a list of lists of Candidates. Then we have to compare the votes of the voter against the list of each candidate and return a list of names with the most common votes.

So far, I've come up with a few things. I'm just confused on how I will check the values and retain the name of the voter? I guess I'm still stuck in thinking C/Java and it's making this very tough.

Any suggestions to help get me started?

© Stack Overflow or respective owner

Related posts about Scheme

Related posts about racket