(def keep-cols (cols tabl) ;for one row (map [let nr -1 (keep [some (++ nr) cols] _)] tabl)) (def get-cols (cols tabl) ;table with selected columns (withs ((head . rows) tabl colnrs (rem nil (map [pos _ head] cols)) filtered-rows (keep-cols colnrs rows)) (cons cols filtered-rows))) ;test (get-cols '(foo baz) '((foo bar baz) ;header (bla bla spam) (eggs ham bacon) (lorem ipsum test)))
I'm going to step through some of the syntax; I haven't been using: map, [], or "." yet.
Thanks, T.
-----