I would like to have a list of lists N times deep, and my solution is (in pseudocode): def deep(x): a=[x] return a mylist=[] for N: mylist=deep(mylist) Is there a more elegant way to do it? The maine idea is: from a list having the numbre of steps along N dimensions, generate a list with an item at each possible point. Example 1: N=2 list=[2,3] result=[[1,2],[1,2],[1,2]] Example 2: N=3 list=[3,1,2] result=[[[1,2,3]],[[1,2,3]]] -- Ángel Gutiérrez Rodríguez - agr@fq.uniovi.es Instituto de Ciencia de los Materiales de Madrid - CSIC SpLine - European Syncrothorn Radiat...

I want to divide an array [1 .. N] all integers and array is sorted into k segments. The output should be a list of all possible k-subset no permutation allowed All subsets should have at least two elements but this is easy to do. f.e. k=2, N=5 ===> a=[1 2 3 4 5] [1] [2 3 4 5] less than 2 elements in set - delete [1 2 3 4] [5] less than 2 elements in set - delete [1 2] [3 4 5] [1 2 3] [4 5] k=3 [1] [2 3] [4 5] [1] [2 3 4] [5] [1] [2] [3 4 5] [1 2] [3] [4 5] [1 2 3] [ 4] [5] (actually for this case there is no solution - all cases have one subset of one element. ...

Hey everyone-- I'm pretty new to Python, & I need to do something that's incredibly simple, but combing my Python Cookbook & googling hasn't helped me out too much yet, and my brain is very, very tired & flaccid @ the moment.... I have a list of objects, simply called "list". I need to break it into an array (list of lists) wherein each sublist is the length of the variable "items_per_page". So array[0] would go from array[0][0] to array[0][items_per_page], then bump up to array[1][0] - array[1] [items_per_page], until all the items in the origin...

Hi all, i have a problem, i have a table like this: A | B ------------ 1 | 1 1 | 2 2 | 1 2 | 4 2 | 5 3 | 3 and a given set like C=('1', '2', '3'). I would to retrieve all A where B of A is a subset of the set C, in this example the result will be 1 and 3. Is this possible with low complexity and with a single query? Thanks, Igor Igor wrote: > Hi all, > > i have a problem, i have a table like this: > > A | B > ------------ > 1 | 1 > 1 | 2 > 2 | 1 > 2 | 4 > 2 | 5 > 3 | 3 >...

Hi, I have many set objects some of which can contain same group of object while others can be subset of the other. Given a list of sets, I need to get a list of unique sets such that non of the set is an subset of another or contain exactly the same members. Tried to do the following: s1=set(['a','b','c']) s2=set(['a','c']) s3=set(['a','d','e','f']) s4=set(['r','k','l']) s5=set(['r','k','l']) L=[s1,s2,s3,s4,s5] ----------------------- > cleaned-up list should contain s1,...

Hi guys I wanna calculate the correlation coefficient of all subsets of a given sets. I know how I can calculate the CC of each subset but the problem is that how I can extract all the subsets and found each subset contains which members of set. Best Regards Mojgan "Mojgan " <ariamahsa@yahoo.com> wrote in message <kkd1fk$i0u$1@newscl01ah.mathworks.com>... > Hi guys > > I wanna calculate the correlation coefficient of all subsets of a given sets. > I know how I can calculate the CC of each subset but the problem is that how I can extract all the ...

Hi, I have a list of data (type A) my list can includes element of type A or a lists, these list can includes element of type A or a lists, and so on ... is there a simple way to obtain a single list of all the elemets of type A ? thanks yomgui I forgot the most important, I am looking for a non recursive method. thanks yomgui yomgui wrote: > > Hi, > > I have a list of data (type A) > my list can includes element of type A or a lists, > these list can includes element of type A or a lists, and so on ... > > is there a simple way to obtain a single list of all the elemets > of type A ? > > thanks > > yomgui recursion. def get_As(L): res = [] for elem in L: if isinstance(elem, A): res.append(elem) elif isinstance(elem, list): res += get_As(elem) return res i also have a Tree class in my rc: http://home.comcast.net/~faulkner612/programming/python/pythonrc.py yomgui wrote: > Hi, > > I have a list of data (type A) > my list can includes element of type A or a lists, > these list can includes element of type A or a lists, and so on ... > > is there a simple way to obtain a single list of all the elemets > of type A ? > > thanks > > yomgui doh. ok, so, recursion is just functional programming sugar for a loop. def get_As(L): checking = [elem for elem in L if isinstance(elem, list)] # the equivalent of elem in recursion all_As =...

Hi, I like to have a SQL script which could update a table to set one attribute to a random value picked from a given list. The prototyping code is as below: select @value_list = ('John', 'David', 'Mathew', 'Paul') .... update EMP set emp_name = @random_name where ... where random name is randomly got from the given list. Of course there will be a cursor so that different row may have different random name but not necessary unique. Also the attribute and the list could be any valid common SQL data types Thanks! Ximing "Ximing Zheng" <xz...

Dear Mathgroup, I have a lsit of Lists of Lists: {{{1,2},{2,1},{1,1}},{{1,1},{1,1},{1,2}},{{2,1},{2,2},{1,2}},{{2,2},{1,2},{2,2}},{{1,1},{2,1},{1,2}},{{1,2},{2,2},{2,2}}} I would like to sort the elements in the lowest level of brackets to give {{{1, 2}, {1, 2}, {1, 1}}, {{1, 1}, {1, 1}, {1, 2}}, {{1, 2}, {2, 2}, {1, 2}}, {{2, 2}, {1, 2}, {2, 2}}, {{1, 1}, {1, 2}, {1, 2}}, {{1, 2}, {2, 2}, {2, 2}}} i.e retaining the same structure with the paired elements in the original order. I can't seem to get the syntax right to do this apart from the obvious {{Sort[{1,...

As part of an abduction procedure, see http://code.google.com/p/biohacker/source/browse/trunk/BPS/ltms/abduction.lisp if interested, I need to efficiently solve the following problem: Given an or-set of and-sets, for example, (:OR (:AND A B C) (:AND D E A)) and given a dictionary, where each element of an and-set is listed, with another or-set of and-sets as value, for example, A -> (:OR (:AND 1 2) (:AND 3 4)) B -> (:OR (:AND 2 3) (:AND 4)) C -> (:OR (:AND 1) (:AND 3)) D -> (:OR (:AND 1) (:AND 3 4)) E -> (:OR (:AND 1 2) (:AND 3)) find a new minimal or-set of and-set consistent,...

On 11/13/10 at 12:59 AM, leigh.pascoe@inserm.fr wrote: >I have a lsit of Lists of Lists: >{{{1,2},{2,1},{1,1}},{{1,1},{1,1},{1,2}},{{2,1},{2,2},{1,2}},{{2,2}, >{1,2},{2,2}},{{1,1},{2,1},{1,2}},{{1,2},{2, 2},{2,2}}} >I would like to sort the elements in the lowest level of brackets to >give >{{{1, 2}, {1, 2}, {1, 1}}, {{1, 1}, {1, 1}, {1, 2}}, {{1, 2}, {2, >2}, {1, 2}}, {{2, 2}, {1, 2}, {2, 2}}, {{1, 1}, {1, 2}, {1, 2}}, >{{1, 2}, {2, 2}, {2, 2}}} >i.e retaining the same structure with the paired elements in the >original order. I can't seem...

Hi, I am using AIX 5.3 with MP 7 and I am investigating the use of ACL=92s to assist in setting various security constraints. I have found that you can use ls and find to obtain a list of the objects that have ACL=92s applied to them. The command =93find=94 with the =93-ea=94 option appears to be the better option of the two. My question is: Is there any tool available on AIX that will keep a list of the objects and their applied ACL=92s in a file or files. I could write a script to do all of this by making use of find and aclget. However if there is already a tool or script etc that is...

How can I address via COM interface to existing instance of MATLAB from VBA. This construction doesnt work: Set matlab = GetObject(, "Matlab.Application") It is a bug or a feature? JackFrost wrote: > > > How can I address via COM interface to existing instance of MATLAB > from VBA. > > This construction doesnt work: > Set matlab = GetObject(, "Matlab.Application") > > It is a bug or a feature? Try to use FindWindow. > > Try to use FindWindow. HWND = FindWindowA("0", "MATLAB") it is possible to find handle of MATLAB ...

Hi, I am looking for a c callable function to search a path list for a given file. Many thanks in advance, Aaron On 7/28/2010 5:22 PM, Aaron Gray wrote: > Hi, > > I am looking for a c callable function to search a path list for a given > file. I think what you are after is globbing capabilities. http://www.gnu.org/s/libc/manual/html_node/Globbing.html#Globbing Does that link give you a head start for what you want? ...

Hi, I am having trouble with the following: I wish to have a list of lists of type Double called A. I then have a separate List of Doubles called B which i wish to add to A. I then want to be able to clear B and reuse it without clearing what I have added to A. Currently my code looks like: for(int i=0;i<seqLength;i++) { B.clear(); for(int j=i+1;j<seqLength;j++) { if(fourGameteTest(i,j)) { B.add(segPositions.get(j)); } } A.get(i).add(B); } However, it seems that due to, I guess the element held in A being a reference to the same pl...

how can detect some element of list is list o Atom?? for example when i try head (head p1) where p1=[[1,2],2] return 1 but when try head (head p1) where p1=[1,2] it returns Error plz help me..it my project and i have just 2 hours..:( i want to replace on Atom by another in list..for example: replace 1 2 [1,2] => [2,2] but sometime i have replace 1 2 [[1,2],2]=>[[2,2],2] i want to detect if first element of list is list then recurcively call head on that element.. is there any solutions?? On 8 Apr 2007 02:46:25 -0700, kheirandish.amin@gmail.com wrote: >how can detect some element of list is list o Atom?? (list? 42) --> #f (list? '(42 37)) --> #t Steve Schafer Fenestra Technologies Corp. http://www.fenestra.com/ in Haskell plz, not Scheme In article <1176025585.229021.233310@w1g2000hsg.googlegroups.com>, <kheirandish.amin@gmail.com> wrote: > how can detect some element of list is list o Atom?? What is an atom? That is term is not commonly used with Haskell. > for example > when i try head (head p1) where p1=[[1,2],2] return 1 > but when try head (head p1) where p1=[1,2] it returns Error It doesn't _return_ an error, but your expression fails to type-check. Haskell's lists are homogeneous, i.e. all the elements are of the same type. So either _all_ elements are lists (in which case the list of lists has type [[a]] for some type a), or none of them are (in which case the list has type [b] for some type ...

Hi, I want to have many lists, such as list0, list1, list2, ..., each one holding different number of items. Is there something like list[0] list[1] list[2] so that I can iterate through this list of lists? Thanks! bahoo On Apr 3, 7:12 pm, "bahoo" <b83503...@yahoo.com> wrote: > Hi, > > I want to have many lists, such as list0, list1, list2, ..., each one > holding different number of items. > Is there something like > list[0] > list[1] > list[2] > > so that I can iterate through this list of lists? > > Thanks! > bahoo listOfLists = [...

Hi, I have an ArrayList of ArrayLists. I want to extract all the lists, but I dont know how many ArrayLists will be in the ArrayList. I know I can do it if i know how many lists are there using the ArrayList get() method. this is how i'm doing it List<String> list1 = new ArrayList<String>(); list1 = res.get(0); List<String> list1 = new ArrayList<String>(); list2 = res.get(1); List<String> list1 = new ArrayList<String>(); list3 = res.get(2); But if theres only two lists in the list i get a NullPointerException Is there any way i can loop through the l...

Is there a way to convert list_of_listsA to list_of_listsB, where one list in listof lists A is one element of listB? list_of_listsA: [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['koe'], ['arm*', '*', '*(haar)'], ['groei*', '*', '*', '*', '*']] listB: ['klas* * *', 'mooi* * * *, 'koe', 'arm* * * (haar)', 'groei* * * * *'] Thankx! antar2 wrote: > Is there a way to convert list_of_listsA to list_of_listsB, where one >...

There must be a better way to multiply the elements of one list by another: a = [1,2,3] b = [1,2,3] c = [] for i in range(len(a)): c.append(a[i]*b[i]) a = c print a [1, 4, 9] Perhaps a list comprehension or is this better addressed by NumPy? Thanks, jab > There must be a better way to multiply the elements of one list by > another: > > a = [1,2,3] > b = [1,2,3] > c = [] > for i in range(len(a)): > c.append(a[i]*b[i]) > a = c > print a > [1, 4, 9] > > Perhaps a list comprehension or is this better addressed by NumPy? First of all: it's ...

How do I extract a list of lists from a user defined function and print the results as strings for each list? On Fri, 27 Jun 2003 01:44:42 GMT, Mike wrote: > How do I extract a list of lists from a user defined function Depends how that function is returning its values. The most obvious, and simplest way to do what you describe, is to have the function return a list of lists, as its return value. If you mean something else, you'll have to be more descriptive of what you actually want to do. > and print the results as strings for each list? The 'repr()' method of any o...

I've written a simple forum. The posts are lists of lists of lists... Each new list steps out the left margin. What happens is that after so many replies the lists get pushed too far right. I'd like to reset the list margin back to the beginning. for ex: ul > ul>ul> ul > ul... { margin-left: original thread left position; ??? position: absolute; left 0; } For ex: http://earlymorningreport.com/test_zig_zag_lists.html I would think this would not be an uncommon request. How now can we do this (other than that)? Jeff In article <jpom3b...

Can anyone tell me how can I make a list from all the first elements of the following pairs? l:=[[1,2],[3,4],[5,6],[7,8]] ; to get, m:=[1,3,5,7]; Thanks, Tony Connell "Tony Connell" <a.connell@galileo.karoo.co.uk> wrote in message news:vfk59prj7bp0fb@corp.supernews.com... > Can anyone tell me how can I make a list from all the first elements of the > following pairs? > > l:=[[1,2],[3,4],[5,6],[7,8]] ; > > to get, > > m:=[1,3,5,7]; > If you know the length of the list you could do like this: > m:=[seq(l[i][1], i=1..4)]; -Reidar Kind Tony Connell" <a.connell@galileo.karoo.co.uk> wrote: > Can anyone tell me how can I make a list from all the first elements of > the following pairs? > l:=[[1,2],[3,4],[5,6],[7,8]] ; map2(op, 1, l); "Tony Connell" <a.connell@galileo.karoo.co.uk> wrote in message news:vfk59prj7bp0fb@corp.supernews.com... > Can anyone tell me how can I make a list from all the first elements of the > following pairs? > > l:=[[1,2],[3,4],[5,6],[7,8]] ; > > to get, > > m:=[1,3,5,7]; m:=l[1..-1,1]; Alec Mihailovs http://webpages.shepherd.edu/amihailo/ "Reidar Kind" <s989788@stud.nhh.no> wrote in message news:A%oKa.13616$KF1.276672@amstwist00... > > "Tony Connell" <a.connell@galileo.karoo.co.uk> wrote in message > news:vfk59prj7bp0fb@cor...

HI, is it possible to have a list with Matlab ? for instance, distance = ['euclidean', 'seuclidean', 'cityblock', 'mahalanobis', 'minkowski', 'cosine', 'correlation', 'hamming', 'jaccard'] linkage =['single', 'complete', 'average', 'centroid', 'ward'] Late on I have to use commends like, for i=1:9 for j=1:5 Y=pdist(X, distance); Z=linkage(Y, linkage); %% to verify cluster tree using cophenet correlation coefficient c = cophenet(Z, Y) end end Bin Jiang wrote > HI, is i...

Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

The NSW Environment Minister says he will consider a recommendation from the state's Heritage Council to protect the iconic Sirius building on ...

The web site 'Cape Breton if Donald Trump Wins' continues to gain momentum, attracting international attention and drawing tens of thousands ...

Country Western Australia isn't the easiest place to secretly plot a potential $3 billion deal to list the nation's biggest grains exporter, ...

When Buddy Platform chose the Australian Stock Exchange (ASX) over U.S. venture capital firms, the Seattle startup raised more money at a higher ...

A listing on a reseller site out of Dubai has provided a few unique, close and personal photos of the LG G5 . Until today, we have seen the device ...

Researchers at New York University claim that Craigslist has a serious problem identifying fraudulent listings. After digging through two million ...

The listings "did not reflect Airbnb's vision for our community," Airbnb says. Airbnb admitted on Wednesday that it had deleted about 1,500 ...

... has just hit the market for $92 million. It is the most expensive asking price for a residence in San Diego County ever, according to the listing ...

... New York City hosts were innocently renting out their personal homes, Airbnb admitted yesterday that it did indeed remove “roughly 1,500” listings ...

Resources last updated: 3/9/2016 6:46:34 AM