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;
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
add a comment |
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
add a comment |
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
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
clips
asked Mar 27 at 18:52
CheeseCrackerCheeseCracker
207 bronze badges
207 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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>
wow..thank you so much Gary! I see my mistake now :)
– CheeseCracker
Mar 27 at 19:17
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
wow..thank you so much Gary! I see my mistake now :)
– CheeseCracker
Mar 27 at 19:17
add a comment |
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>
wow..thank you so much Gary! I see my mistake now :)
– CheeseCracker
Mar 27 at 19:17
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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