My question is:
I have a template, and I want to define a function that is something-like a method (?) for it.
How should I express this idea in the most CLIPS-native way?
for now, I am doing something like this, and it feels very cack-handed.
I'm planning on supporting the short hand syntax for retrieving fact slots at the very least within the actions of a rule. Currently you can use the fact-slot-value function to retrieve the slot values. I'd suggesting wrapping the function with a deffunction so it's not so verbose.
Thanks Gary! I did not mean to make your life more difficult. fact-slot-value looks definitely nice-enough to me.
A thought. Might you (ab)use the template notation a bit in deffunctions, perhaps like this?
(deffunction Ttot ((?a T)) ... )
ugh, no that's a lot of parens. Oh well,
THANKS!
Last edit: slander 2024-02-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can see from the CLIPS parser and manual that this does not work because T is not a
<regular-parameter>
nor a<wildcard-parameter>
.My question is:
I have a template, and I want to define a function that is something-like a method (?) for it.
How should I express this idea in the most CLIPS-native way?
for now, I am doing something like this, and it feels very cack-handed.
Is this where I step away from my safe place and type
(defclass ...
into that scary box?I'm planning on supporting the short hand syntax for retrieving fact slots at the very least within the actions of a rule. Currently you can use the fact-slot-value function to retrieve the slot values. I'd suggesting wrapping the function with a deffunction so it's not so verbose.
Thanks Gary! I did not mean to make your life more difficult.
fact-slot-value
looks definitely nice-enough to me.A thought. Might you (ab)use the template notation a bit in deffunctions, perhaps like this?
ugh, no that's a lot of parens. Oh well,
THANKS!
Last edit: slander 2024-02-28
That's the syntax for generic functions. You can specify class names, but not current deftemplate names.