Hi David,

This one was reported by Ning Zhong a week or so ago. I didn't post a
fix at that time; here's one now. In jess/Deffunction.java at line
133, there's a clause starting "case RU.MULTIVARIABLE:". Replace it
with this somewhat longer one, and your problem should disappear.


              case RU.MULTIVARIABLE:
                {
                  ValueVector vv = new ValueVector();              
                  for (int i=b.m_factIndex; i< call.size(); i++)
                    {
                      Value v = call.get(i).resolveValue(context);
                      if (v.type() == RU.LIST)
                        {
                          ValueVector list = v.listValue(context);
                          for (int j=0; j<list.size(); j++)
                            vv.add(list.get(j));
                        }
                      else
                        vv.add(v);
                    }
                  c.setVariable(b.m_name, new Value(vv, RU.LIST));
                  break;
                }


I think David Young wrote:
> 
> Greetings. I've encountered some more porting difficulties with
> release 5.0a5. The following code fragment works fine under CLIPS and
> Jess 4.4, yet produces incorrect results when evaluated by Jess 5.0a5:
> 
> (deffunction atoi (?string)
>   "Converts a string to an integer value"
>   (nth$ 1 (explode$ ?string)))
> 
> (deffunction first ($?list)
>   "Returns the first object in a multi-list"
>   (nth$ 1 $?list))
> 
> (deffunction last ($?list)
>   "Returns the last object in a multi-list"
>   (nth$ (length$ $?list) $?list))
> 
> (deffunction withinp (?value $?bounds)
>   "See if 'value' is within the numeric range represented by 'bounds'"
>   (bind ?val (atoi ?value))
>   (and (>= ?val (atoi (first $?bounds)))
>        (<= ?val (atoi (last $?bounds))))))
> 
> (defglobal ?*list* = (create$ "1" "511"))
> 
> (first ?*list*)    ;; should return "1"
> (last ?*list*)     ;; should return "511"
> 
> (withinp "3" (create$ "1" "511")) ;; should return TRUE
> 
> Using 5.0a5, evaluating both first() and last() yields
> 
>   ("1" "511")
> 
> which is incorrect. Evaluating the withinp() form results in an
> exception.
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to