list

Merging list problem

Sorry about the bad heading, but the question was not easy to compress into one sentence... I have two lists of contigs (list1 and list2). They contain mostly unique contigs, but with some overlap. I want to compare list1 and list2 and then create a list3 that contains all contigs in list1 minus those also present in list2. Is this poss...

A set implementation in LaTeX?

Hi, Consider the following straightforward implementation of a list in latex: \newcommand{\add@to@list}[2]{% \ifx#2\@empty% \xdef#2{#1}% \else% \xdef#2{#2,#1}% \fi% }% I wonder if there is a simple way to implement a set (list with no repeated elements) ? ...

Relationship between instances of List<T>

Is there any way to tell via reflection that a generic list of Type A is related to a generic list of Type B? For example, I have a List<string> and a List<int>. How can I tell via reflection that both these types are 'instances' of List<T>. I think I'm having a problem because List<T> isn't a real type. You can't do typeof(List<T>) ...

Categorize a list of lists by 1 element in python

An example list of lists: [ ["url","name","date","category"] ["hello","world","2010","one category"] ["foo","bar","2010","another category"] ["asdfasdf","adfasdf","2010","one category"] ["qwer","req","2010","another category"] ] What I wish do to is create a dictionary -> category : [ list of entries ]. The resultant dictionary would...

Python and SQLite: insert into table

I have a list that has 3 rows each representing a table row: >>> print list [laks,444,M] [kam,445,M] [kam,445,M] How to insert this list into a table? My table structure is: tablename(name varchar[100], age int, sex char[1]) Or should I use something other than list? Here is the actual code part: for record in self.server: ...

passing list item in javascript

Hi All, Can anyone please tell me how can I pass a list item from one page to another in javascript? Thanks ...

jQuery - manipulate dropped element in sortable list

Hi there, I have a draggable list (.field) where you can drag & drop items from it into a sortable list (.sortlist). I did it this way because I didn't want the master list (.field) altered in any way. It works fine, except I cannot work out how to manipulate the dropped field in a sortable list. I can do it from a draggable into a dr...

C++ constructor and an initializer list

does C++ allow to initialize struct using initializer list, {}, if struct has a defined constructor? could not find an answer, but g++ does not seem to allow it. struct r { int a; }; struct s { int a; s() : a(0) {} }; r = { 1 }; // works s = { 1 }; // does not work ...

Get full directory contents with AppleScript

I need to get the entire (visible) contents of a folder and its subfolders as a list. Is this possible? ...

Scala, repeat a finite list infinitely

Hello guys, I want to use Stream class in scala to repeat a given list infinitely. For example the list (1,2,3,4,5) I want to create a stream that gives me (1,2,3,4,5,1,2,3,4,5,1,2,3....) So that I can wrap the take operation. I know this can be implemented in other ways, but I wanna do it this way for some reason, just humor me :) S...

Python List indexed by tuples

Hi, I'm a Matlab user needing to use Python for some things, I would really appreciate it if someone can help me out with Python syntax: (1) Is it true that lists can be indexed by tuples in Python? If so, how do I do this? For example, I would like to use that to represent a matrix of data. (2) Assuming I can use a list indexed by t...

linq query where int ID belongs to List<int>

Hello, I'm having a problem with a linq query. I have used this similarly before but i cannot understand what could be wrong now. Errors The best overloaded method match for 'System.Collections.Generic.List.Contains(int)' has some invalid arguments Argument '1': cannot convert from 'int?' to 'int' ; refers to the where clause ...

Question about LIST

hi how are you please someone tell me why some of LISTs have useful methods like FIND , WHERE or ... and some of them dont have these methods and how can i use these methods when those LISTs dont have ...

please help me understand the pattern match in haskell. i'm a little confused.

if i have somthing like that: func (x1:x2:x3:xs) = xs then x1,x2,x3 must exist, yes? they can't be [], but must(again, MUST) be with a value, yes? also, the xs can be [] or [a] or [a,a,a] (etc'), yes? (in [a] i mean that it's a list with one number, and [a,a,a] is list of three numbers). also i have function that define isPrefixOf: m...

Python: Elements not in a list

So heres my code: item = [0,1,2,3,4,5,6,7,8,9] for item in z: if item not in z: print item Z contains a list of integers. I want to compare item to Z and print out the numbers that are not in Z when compared to item. I can print the elemtens that are in Z when compared not items, but when i try and do the opposite using t...

WPF - Good Way to take a list to a Tree

I have a list that looks like this: Base/Level1/Item1 Base/Level1/Item2 Base/Level1/Sub1/Item1 Base/Level2/Item1 Base/Level3/Sub1/Item1 I would like an easy way put that into a ListView. (Ie similar to this) Base | +->Level1 | | | +=Item1 | +=Item2 | | | +->Sub1 | | | +=Item1 | +-...

how can I iterate over a nested .NET List<> in Visual Studio 2008's Crystal Reports?

I have a Crystal Report in Visual Studio 2008 (C#). Its datasource is set programmatically at run-time to a .NET list, defined as follows: List<visit_volume> Visits a visit_volume looks like this: public class visit_template { private int _numberOfVisits; public int numberOfVisits { get { return this._numberOfVis...

DataTable and List object comparison.

i m a part of an ERP solution team and want to measure the performance in terms of development. By a simple process a DataTable is populated from database with 10000 odd records and on other hand a List object is filled with the same records. my question is, which one is the lightweight and performance measurable object and why. ...

C# Generic List - FindAll on child Arrays

I'm trying to find the best approach to filtering a list with C# (3.5) but I can't seem to find any examples that are similar to my situation. I'm open to using lambdas or linq. The thing that is unique compared to most of the examples that I've found, is that my list items each have child arrays for example... var employees= new Lis...

C#: params keyword vs. list

What are the pro/cons of using the params keyword vs. a List as input to some c# function? Mainly what are the performance considerations and other trade offs. ...