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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:23:58+00:00 2026-06-14T22:23:58+00:00

I am trying to define a greater than rule in CLIPS but it doesn’t

  • 0

I am trying to define a greater than rule in CLIPS but it doesn’t seem to be working. Any idea on how I can fix it. The problem seems to be occurring at defrule btwn100and120.

(defrule part-credits
    (or (current-part "a")
        (current-part "b")
        (current-part "c"))
    =>
    (bind ?reply (get-text-from-user "How many points did you achieve?"))
    (assert (part-credits ?reply))
)

(defrule btwn100and120
    (part-credits => 100)
    (part-credits <= 120)
    =>
    (bind ?reply (get-text-from-user "Did you Part A before the changes? (y/n)"))
    (assert (btwn100and120 ?reply))
)
  • 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-14T22:24:00+00:00Added an answer on June 14, 2026 at 10:24 pm

    Use the test function to make numerical comparisons. Also, note that CLIPS uses prefix notation for mathematical operators. Here is a simplified rule that does what you want:

    (defrule MAIN::btwn100and120
      (part-credits ?val)
      (test (<= ?val 120))
      (test (>= ?val 100))
    =>
      (printout t "Value " ?val " is in range." crlf)
    )
    

    And here is a test of the rule:

    CLIPS> (watch facts)
    CLIPS> (watch activations)
    CLIPS> (assert (part-credits 99))
    ==> f-0     (part-credits 99)
    <Fact-0>
    CLIPS> (assert (part-credits 110))
    ==> f-1     (part-credits 110)
    ==> Activation 0      btwn100and120: f-1
    <Fact-1>
    CLIPS> (run)
    Value 110 is in range.
    CLIPS> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to define nested modules, but I couldn't find any complete explanations
I'm trying to define a new array through a where query but I can
I am trying to define MapPageRoute on the application global.asax but my problem is
I'm trying to define a way in which I can control the access to
I'm trying to define multiple criteria for a single field in symfony, but every
I'm trying to define fonts which can be reference by many style elements: <System:String
I was trying to: #define CommonAppData {commonappdata} but it yields: Compiler Error [ISPP] Expression
I am trying to add a greater than operator > to a ast: the
Im trying to define a select tag in my view. My view looks like
I'm trying to define a method in my vb.net interface that will only accept

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.