Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8226899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:56:10+00:00 2026-06-07T15:56:10+00:00

i want to do a iterative function to compute if an element el is

  • 0

i want to do a iterative function to compute if an element el is a member of a list and returns an
atom.

;;; this is the list
(setf lst ‘(a b c d e 1 2 3 4 5))

;;;this is the function to check whether it is a member of the list.

(defun checklist (a lst)
           (if (member a alist)
               a))

when i put the input -> (checklist 1 lst) , it return the number … but when i input alphabets, it return me error. .. anyone can help me state out what is the problem ?? thanks in advance .

================================================================================

when i input –> (question5 a lst)

it give me error like this .

CG-USER(7): (question5 a lst)
Error: Attempt to take the value of the unbound variable `A’.
[condition type: UNBOUND-VARIABLE]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:56:11+00:00Added an answer on June 7, 2026 at 3:56 pm

    Is that homework?

    If yes:

    I don’t think member is useful for you. If you want to do an iterative solution, then you would use something like DO or DOLIST.

    If no:

    Common Lisp has a function which finds elements in sequence (list, vector, string, …): FIND.

    Added: use (question5 'a lst)

    Also note that your definition has an unfortunate part:

    (checklist nil '(a b c))
    
    (checklist nil '(a b c nil))
    

    both would return NIL.

    Btw., the Lisp introduction book from Touretzky is free for download: http://www.cs.cmu.edu/~dst/LispBook/
    The book provides a nice introduction into the basics of Lisp programming.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jquery looks like this $.post('JSP/processForm.jsp', $(#Form).serialize(), function(data){ //I want to iterate through every line
I have the following custom function in ~/.emacs: (defun xi-rgrep (term) (grep-compute-defaults) (interactive sSearch
I want to iterate over a list of DOM elements (check boxes) and keep
I want to create a jQuery iterative timer . For this I wrote the
I'm running this function (interactive and in a hook) to reformat source code (defun
The list sort() method is a modifier function that returns None . So if
I want to be able to pass either a string literal, 'this is a
I have a JSON list that I want to iterate over, but skip the
Specifically, I want to iterate over every element on the page, each time the
I want to write a function that parses a (theoretically) unknown XML data structure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.