The default value for a multifield slot is a multifield with no values. Your pattern, (friends ?f), requires one and exactly one value in order to be matched, so the behavior you're seeing is correct since calling make-instance with no values placed in friends will use the default value. For your pattern to work correctly based on the print statement in the rule it should be (friends ? $?) which will match any Man who has one or more friends.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Consider the following rule:
(defclass Man (is-a USER)
(multislot friends))
(defrule rule1
(object (is-a Man) (friends ?f))
=>
(printout t "This guy has friends." crlf))
***********************************
Then I create a Man:
(make-instance jack of Man) ;I did not mention the friends field
This rule will not pick up this instance of Man. This only happens with
multislots, not slots.
Also, if I create the instance like this:
(make-instance jack of Man (friends nil))
THEN the rule picks up the instance.
Am I missing something here?
The default value for a multifield slot is a multifield with no values. Your pattern, (friends ?f), requires one and exactly one value in order to be matched, so the behavior you're seeing is correct since calling make-instance with no values placed in friends will use the default value. For your pattern to work correctly based on the print statement in the rule it should be (friends ? $?) which will match any Man who has one or more friends.