Hi Chandler, <[EMAIL PROTECTED]>

It looks to me that you are reversing the arguments to the nth$ function.  Pass the index of the element you want to retrieve first, then pass the list itself.  See http://www.jessrules.com/jess/docs/70/functions.html#nth$

BTW - If your intention is to access numbers stored in a list, then it is better practice to explicitly define an unordered fact template with a multislot to hold the list.  I'm fairly sure that Ernest has advocated this as a best practice.  Also, if you look at the current JessDE, the editor will create an implicit deftemplate for all ordered facts anyway.

Here is a short program (attached) to illustrate my points.  Notice the output and the usage of both ordered and unordered facts.

Cheers,
Jason

-----------------------------------------------------------
Jason C. Morris
Worcester Polytechnic Institute     Phone: (508) 831-5006
Department of Computer Science      FAX:   (508) 831-5776
Fuller Laboratories - Room 312     
[EMAIL PROTECTED]           
Artificial Intelligence Lab (AIRG)
100 Institute Road
Worcester, MA 01609-2280   
-----------------------------------------------------------


On 8/22/06, Chandler <[EMAIL PROTECTED]> wrote:

hello all,

I have an ordered fact which is declared on the spot...so for that..
whatever information I insert, is entered in the multislot __data

Later on in program. I want to extract information from this slot, which is
fine (NO PROBLEMS)... but things returned are like list... and say if one of
the items in the list is a number which I want to use for a specific purpose
say addition to some other number....

I get error like "watever number" is a list, not a number...

how can I obtain the number from that list and use it for say addition,
multiplication ?
I tried.. something like (nth$ (getSlotValue __data) 1) - didnt work

Pleas help... I want to use an ordered fact and be able to use that value
from __data, but I get held at "is a list , not a number"



--
View this message in context: http://www.nabble.com/multislot-__data-question-tf2146010.html#a5924517
Sent from the Jess forum at Nabble.com.

--------------------------------------------------------------------
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] .
--------------------------------------------------------------------




--
-----------------------------------------------------------
Jason C. Morris
Worcester Polytechnic Institute     Phone: (508) 831-5006
Department of Computer Science      FAX:   (508) 831-5776
Fuller Laboratories - Room 312      [EMAIL PROTECTED]            
Artificial Intelligence Lab (AIRG)
100 Institute Road
Worcester, MA 01609-2280    
-----------------------------------------------------------

Attachment: getMultislotItem.clp
Description: Binary data

Reply via email to