Hi Maryann,
I think Maryann Richards wrote:
>
> Hello everyone-
>
> I'm somewhat new to using multislots, and looking for a way to remove or
> delete a member element of a multislot, without knowing the 1-based index of
> its position in the multifield.
>
> I've tried writing a deffunction to return an integer representing the index
> of the multislot value, in order to use the delete$ function, but with no
> luck.
The built-in function (member$) does this already.
I've tried binding the index position of the element to a variable
> and using that variable in the delete$ function, but it needs an integer
> expression. I need a way to get that index position into the function, or a
> different approach.
I'm sure you're just having a syntax problem.
Jess, the Java Expert System Shell
Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation
Jess Version 5.0a6 7/7/99
Jess> (bind $?mf (create$ A B C D E))
(A B C D E)
Jess> (bind ?i (member$ C $?mf))
3
Jess> (delete$ $?mf ?i ?i)
(A B D E)
Jess> (exit)
Note that if (member$) doesn't find an item, it returns FALSE, so
depending on the circumstances, you may need to check for this before
calling (delete$).
>
> If you've found a better function or approach, any advice would be greatly
> appreciated.
>
> Thanks,
> Maryann Richards
---------------------------------------------------------
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 (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------