If I have
List<String> text
how can I create a sub-list of all continious elements within a specific range e.g.
List<String> subList = /* all elements within text bar the first 2*/
Also are there any other useful List manipulation tips & tricks that might be useful?
...
I know that the map function takes each element of a list (a sequence) and applies a function to it. Recursively (and without respect to termination conditions, etc)
map(s, f) = f(s.head) :: map(s.tail, f)
I am looking for a function that does something like
foo(s, f) = f(s) :: map(s.tail, f).
So a 'mapper' where the mapping func...
I have two long list, one from a log file that contains lines formatted like
201001050843 blah blah blah <[email protected]> blah blah
and a second file in csv format. I need to generate a list of all the entries in file2 that do not contain a email address in the log file, while maintaining the csv format.
Example
Log file contains:
2...
In other languages (ruby, python, ...) I can use zip(list1, list2) which works like this:
If list1 is {1,2,3,4} and list2 is {a,b,c}
then zip(list1, list2) would return: {(1,a), (2,b), (3,c), (d,null)}
Is such a method available in .NET's Linq extensions?
...
I have a list of size < N and I want to pad it up to the size N with a value.
Certainly, I can use something like the following, but I feel that there should be something I missed:
>>> N = 5
>>> a = [1]
>>> map(lambda x, y: y if x is None else x, a, ['']*N)
[1, '', '', '', '']
UPD:
Thank you, all.
I decided to with the solution of ...
Hi guys,
As part of a bigger problem of enumerating a set, I need to write an OCaml function 'choose' which takes a list and outputs as the list of all possible sequences of size k made up of elements of that list (without repeating sequences which can be obtained from each other by permutation). The order they are put in the end list i...