Skip to main content
Rollback to Revision 1
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[LengthotherLists[[Ordering[Length[#] & /@ (Complement[a, #]&#] & /@ otherLists), 1]]]

This will return the list that best matches a.

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[Length /@ (Complement[a, #]& /@ otherLists), 1]]]

This will return the list that best matches a.

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[Length[#] & /@ (Complement[a, #] & /@ otherLists), 1]]]

This will return the list that best matches a.

Replaced Length[#]& with simpler Length
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[Length[#] &otherLists[[Ordering[Length /@ (Complement[a, #] &#]& /@ otherLists), 1]]]

This will return the list that best matches a.

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[Length[#] & /@ (Complement[a, #] & /@ otherLists), 1]]]

This will return the list that best matches a.

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[Length /@ (Complement[a, #]& /@ otherLists), 1]]]

This will return the list that best matches a.

Source Link
brienna
  • 1.1k
  • 5
  • 13

Suppose I have the reference list a and a matrix otherLists of all other lists I want to compare against a:

otherLists[[Ordering[Length[#] & /@ (Complement[a, #] & /@ otherLists), 1]]]

This will return the list that best matches a.