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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:29:10+00:00 2026-06-08T04:29:10+00:00

I am trying to solve a basic function. but I get an error with

  • 0

I am trying to solve a basic function. but I get an error with my second if statement and the else.Ff you can give me a help here is the code.

(define (equation x)
  (if(> x 2) (+(-(* x x) x) 4) ) 
  (if (and (> x 1 ) (= x 1))  (and (< x 2) (= x 2)) (/ 1 x))
  (else 0)
  )
  • 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-08T04:29:12+00:00Added an answer on June 8, 2026 at 4:29 am

    There are several errors in your code. And you should use a cond when dealing with multiple conditions (think of it as a series of IF/ELSE IF/…/ELSE statements).

    Be aware that the expression (and (> x 1) (= x 1)) will never be true, as x is either greater than or equal to 1, both conditions can never be true at the same time. You probably meant (or (> x 1) (= x 1)), but even so that expression can be written more concisely as (>= x 1). The same considerations apply for the condition (and (< x 2) (= x 2)).

    I believe this is what you were aiming for:

    (define (equation x)
      (cond ((> x 2)
             (+ (- (* x x) x) 4))
            ((and (>= x 1) (<= x 2))
             (/ 1 x))
            (else 0)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to solve an issue for someone else and instead have run into my
trying to solve a puzzle which i found here: http://zcasper.blogspot.com/2005/10/google-phone-interview.html the goal is to
The whole day yesterday I've been trying to solve this but it's proven to
The basic problem I'm trying to solve is that I have a mix of
Here's the basic idea of what I'm trying to do: Set the innerHTML of
Considering this basic code snippet: <? class mcClassington { var $mcProperty='default'; function mcDoSomething() {
I'm having a doozie of a time trying to get a basic http test
I am trying to solve the question below, but I do not understand it
I am trying to solve a basic problem with drag and drop on iPhone.
I'm trying to solve a compiling problem regarding outside defined constructor. Here's 2 of

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.