How to read/use user input using CLIPSHow to read line in CLIPS?CLIPS multiple andOR/And Operation in CLIPSHow to make CLIPS program work?How exactly (refresh) works in the clips?CLIPS input taking and comparisonChecking data type of file read in CLIPSInput Match in CLIPS, Syntax errorHow to add fact in CLIPSCLIPS check the boundaries of a (read) value

How is linear momentum conserved in case of a freely falling body?

How to respectfully refuse to assist co-workers with IT issues?

What should come first—characters or plot?

Can RMSE and MAE have the same value?

"Opusculum hoc, quamdiu vixero, doctioribus emendandum offero."?

Removal of て in Japanese novels

Ghidra: Prepend memory segment in assembly listing view

Why do banks “park” their money at the European Central Bank?

Breaker Mapping Questions

Prove your innocence

Prevent use of CNAME record for untrusted domain

What is the difference between "Grippe" and "Männergrippe"?

Why does Windows store Wi-Fi passwords in a reversible format?

Why are non-collision-resistant hash functions considered insecure for signing self-generated information

Could this kind of inaccurate sacrifice be countered?

"There were either twelve sexes or none."

Round towards zero

Is first Ubuntu user root?

Was the Boeing 2707 design flawed?

Nothing like a good ol' game of ModTen

Discussing work with supervisor in an invited dinner with his family

Talk interpreter

Another solution to create a set with two conditions

Evaluated vs. unevaluated Association



How to read/use user input using CLIPS


How to read line in CLIPS?CLIPS multiple andOR/And Operation in CLIPSHow to make CLIPS program work?How exactly (refresh) works in the clips?CLIPS input taking and comparisonChecking data type of file read in CLIPSInput Match in CLIPS, Syntax errorHow to add fact in CLIPSCLIPS check the boundaries of a (read) value






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm working on a Clips project.
I am trying to firstly store facts (which is fine).
Then I am trying to ask the user to provide details about the gems that are stored as facts, and based on their answer, to provide them with the correct name of the gem.



(deftemplate gem
(slot name)
(slot hardness)
(slot density)
(multislot colors))

(deffacts gems
(gem (name diamond) (hardness 10) (density 3.52) (colors yellow, brown, green, blue, white, colorless))
(gem (name corundum) (hardness 9) (density 4) (colors red, pink, yellow, brown, green, blue, violet, black, white, colorless))
(gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow,brown,green))
(gem (name spinel) (hardness 8) (density 3.6) (colors red, pink, yellow, brown, green, blue, violet, white, colorless)))

(defrule reading-input
=>
(printout t "Enter the hardness of the gem: " )
(assert (var(read)))
(printout t "Enter the density of the gem: " )
(assert (var(read)))
(printout t "Enter the color of the gem: " )
(assert (var(read))))

(defrule checking-input
(var ?hardness)
(var ?density)
(var ?colors)
(gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
(test (= ?hardness ?hardness1))
(test (= ?hardness ?hardness1))
(test (member$ ?hardness ?hardness1))
=>
(printout t "Gem is " ?name1 crlf))


I am a beginner in CLIPS and cannot figure out how to get the above code to work right despite spending hours on it. Any help would be appreciated.Thank you.










share|improve this question






























    0















    I'm working on a Clips project.
    I am trying to firstly store facts (which is fine).
    Then I am trying to ask the user to provide details about the gems that are stored as facts, and based on their answer, to provide them with the correct name of the gem.



    (deftemplate gem
    (slot name)
    (slot hardness)
    (slot density)
    (multislot colors))

    (deffacts gems
    (gem (name diamond) (hardness 10) (density 3.52) (colors yellow, brown, green, blue, white, colorless))
    (gem (name corundum) (hardness 9) (density 4) (colors red, pink, yellow, brown, green, blue, violet, black, white, colorless))
    (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow,brown,green))
    (gem (name spinel) (hardness 8) (density 3.6) (colors red, pink, yellow, brown, green, blue, violet, white, colorless)))

    (defrule reading-input
    =>
    (printout t "Enter the hardness of the gem: " )
    (assert (var(read)))
    (printout t "Enter the density of the gem: " )
    (assert (var(read)))
    (printout t "Enter the color of the gem: " )
    (assert (var(read))))

    (defrule checking-input
    (var ?hardness)
    (var ?density)
    (var ?colors)
    (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
    (test (= ?hardness ?hardness1))
    (test (= ?hardness ?hardness1))
    (test (member$ ?hardness ?hardness1))
    =>
    (printout t "Gem is " ?name1 crlf))


    I am a beginner in CLIPS and cannot figure out how to get the above code to work right despite spending hours on it. Any help would be appreciated.Thank you.










    share|improve this question


























      0












      0








      0








      I'm working on a Clips project.
      I am trying to firstly store facts (which is fine).
      Then I am trying to ask the user to provide details about the gems that are stored as facts, and based on their answer, to provide them with the correct name of the gem.



      (deftemplate gem
      (slot name)
      (slot hardness)
      (slot density)
      (multislot colors))

      (deffacts gems
      (gem (name diamond) (hardness 10) (density 3.52) (colors yellow, brown, green, blue, white, colorless))
      (gem (name corundum) (hardness 9) (density 4) (colors red, pink, yellow, brown, green, blue, violet, black, white, colorless))
      (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow,brown,green))
      (gem (name spinel) (hardness 8) (density 3.6) (colors red, pink, yellow, brown, green, blue, violet, white, colorless)))

      (defrule reading-input
      =>
      (printout t "Enter the hardness of the gem: " )
      (assert (var(read)))
      (printout t "Enter the density of the gem: " )
      (assert (var(read)))
      (printout t "Enter the color of the gem: " )
      (assert (var(read))))

      (defrule checking-input
      (var ?hardness)
      (var ?density)
      (var ?colors)
      (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
      (test (= ?hardness ?hardness1))
      (test (= ?hardness ?hardness1))
      (test (member$ ?hardness ?hardness1))
      =>
      (printout t "Gem is " ?name1 crlf))


      I am a beginner in CLIPS and cannot figure out how to get the above code to work right despite spending hours on it. Any help would be appreciated.Thank you.










      share|improve this question














      I'm working on a Clips project.
      I am trying to firstly store facts (which is fine).
      Then I am trying to ask the user to provide details about the gems that are stored as facts, and based on their answer, to provide them with the correct name of the gem.



      (deftemplate gem
      (slot name)
      (slot hardness)
      (slot density)
      (multislot colors))

      (deffacts gems
      (gem (name diamond) (hardness 10) (density 3.52) (colors yellow, brown, green, blue, white, colorless))
      (gem (name corundum) (hardness 9) (density 4) (colors red, pink, yellow, brown, green, blue, violet, black, white, colorless))
      (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow,brown,green))
      (gem (name spinel) (hardness 8) (density 3.6) (colors red, pink, yellow, brown, green, blue, violet, white, colorless)))

      (defrule reading-input
      =>
      (printout t "Enter the hardness of the gem: " )
      (assert (var(read)))
      (printout t "Enter the density of the gem: " )
      (assert (var(read)))
      (printout t "Enter the color of the gem: " )
      (assert (var(read))))

      (defrule checking-input
      (var ?hardness)
      (var ?density)
      (var ?colors)
      (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
      (test (= ?hardness ?hardness1))
      (test (= ?hardness ?hardness1))
      (test (member$ ?hardness ?hardness1))
      =>
      (printout t "Gem is " ?name1 crlf))


      I am a beginner in CLIPS and cannot figure out how to get the above code to work right despite spending hours on it. Any help would be appreciated.Thank you.







      clips






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 18:52









      CheeseCrackerCheeseCracker

      207 bronze badges




      207 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1















           CLIPS (6.31 2/3/18)
          CLIPS>
          (deftemplate gem
          (slot name)
          (slot hardness)
          (slot density)
          (multislot colors))
          CLIPS>
          (deffacts gems
          (gem (name diamond) (hardness 10) (density 3.52) (colors yellow brown green blue white colorless))
          (gem (name corundum) (hardness 9) (density 4) (colors red pink yellow brown green blue violet black white colorless))
          (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow brown green))
          (gem (name spinel) (hardness 8) (density 3.6) (colors red pink yellow brown green blue violet white colorless)))
          CLIPS>
          (defrule reading-input
          =>
          (printout t "Enter the hardness of the gem: " )
          (assert (hardness (read)))
          (printout t "Enter the density of the gem: " )
          (assert (density (read)))
          (printout t "Enter the color of the gem: " )
          (assert (color (read))))
          CLIPS>
          (defrule checking-input
          (hardness ?hardness)
          (density ?density)
          (color ?color)
          (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
          (test (= ?hardness ?hardness1))
          (test (= ?density ?density1))
          (test (member$ ?color ?colors1))
          =>
          (printout t "Gem is " ?name1 crlf))
          CLIPS> (reset)
          CLIPS> (run)
          Enter the hardness of the gem: 9
          Enter the density of the gem: 4
          Enter the color of the gem: green
          Gem is corundum
          CLIPS>





          share|improve this answer

























          • wow..thank you so much Gary! I see my mistake now :)

            – CheeseCracker
            Mar 27 at 19:17










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384554%2fhow-to-read-use-user-input-using-clips%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1















           CLIPS (6.31 2/3/18)
          CLIPS>
          (deftemplate gem
          (slot name)
          (slot hardness)
          (slot density)
          (multislot colors))
          CLIPS>
          (deffacts gems
          (gem (name diamond) (hardness 10) (density 3.52) (colors yellow brown green blue white colorless))
          (gem (name corundum) (hardness 9) (density 4) (colors red pink yellow brown green blue violet black white colorless))
          (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow brown green))
          (gem (name spinel) (hardness 8) (density 3.6) (colors red pink yellow brown green blue violet white colorless)))
          CLIPS>
          (defrule reading-input
          =>
          (printout t "Enter the hardness of the gem: " )
          (assert (hardness (read)))
          (printout t "Enter the density of the gem: " )
          (assert (density (read)))
          (printout t "Enter the color of the gem: " )
          (assert (color (read))))
          CLIPS>
          (defrule checking-input
          (hardness ?hardness)
          (density ?density)
          (color ?color)
          (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
          (test (= ?hardness ?hardness1))
          (test (= ?density ?density1))
          (test (member$ ?color ?colors1))
          =>
          (printout t "Gem is " ?name1 crlf))
          CLIPS> (reset)
          CLIPS> (run)
          Enter the hardness of the gem: 9
          Enter the density of the gem: 4
          Enter the color of the gem: green
          Gem is corundum
          CLIPS>





          share|improve this answer

























          • wow..thank you so much Gary! I see my mistake now :)

            – CheeseCracker
            Mar 27 at 19:17















          1















           CLIPS (6.31 2/3/18)
          CLIPS>
          (deftemplate gem
          (slot name)
          (slot hardness)
          (slot density)
          (multislot colors))
          CLIPS>
          (deffacts gems
          (gem (name diamond) (hardness 10) (density 3.52) (colors yellow brown green blue white colorless))
          (gem (name corundum) (hardness 9) (density 4) (colors red pink yellow brown green blue violet black white colorless))
          (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow brown green))
          (gem (name spinel) (hardness 8) (density 3.6) (colors red pink yellow brown green blue violet white colorless)))
          CLIPS>
          (defrule reading-input
          =>
          (printout t "Enter the hardness of the gem: " )
          (assert (hardness (read)))
          (printout t "Enter the density of the gem: " )
          (assert (density (read)))
          (printout t "Enter the color of the gem: " )
          (assert (color (read))))
          CLIPS>
          (defrule checking-input
          (hardness ?hardness)
          (density ?density)
          (color ?color)
          (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
          (test (= ?hardness ?hardness1))
          (test (= ?density ?density1))
          (test (member$ ?color ?colors1))
          =>
          (printout t "Gem is " ?name1 crlf))
          CLIPS> (reset)
          CLIPS> (run)
          Enter the hardness of the gem: 9
          Enter the density of the gem: 4
          Enter the color of the gem: green
          Gem is corundum
          CLIPS>





          share|improve this answer

























          • wow..thank you so much Gary! I see my mistake now :)

            – CheeseCracker
            Mar 27 at 19:17













          1














          1










          1









           CLIPS (6.31 2/3/18)
          CLIPS>
          (deftemplate gem
          (slot name)
          (slot hardness)
          (slot density)
          (multislot colors))
          CLIPS>
          (deffacts gems
          (gem (name diamond) (hardness 10) (density 3.52) (colors yellow brown green blue white colorless))
          (gem (name corundum) (hardness 9) (density 4) (colors red pink yellow brown green blue violet black white colorless))
          (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow brown green))
          (gem (name spinel) (hardness 8) (density 3.6) (colors red pink yellow brown green blue violet white colorless)))
          CLIPS>
          (defrule reading-input
          =>
          (printout t "Enter the hardness of the gem: " )
          (assert (hardness (read)))
          (printout t "Enter the density of the gem: " )
          (assert (density (read)))
          (printout t "Enter the color of the gem: " )
          (assert (color (read))))
          CLIPS>
          (defrule checking-input
          (hardness ?hardness)
          (density ?density)
          (color ?color)
          (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
          (test (= ?hardness ?hardness1))
          (test (= ?density ?density1))
          (test (member$ ?color ?colors1))
          =>
          (printout t "Gem is " ?name1 crlf))
          CLIPS> (reset)
          CLIPS> (run)
          Enter the hardness of the gem: 9
          Enter the density of the gem: 4
          Enter the color of the gem: green
          Gem is corundum
          CLIPS>





          share|improve this answer













           CLIPS (6.31 2/3/18)
          CLIPS>
          (deftemplate gem
          (slot name)
          (slot hardness)
          (slot density)
          (multislot colors))
          CLIPS>
          (deffacts gems
          (gem (name diamond) (hardness 10) (density 3.52) (colors yellow brown green blue white colorless))
          (gem (name corundum) (hardness 9) (density 4) (colors red pink yellow brown green blue violet black white colorless))
          (gem (name chrysoberyl) (hardness 8.5) (density 3.72) (colors yellow brown green))
          (gem (name spinel) (hardness 8) (density 3.6) (colors red pink yellow brown green blue violet white colorless)))
          CLIPS>
          (defrule reading-input
          =>
          (printout t "Enter the hardness of the gem: " )
          (assert (hardness (read)))
          (printout t "Enter the density of the gem: " )
          (assert (density (read)))
          (printout t "Enter the color of the gem: " )
          (assert (color (read))))
          CLIPS>
          (defrule checking-input
          (hardness ?hardness)
          (density ?density)
          (color ?color)
          (gem (name ?name1) (hardness ?hardness1) (density ?density1) (colors $?colors1))
          (test (= ?hardness ?hardness1))
          (test (= ?density ?density1))
          (test (member$ ?color ?colors1))
          =>
          (printout t "Gem is " ?name1 crlf))
          CLIPS> (reset)
          CLIPS> (run)
          Enter the hardness of the gem: 9
          Enter the density of the gem: 4
          Enter the color of the gem: green
          Gem is corundum
          CLIPS>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 19:14









          Gary RileyGary Riley

          6,6802 gold badges12 silver badges29 bronze badges




          6,6802 gold badges12 silver badges29 bronze badges















          • wow..thank you so much Gary! I see my mistake now :)

            – CheeseCracker
            Mar 27 at 19:17

















          • wow..thank you so much Gary! I see my mistake now :)

            – CheeseCracker
            Mar 27 at 19:17
















          wow..thank you so much Gary! I see my mistake now :)

          – CheeseCracker
          Mar 27 at 19:17





          wow..thank you so much Gary! I see my mistake now :)

          – CheeseCracker
          Mar 27 at 19:17








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384554%2fhow-to-read-use-user-input-using-clips%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript