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

  • SEARCH
  • Home
  • 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 7932197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:56:37+00:00 2026-06-03T20:56:37+00:00

I am trying to write a function that can check whether or not some

  • 0

I am trying to write a function that can check whether or not some input is a quotation for a syntax checker.

I have the following code:

(define is-quote-expression?
  (lambda (v)
    (equal? (car v) 'quote)
    (is-quotation? (cdr v)))))

(define is-quotation?
  (lambda (v)
    (or (number? v)
        (boolean? v)
        (char? v)
        (string? v)
        (symbol? v)
        (null? v)
        (and (pair? v)
             (is-quotation? (car v))
             (is-quotation? (cdr v)))))

When I try to evaluate, I get the following:

 (is-quote-expression? '1)
 #f

 (is-quote-expression? (cons 'quote 1))
 #t

I think my TA told me that the Scheme environment replaced all “‘” with “‘quote”, however, this does not seem to be the case. We are running Petite Chez Scheme.

What am I not seeing?

Thanks in advance.

  • 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-03T20:56:38+00:00Added an answer on June 3, 2026 at 8:56 pm

    I agree with Óscar’s post, though, is-quote-expression? accepts a list rather than a pair and returns whether it was a quotation.

    (define is-quote-expression?
      (lambda (v)
        (and (proper-list-of-given-length? v 2)
             (equal? (car v) 'quote)
             (is-quotation? (cadr v)))))
    

    Also, your original question shows some confusion as to what quote actually does. This is what really should happen:

    > (is-quote-expression? '1)
    #f
    > (is-quote-expression? (cons 'quote 1))
    #f
    > (is-quote-expression? (quote 42))
    #f
    > (is-quote-expression? (quote (quote 42)))
    #t
    

    Note how the built-in quote procedure simply returns what it is passed. In the case of (quote 42) it simply returns 42. But (quote (quote 42)) returns (quote 42), which is what you wish to pass to is-quote-expression?.

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

Sidebar

Related Questions

I'm trying to write a function that can alter the value of a column
I'm trying to write a function that takes multiple arguments, which can come either
I'm trying to write a function, that would use native openssl to do some
I am trying to write a program to check that some C source code
I am trying to write a function that will check if an object exists:
I am trying write a function that generates simulated data but if the simulated
i am trying to write a function that will make DataRow[column] return nullable typed
I'm trying to write a function that will let me red-shift or blue-shift a
I am trying to write a function that includes a file named header.php in
I am trying to write a function that will filter a list of tuples

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.