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 6553965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:38:40+00:00 2026-05-25T12:38:40+00:00

In Common Lisp, if I wanted to check whether a list was not null,

  • 0

In Common Lisp, if I wanted to check whether a list was not null, I could simply use the list itself as the condition, since all non-nil lists are considered as true. However, I find that in Scheme, doing the same will make Scheme think that I am trying to call a function. Is there a better way to check whether or not a list is null in Scheme than to define another function that does (not (null? x))?

  • 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-05-25T12:38:40+00:00Added an answer on May 25, 2026 at 12:38 pm

    In Scheme, everything that’s not #f is truthy, so '() is considered #t in if statements.

    Thus,

    (if '() "true" "false") => "true"
    (not '()) => #f
    

    Using (not (null? x)) is the most straightforward way of checking if a list is not null: it describes exactly what you want, and in corner cases where you’re given something that’s not a list, it will give you different behavior:

    (if (not (null? #t)) "true" "false") => "true"
    (if (not #t) "true" "false") => "false"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Common Lisp you use the (null x) function to check for empty lists
since I'm a newbie to Common Lisp I tried to solve problems on SPOJ
In Common Lisp package definition, what is the difference between (defpackage #:foo (:use :cl)
In common lisp, we can use the remove function. It seems there is no
In Common Lisp you can do this: (defun foo (bar &key baz quux) (list
The following Common Lisp code does not produce the output I would expect it
can I use common lisp and Clojure from within emacs at the same time?
In Common LISP you can do the following (macro lambda (x) (list (quote car)
With common lisp and I am assuming the introspection properties. How can I add
After reading Practical Common Lisp I finally understood what the big deal about macros

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.