This is the first program I have ever written in LISP, and I am completely confused. I need to write a function that returns a list of 5 rows of entries, and each one of these rows is a list of 5 entries. I know that CAR and CDR could be used to return the elements of a specified list, but that's not creating a function to return the list. Any ideas on how I could do this? Thanks in advance!

Recommended Answers

All 2 Replies

Would something like this work?

(defun list (row-and-column (1 2 3 4 5
                             2 3 4 5 1
                             3 4 5 1 2
                             4 5 1 2 3
                             5 1 2 3 4)))

That won't work in common lisp for a number of reasons. This would, though:

(defun row-and-column ()
  '((1 2 3 4 5)
    (6 7 8 9 0)
    (1 2 3 4 5)
    (6 7 8 9 0)
    (1 2 3 4 5)))

Honestly, though, I can't figure out exactly what the OP wanted...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.