Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: faster sublist checking

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48898] Re: faster sublist checking
  • From: lalu_bhatt at yahoo.com (Bhuvanesh)
  • Date: Tue, 22 Jun 2004 05:32:10 -0400 (EDT)
  • References: <cabq3o$oos$1@smc.vnet.net> <cb645s$khh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

jmyers6761 at aol.com (JMyers6761) wrote:
> Why is this?
> 
> A = {3, 5}; B = {1, 2, 3, 4, 5, 6, 7};
> 
> Intersection[B, A] == Sort[A]
> True
> 
> but
> 
> SublistQ[B_List, A_List] := Intersection[B, A] == Sort[A];
> 
> SublistQ[B, A]
> False
> 
> Al Myers

What version are you using?

$Version      = 5.0.0 for Microsoft Windows (June 10, 2003)
$TopDirectory = C:\Program Files\Wolfram Research\Mathematica\5.0.0

In[1]:= $Version

Out[1]= 5.0 for Microsoft Windows (June 10, 2003)

In[2]:= A = {3, 5}; B = {1, 2, 3, 4, 5, 6, 7};

In[3]:= Intersection[B, A] == Sort[A]

Out[3]= True

In[4]:= SublistQ[B_List, A_List] := Intersection[B, A] == Sort[A];

In[5]:= SublistQ[B, A]

Out[5]= True

Bhuvanesh,
Wolfram Research.

--
Disclaimer: All opinions expressed herein are my own and not
necessarily those of Wolfram Research.


  • Prev by Date: Re: faster sublist checking
  • Next by Date: XML Importing
  • Previous by thread: Re: Re: faster sublist checking
  • Next by thread: Re: faster sublist checking