Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
retrieving a specific row from array in LISP
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
rahul.ma...@gmail.com  
View profile  
 More options Apr 7 2008, 7:21 pm
Newsgroups: comp.lang.clos
From: rahul.ma...@gmail.com
Date: Mon, 7 Apr 2008 16:21:05 -0700 (PDT)
Local: Mon, Apr 7 2008 7:21 pm
Subject: retrieving a specific row from array in LISP
If we have following array
(setf *possible-die-combinations* (make-array '(20 6)
                                 :initial-contents
                                 '((1 3 2 4 5 6)
                                   (1 2 4 5 3 6)
                                   (1 4 5 3 2 6)
                                   (1 5 3 2 4 6)
                                   (2 3 6 4 1 5)
                                   (2 6 4 1 3 5)
                                   (2 4 1 3 6 5)
                                   (2 1 3 6 4 5)
                                   (3 5 6 2 1 4)
                                   (3 6 2 1 5 4)
                                   (3 2 1 5 6 4)
                                   (3 1 5 6 2 4)
                                   (4 6 5 1 2 3)
                                   (4 5 1 2 6 3)
                                   (4 1 2 6 5 3)
                                   (4 2 6 5 1 3)
                                   (5 3 1 4 6 2)
                                   (5 1 4 6 3 2)
                                   (5 4 6 3 1 2)
                                   (5 6 3 1 4 2))))

If you would notice, in every row the set of first and second elements
together is unique. For e.g. the first row has (1, 3) and the second
row has (1, 2).
Now I want to retrieve a specific row based on this given combination
of first and second element. How do I do it?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Feb 10 2009, 8:12 am
Newsgroups: comp.lang.clos
From: p...@informatimago.com (Pascal J. Bourguignon)
Date: Tue, 10 Feb 2009 14:12:44 +0100
Local: Tues, Feb 10 2009 8:12 am
Subject: Re: retrieving a specific row from array in LISP

How do you do it?

(let ((f 1)
      (s 4))
 (find-if (lambda (row) (and (equal f (first row)) (equal s (second row))))
          *possible-die-combinations*))

--
__Pascal Bourguignon__


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »