Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: How to parse an array? Date: Sun, 25 Jun 2017 12:20:37 +0200 Lines: 62 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net YAv+pfjArVgN24WNVg4TBwsvv4DonbGDqAByLW8pC16rdYku4= Cancel-Lock: sha1:fDdLHV6RUDl1VLigZlt0nXgL/rY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:36719 On 25.06.2017 00:42, Martin Gregorie wrote: > On Sat, 24 Jun 2017 16:34:08 -0400, Jerry Stuckle wrote: >=20 >> On 6/20/2017 3:29 PM, Stefan Ram wrote: >>> Eric Douglas writes: >>>> I'm writing a method to take 2 arrays and return the subset of the >>>> first array. >>> >>> =C2=BBThe subset of the first array=C2=AB makes no sense in Englis= h, >>> because >>> >>> >> It makes perfect sense in the mathematical realm. A set is a group of= >> values (or similar). A subset is another group of values, all of whic= h >> are members of the original set. The subset may contain all of the >> values in the original set, or only some of the values in the original= >> set. But it does not contain any values not in the original set. >> > However, this doesn't apply to the OP's example code. His larger array > contains alphabetic valueds, while the second list contains integer > values, IOW it is not a subset of the first array. No, but the result is. >> In this particular case, a subset of the array would be another array >> containing some (or all) of the values in the original array. >> > But that's not what it contains. I am with Jerry here: the result ("retval") does indeed contain a subset = of the entries in "list1", because it does contain some values from it. > In fact it looks as though its meant to be a list of subscripts > referencing the first array. I don't know what I'd call it other than a= > list of subscripts, but it clearly doesn't match your definition of a > subset. Yes, "list2" is a list of subscripts or indexes. But Eric never talked=20 about that as a subset. He wants to _return_ a "subset of the first=20 array" (see above) - "list1" and "list2" are obviously the inputs. You may claim that Eric's wording is imprecise (e.g. he does not explain = the role of sorting the result) and a lot of context is lacking which=20 prevents us from fully assessing the fitness of his approach - but the=20 problem does make sense and he specifically does not abuse the term=20 "subset". Kind regards robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/