Newbie Queston About LISP

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2006
Posts: 17
Reputation: mikeallen is an unknown quantity at this point 
Solved Threads: 0
mikeallen mikeallen is offline Offline
Newbie Poster

Newbie Queston About LISP

 
0
  #1
Mar 3rd, 2007
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!
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 17
Reputation: mikeallen is an unknown quantity at this point 
Solved Threads: 0
mikeallen mikeallen is offline Offline
Newbie Poster

Re: Newbie Queston About LISP

 
0
  #2
Mar 3rd, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 36
Reputation: azimuth0 is an unknown quantity at this point 
Solved Threads: 5
azimuth0 azimuth0 is offline Offline
Light Poster

Re: Newbie Queston About LISP

 
0
  #3
Mar 27th, 2007
That won't work in common lisp for a number of reasons. This would, though:
  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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum


Views: 1891 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Legacy and Other Languages
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC