How to select a variable number of columns of a table and return a table?

Please see this table, which is – of course – a list of lists.

I have built a function to extract several rows out of a table and return a table which just contains the selected elements of the list/table.

Now its easy to select a single column of a table:

What I am looking for is a function, which returns only selected columns as a table.

I could map 2 columns with a list constructur and would get 2 columns.

But this is limited to 2 elements.
So I don’t know how to create a list constructor with dynamically determined slots
and a variable number of maps according to number of selected columns.

I have built a function which creates result list 1 with a variable number of rows as a selection list. So that works.This is the first step in the function below.

BUT then I have to turn the rows into columns and there I am lacking again a way to dynamically create a list with a variable number of colomns.
So I end up ONLY with 2 columns again, because I dont know how to add a variable number of items to result list 2.

I am just thinking, that there must be any easy way like mapping an element selection of a list/table over some numbers like it works for the rows:


I guess its just my lack of experience with HOF and thinking functional algorithm design.

Hi Matthias @kimmie46,

I suggest you to play with "keep".

An example...
To pick rows (directly, because rows are the "first inner element")


And to pick columns (a little longer, because you must "enter into rows" previously)

Using keep you can apply different criteria (odd/even, multiple of, searching content...)


You know how to do this:

But you didn't make a function as I've done; you just put MAP blocks in your larger code. But once you have the function it's pretty easy to say

where COLS is a list of column numbers. (If you want a contiguous range, just use the NUMBERS FROM block as the input here.)

It can be done without making a COLUMN procedure, but it's harder:

When you have a MAP inside a MAP, you can't use an empty input slot to mean sometimes the inner MAP and sometimes the outer one, so instead you have to give the outer one an explicit formal parameter (input name).

Thank you so much for your kind help!

Thank you so much, this is what I was looking for.