Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.051 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'output': 0.05; '(b)': 0.07; 'annotations': 0.09; 'gente': 0.09; 'url:github': 0.09; 'python': 0.11; "(i'm": 0.16; 'cheers!': 0.16; 'devil': 0.16; 'inputs': 0.16; 'substitute': 0.16; 'wrote:': 0.18; 'aug': 0.22; '(a)': 0.24; 'question': 0.24; '>': 0.26; '(for': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'them?': 0.31; 'lists': 0.32; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'are,': 0.36; 'consistent': 0.36; 'done': 0.36; 'url:listinfo': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'list': 0.37; 'represent': 0.38; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'remove': 0.60; 'hope': 0.61; 'lower': 0.61; 'details.': 0.61; 'range': 0.61; 'world.': 0.61; 'such': 0.63; 'happen': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'este': 0.70; 'upper': 0.74; 'collapsing': 0.84; 'education,': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=PReKsd+CYgJNHaxn5xYSFOCTqndYuG2cNJvvcAMw6sk=; b=GqYcoNy0vvtDSPZiM46PDXZpjXTlthvaJUc4nKcu4/kcGl1NDPTsWvtNgrYIRo6Pbn fzU1E9X/bAckfOg0Q4EE0jsvk0DelAB9rgYxL+2BYynzuy0edvgnTqxPwIn365bIvR4G ewp5pC4RgvEJgdMqEyU5ljoO9BuvqQ3qmW13x9f/2/+1qtfhc9KEWjPnLXf+0fc46hzE 6HMMIlPtarct7PdIsMJv/OfhiWuEhf2EsqmN0bBLh6i97Dmxuzteo3Qp+bMvH+fKifsL pFl8lmwqX30RjSFKA/3AwF2eHUmcvbUcymo6cTomQgvyGGTedVhKxsNWFm0EMYWxo24M LLBQ== X-Received: by 10.152.44.230 with SMTP id h6mr37523124lam.51.1408469273590; Tue, 19 Aug 2014 10:27:53 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Rock Neurotiko Date: Tue, 19 Aug 2014 19:27:23 +0200 Subject: Re: Collaps arrays/ list of intergers To: python-list@python.org Content-Type: multipart/alternative; boundary=089e0158c3bebabf640500fece0e X-Mailman-Approved-At: Tue, 19 Aug 2014 20:39:41 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 173 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408473581 news.xs4all.nl 2857 [2001:888:2000:d::a6]:42274 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76594 --089e0158c3bebabf640500fece0e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I made a fast implementation (I'm sure that can be done better) but it works (for what I understood). Is tested in Python3.4, if you will execute in Python 2.x, or don't have mypy or don't like it, you always can remove the function annotations :) http://gist.github.com/rockneurotiko/017044d907242c2e0482 There are all the code and some own-tests :) I hope that this is what you was asking for :) Cheers! 2014-08-19 18:22 GMT+02:00 Peter Pearson : > On Tue, 19 Aug 2014 05:54:24 -0700 (PDT), Jurgens de Bruin wrote: > > > > I do hope somebody can help me with the following: > > I have the followings lists which represent the upper and lower value > > of a range/array. > > > > a =3D [1,50] > > b =3D [75,150] > > c =3D [25,42] > > d =3D [120,149] > > e =3D [35,55] > > > > What I would like to happen is that overlapping range will "collapse" > > to a single range meaning the above list would become: > > > > as list a,c and e overlap they can be represented by > > f =3D [1,55] > > as list b and d overlap they can be represented by > > g =3D [75,150] > > Is your question about (a) identifying overlapping subsets of ranges, > or (b) collapsing such subsets once you have identified them? > > What output would you want if the inputs were . . . > > a =3D [1,50] > b =3D [2,10] > c =3D [40,60] > > ? > > -- > To email me, substitute nowhere->spamcop, invalid->net. > -- > https://mail.python.org/mailman/listinfo/python-list > --=20 Miguel Garc=C3=ADa Lafuente - Rock Neurotiko Do it, the devil is in the details. The quieter you are, the more you are able to hear. Happy Coding. Code with Passion, Decode with Patience. If we make consistent effort, based on proper education, we can change the world. El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a =C3=A9l. --089e0158c3bebabf640500fece0e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I made a fast implementation (I'm sure that= can be done better) but it works (for what I understood).

Is tested= in Python3.4, if you will execute in Python 2.x, or don't have mypy or= don't like it, you always can remove the function annotations :)

h= ttp://gist.github.com/rockneurotiko/017044d907242c2e0482

There a= re all the code and some own-tests :)

I hope that this is what you w= as asking for :)

Cheers!




2014-08-19 18:22 GMT+02:00 Peter Pearson <ppearson= @nowhere.invalid>:
On Tue, 19 Aug 2014 05:54:24= -0700 (PDT), Jurgens de Bruin wrote:
>
> I do hope somebody can help me with the following:
> I have the followings lists which represent the upper and lower value<= br> > of a range/array.
>
> a =3D [1,50]
> b =3D [75,150]
> c =3D [25,42]
> d =3D [120,149]
> e =3D [35,55]
>
> What I would like to happen is that overlapping range will "colla= pse"
> to a single range meaning the above list would become:
>
> as list a,c and e overlap they can be represented by
> f =3D [1,55]
> as list b and d overlap they can be represented by
> g =3D [75,150]

Is your question about (a) identifying overlapping subsets of ranges,=
or (b) collapsing such subsets once you have identified them?

What output would you want if the inputs were . . .

a =3D [1,50]
b =3D [2,10]
c =3D [40,60]

?

--
To email me, substitute nowhere->spamcop, invalid->net.
--
https://mail.python.org/mailman/listinfo/python-list



--
Miguel Garc=C3= =ADa Lafuente - Rock Neurotiko

Do it, the devil is in the detail= s.
The quieter you are, t= he more you are able to hear.
Happy Coding. Code with Passion, Decode with Pat= ience.=
If we make consistent = effort, based on proper education, we can change the world.

El contenido de este e-mail es pr= ivado, no se permite la revelacion del contenido de este e-mail a gente aje= na a =C3=A9l.
--089e0158c3bebabf640500fece0e--