Use the find/find-all match method to find the list element. find-allmatch

Source: Internet
Author: User

Use the find/find-all match method to find the list element. find-allmatch
Find a sublist in the list

Assume that the database contains several rows of records. The returned results of the newlisp mysql module use a list to indicate these rows of records. Each element is a list containing a row of records, each record list contains several lists. Each list has two elements: field name and field value.

Now we can use the find Method for Pattern Search.

> (find (list (list "issue_id" 1773) '*) '((("issue_id" 1773) ("custom_field_id" 7) ("type" "IssueCustomField") ("name" "\229\143\145\231\142\1\76\230\151\165\230\156\159") ("default_value" "") ("value" "2014-06-27"))) match) 0

In this example, the first field in these rows is issued_id and the value is 1773. Because find is used, the first row is searched.

Find returns 0. You can view the result with $0.

> $0 ("issue_id" 1773) ("custom_field_id" 7) ("type" "IssueCustomField") ("name" "" ") (" default_value """) ("value" "2014-06-27 "))

Find several sub-lists in the list

You can use find-all to find all records that match the pattern,

(set 'r (find-all (list (list "issue_id" issue-id) '*) issue-customized-values))

Similar to find, but note that the result is returned directly. Therefore, do not use $0 to view the result.

However, you can view the number of records found in $ count.


Find/find-all match is particularly suitable for further searching the database result record set.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.