Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #203480

Re: handling lists in perl

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups linux.debian.user
Subject Re: handling lists in perl
Date 2018-12-19 22:10 +0100
Message-ID <x6Rgl-5BH-7@gated-at.bofh.it> (permalink)
References (5 earlier) <x6Fyx-6SG-1@gated-at.bofh.it> <x6Gbf-7lJ-7@gated-at.bofh.it> <x6GkV-7pe-7@gated-at.bofh.it> <x6Nmp-33G-3@gated-at.bofh.it> <x6QX0-5eB-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Dec 19, 2018 at 02:48:17PM -0600, David Wright wrote:
> I assume that for two numbers in the second list to be selected, both
> have to match the two members of an individual tuple. As the tuples
> are ordered, I would assume that they are to be tested in the order
> supplied.
> 
> As dictionary lookups are fast, I would convert the second list into
> a dictionary: the number as the dictionary key and the number of
> occurrences as the dictionary value. (Although the problem states
> that the second list shouldn't have duplicates, this method checks
> whether this is indeed the case.)
> 
> Scanning the list of tuples in order, it's now quick to see if both
> members are in the dictionary and, if so, decrement their values or
> delete. What survives of the dictionary keys is the unmatched numbers;
> the matched pairs can be added to a list, individually or as tuples.

Yup, this was my interpretation as well.  He's got what ought to be a
hash stored as a list, and he's got what ought to be a list of lists
stored as a hash.  And we don't know what any of it represents, or
what he wants to do with them, or WHY.

OP, you need to provide an actually readable version of the problem.
Explain what you're doing.  Tell us what your inputs ARE and where
they COME FROM and what you want to DO with them.

Ideally, give actual examples.  Not made-up bullshit examples.  REAL ones.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-18 14:40 +0100
  Re: handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-18 14:50 +0100
    Re: handling lists in perl deloptes <deloptes@gmail.com> - 2018-12-18 20:10 +0100
      Re: handling lists in perl deloptes <deloptes@gmail.com> - 2018-12-19 01:50 +0100
        Re: handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-19 05:40 +0100
        Re: handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-19 06:10 +0100
          Re: handling lists in perl deloptes <deloptes@gmail.com> - 2018-12-19 08:20 +0100
            Re: handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-19 09:30 +0100
              Re: handling lists in perl deloptes <deloptes@gmail.com> - 2018-12-19 09:40 +0100
                Re: handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-19 10:20 +0100
                Re: handling lists in perl mick crane <mick.crane@gmail.com> - 2018-12-19 10:30 +0100
                Re: handling lists in perl Andy Smith <andy@strugglers.net> - 2018-12-19 18:00 +0100
                Re: handling lists in perl deloptes <deloptes@gmail.com> - 2018-12-19 20:00 +0100
                Re: handling lists in perl David Wright <deblis@lionunicorn.co.uk> - 2018-12-19 21:50 +0100
                Re: handling lists in perl Greg Wooledge <wooledg@eeg.ccf.org> - 2018-12-19 22:10 +0100
    Re: handling lists in perl David Christensen <dpchrist@holgerdanske.com> - 2018-12-19 03:40 +0100
  Re: handling lists in perl Greg Wooledge <wooledg@eeg.ccf.org> - 2018-12-18 15:00 +0100

csiph-web