Daniel Sopel
Daniel Sopel

Reputation: 3743

Lisp Code Unexpected Results

I am trying to solve a homework problem where I have to return a selected users' grades in order by course number (not allowed to use built-in sort function). I don't understand the results: the first entry isn't sorted, and some extra students seem to be returned. I don't know why and I spent over three hours trying to solve this one problem. Thanks.

Upvotes: 1

Views: 88

Answers (1)

Rainer Joswig
Rainer Joswig

Reputation: 139411

A good start would be to get rid of functions like car, cdr, cadar, ...

Write access functions for the data records. Use first, second and third.

For accessing the list's first element use the function FIRST.

For accessing the rest of the elements use the function REST.

This makes the code easier to read and understand.

Upvotes: 2

Related Questions