I think [EMAIL PROTECTED] wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> just a short appendix: shouldnt it be with $?my-list
> 
> 
> > The "foreach" function is the easiest way to iterate over a list.
> > 
> > (bind ?my-list (create$ a b c d 1 2 3))
> > (foreach ?item ?my-list
> >    (printout t ?item crlf))
> 
> sorry for probably being fussy... ;-)
> 

Actually, no, but I'm glad you brought it up. This is something that I
believe I've done a better job of explaining in my book than I did in
the Jess manual, and it's something that I think a lot of CLIPS users
are perenially confused about. In fact, when I learned CLIPS, I was
confused about this myself, and didn't really understand until I began
to implement Jess.

A form "$?name" is a called a "multifield." It has one, specific
meaning: "match multiple items." It can be used in two contexts: on
the LHS of a rule (where it matches multiple items in a multifield)
and at the end of the argument list of a deffunction (where it allows
you to pass a variable number of arguments to a function.) In any
other context, $?name and ?name are synonymous, and ?name is always
preferred. Both $?name and ?name refer to the *same variable.* In no
sense is "$?name" a special kind of variable that holds a list. A
variable "?name" can hold a list just as well as "$?name". Therefore,
the code above is perfectly correct as originally written.


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to