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.

Regards,

-- 

-------------------------------------------------------------
David E. Young
Fujitsu Network Communications  "The fact that ... we still
([EMAIL PROTECTED])    live well cannot ease the pain of
                                 feeling that we no longer live nobly."
                                  -- John Updike
"Programming should be fun,
 programs should be beautiful"
  -- P. Graham
---------------------------------------------------------------------
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