944,052 Members | Top Members by Rank

Ad:
Mar 3rd, 2007
0

Newbie Queston About LISP

Expand Post »
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!
Similar Threads
Reputation Points: 17
Solved Threads: 0
Newbie Poster
mikeallen is offline Offline
17 posts
since Sep 2006
Mar 3rd, 2007
0

Re: Newbie Queston About LISP

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)))
Last edited by mikeallen; Mar 3rd, 2007 at 3:40 pm.
Reputation Points: 17
Solved Threads: 0
Newbie Poster
mikeallen is offline Offline
17 posts
since Sep 2006
Mar 27th, 2007
0

Re: Newbie Queston About LISP

That won't work in common lisp for a number of reasons. This would, though:
lisp Syntax (Toggle Plain Text)
  1. (defun row-and-column ()
  2. '((1 2 3 4 5)
  3. (6 7 8 9 0)
  4. (1 2 3 4 5)
  5. (6 7 8 9 0)
  6. (1 2 3 4 5)))

Honestly, though, I can't figure out exactly what the OP wanted...
Reputation Points: 11
Solved Threads: 5
Light Poster
azimuth0 is offline Offline
36 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Ada: resize CLI
Next Thread in Legacy and Other Languages Forum Timeline: Anyone know of a good tutorial for the GS-DOS embedded operating system?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC