Would it be possible to add a function called MochiKit.Base.Intersect
that, given arguments of arraylists, would return an array containing
only the objects that are in both(all?) arraylists?

i.e.

a = [1,2,3,4,5];
b = [2,4,6,8,10];
MochiKit.Base.Intersect(a,b) == [2,4]

I know this can be done with several nested applications of map,
filter, and partial, but I figure this might be a useful function to
add to the base of Mochikit, and might be quicker if implemented from
base, rather than through several layers of other functions.

Possible refining:
  Allow the first argument to be a non-arrayLike object, thereby
resulting in the side-effect of "isInArray(element,arrayList)"
functionality.
  Allow several arguments, and intersect them all.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to