Element Extraction

• To: mathgroup at smc.vnet.net
• Subject: [mg19240] Element Extraction
• From: kewjoi at hixnet.co.za (Kew Joinery)
• Date: Wed, 11 Aug 1999 02:06:52 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Hello everyone,
I have a problem extracting list of list.
Given some list, consisting of elements (not all of them distinct) with
the same length and some target list of the same length, for example:
In[26]:=
someList={{0,0,0},{0,0,1},{0,0,2},{0,1,0},{0,1,1},{0,1,2},{0,2,0},{0,2,1},{0,

2,2},{1,0,0},{1,0,1},{1,0,2},{1,1,0},{1,1,1},{1,1,2},{1,2,0},{1,2,1},{1,

2,2},{2,0,0},{2,0,1},{2,0,2},{2,1,0},{2,1,1},{2,1,2},{2,2,0},{2,2,1},{2,

2,2}};

In[27]:=
target={0,0,1};

Hamming distance between two bit strings means the number of bit
positions in which they differ. For example consecutive elements of the
Gray code list have Hamming distance = 1.
I need to extract these cases(elements of someList) which differ from
target in one coordinate (Hamming distance = 1) or less (the
element===target itself//Hamming distance=0), so the answer should be:

In[33]:=

How could I achieve the extraction efficiently?
Thank you in advance for any suggestions.
Eugene

```

• Prev by Date: Re: Mathematica input from graphics tablets?
• Next by Date: Hi-Lo-Close Charts
• Previous by thread: Re: Memory bloat -- what have I done?
• Next by thread: Re: Element Extraction