AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Accessing facts with ^nth
 
 

(It seems like it is my week on deck!)

I’ve having problems with ^nth() compared to ^first(). The documentation implies that the first parameter to ^nth() is the same as for ^first() - an (annotated) fact set. So that implies that @0, @0fact, @0subject etc are all valid, with the suffix indicating how the returned fact is to be used.

But if I do ^nth(@0fact, 1) then it appears that @0fact has already been decoded to the fact index prior to FLRSpecificCode() being called. You can see that in the tracing:

System Call ^nth(2169861, ) = 

However the code in FLRSpecificCode appears to be expecting an unresolved version of the first argument and hence it throws a failure with a fact index.

But if I do ^nth(@0, 1) then then the first argument is not decoded and the generic FLR() routine will be called. But then I only get the subject back and I really want the fact index so that I can use ^field(). (Ultimately I want the verb and object).

 

 

 
  [ # 1 ]

^nth evaluates its arguments, unlike ^first.  Which is not consistent with the documentation.

@0 always evaluates to @0 (nothing to say extra)
@0subject and others evaluate to a specific piece of fact

You can suppress evalutation by quoting, so
^nth(’@0subject   will still be passed @0subject

But I will modify nth so that it behaves like first for the next release in a couple of days.

 

 
  [ # 2 ]

Thank you, the quoting works for me.

 

 
  login or register to react