next up previous

12.18.5 Sequence Operator Caveat

CLIPS normally tries to detect as many constraint errors as possible for a function call at parse time, such as bad number of arguments or types. However, if the sequence expansion operator is used in the function call, all such checking is delayed until run-time (because the number and types of arguments can change for each execution of the call.) For example:

CLIPS> (deffunction foo (?a ?b))
CLIPS> (deffunction bar ($?a) (foo ?a))
ERROR: Function foo expected exactly 2 argument(s)
ERROR:
(deffunction bar
  ($?a)
  (foo ?a)
CLIPS> (deffunction bar ($?a) (foo $?a))
CLIPS> (bar 1)
ERROR: Function foo expected exactly 2 argument(s)
FALSE
CLIPS> (bar 1 2)
FALSE
CLIPS>



next up previous