JESS: Lisp is maddening
"Donald Winston" <[email protected]>
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <18244_1284816774_o8IDVInW018545_7B4271AE-76D9-439C-AA58-052027C4BFA2@yahoo.com> |
Why doesn't this work?
(defglobal ?*usps-state-codes* = (progn
(bind ?hash-set (new java.util.HashSet 59))
(call ?hash-set add "AL") (call ?hash-set add "AK") (call ?hash-set add "AS") (call ?hash-set add "AZ")
(call ?hash-set add "CA") (call ?hash-set add "CO") (call ?hash-set add "CT") (call ?hash-set add "DE")
(call ?hash-set add "DC") (call ?hash-set add "FM") (call ?hash-set add "FL") (call ?hash-set add "GA")
(call ?hash-set add "GU") (call ?hash-set add "HI") (call ?hash-set add "ID") (call ?hash-set add "IL")
(call ?hash-set add "IN") (call ?hash-set add "IA") (call ?hash-set add "KS") (call ?hash-set add "KY")
(call ?hash-set add "LA") (call ?hash-set add "ME") (call ?hash-set add "MH") (call ?hash-set add "MD")
(call ?hash-set add "MA") (call ?hash-set add "MI") (call ?hash-set add "MN") (call ?hash-set add "MS")
(call ?hash-set add "MO") (call ?hash-set add "MT") (call ?hash-set add "NE") (call ?hash-set add "NV")
(call ?hash-set add "NH") (call ?hash-set add "NJ") (call ?hash-set add "NM") (call ?hash-set add "NC")
(call ?hash-set add "ND") (call ?hash-set add "MP") (call ?hash-set add "OH") (call ?hash-set add "OK")
(call ?hash-set add "OR") (call ?hash-set add "PW") (call ?hash-set add "PA") (call ?hash-set add "PR")
(call ?hash-set add "RI") (call ?hash-set add "SC") (call ?hash-set add "SD") (call ?hash-set add "TN")
(call ?hash-set add "TX") (call ?hash-set add "UT") (call ?hash-set add "VT") (call ?hash-set add "VI")
(call ?hash-set add "VA") (call ?hash-set add "WA") (call ?hash-set add "WV") (call ?hash-set add "WI")
(call ?hash-set add "WY")
(?hash-set)))
(printout t (call ?*usps-state-codes* contains "VA") crlf)
I need to have a global variable that will contain state code values after a (reset). list "AL" "AK" ... works but a HashSet would be more efficient. A jess list is not a collection so I can't use the HashSet(Collection) constructor.