Given the precondition (as Henrique wrote) that the lists are sets you
don't have to consider the general case.
-W
Szymon Klarman wrote:
Yes but this function won't do the job in general. Consider:
list1 = (1 1 2),
list2 = (2 2 3),
(union$ list1 list2) = (1 2 3)
Better to check whether intersection of the two lists have the same
length
as their union.
all best,
Szymon
----- Original Message -----
From: "Wolfgang Laun" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, February 13, 2008 3:16 PM
Subject: Re: JESS: Checking list equality
You can apply (=) to more than 2 arguments.
(= (length$ ?list1) (length$ ?list2) (length$ (union$ ?list1 ?list2)))
kr
Wolfgang
Henrique Lopes Cardoso wrote:
Hi,
I was trying to test equality for lists seen as sets (elements with any
order).
Is there any direct function, or any solution simpler than this:
(bind ?list1 (list 1 2 3))
(bind ?list2 (list 3 2 1))
(and (= (length$ ?list1) (length$ ?list2)) (= (length$ (union$ ?list1
?list2)) (length$ ?list1)))
Thanks.
Henrique
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
--------------------------------------------------------------------
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]
--------------------------------------------------------------------