Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15635
| From | Daniel Lichtblau <danl@wolfram.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Pattern matching in lists |
| Date | 2011-02-03 10:26 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iidvsg$bfm$1@smc.vnet.net> (permalink) |
----- Original Message -----
> From: "Harvey P. Dale" <hpd1@nyu.edu>
> To: mathgroup@smc.vnet.net
> Sent: Wednesday, February 2, 2011 5:07:02 AM
> Subject: Pattern matching in lists
> MemberQ easily tests whether a single integer appears in a list
> of integers. Suppose, however, that I want to test not for a single
> integer but for two or more consecutive integers, e.g., to see whether
> {1,4,6} is a member of {1,3,2,6,5,1,4,6,3,9}. I can do this by
> converting both lists into strings and then using string-matching
> functions, but is there some way of doing it directly without that
> conversion?
>
> Thanks.
>
> Harvey
>
> Harvey P. Dale
> [...]
In[7]:= Or @@
ListCorrelate[{1, 4, 6}, {1, 3, 2, 6, 5, 1, 4, 6, 3, 9}, {-1, 1}, {},
Equal, And]
Out[7]= True
I've no idea why all the optional arguments to ListConvolve/Correlate were not made into Options. This strikes me as a particularly flawed aspect in the design of these otherwise excellent functions.
Daniel Lichtblau
Wolfram Research
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Pattern matching in lists Daniel Lichtblau <danl@wolfram.com> - 2011-02-03 10:26 +0000 Re: Pattern matching in lists Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-02-04 06:43 +0000
csiph-web