List Equality

3 views
Skip to first unread message

Nicholas Blatter

unread,
Apr 9, 2011, 1:20:04 AM4/9/11
to byu-cs-330-...@googlegroups.com
I'm trying to figure out the best way to test typei functions that
return a list of constraints.

Is there a built-in Racket function which tests for list equality by
comparing value-membership instead of value-index? For example a
function that says the lists '(1 2 3) and '(2 1 3) are equal but '(1 2
3) and '(2 1 2) are not.

It wouldn't be that hard to write one (test length and then each
value), but if it's a built-in then that's a more "official" way to
test.

Thanks,

Nick

Bryan Morse

unread,
Apr 9, 2011, 10:47:33 AM4/9/11
to byu-cs-330-...@googlegroups.com
There isn't, at least to my knowledge. But you might find the "member" function useful. It tests to see if something is a member of a list.

<http://docs.racket-lang.org/reference/pairs.html?q=member#(def._((quote._~23~25kernel)._member))>

Reply all
Reply to author
Forward
0 new messages