Tag Info

New answers tagged

1

If you are using Mathematica 10 or later operator forms reduce the complexity of your syntax thereby reducing the chance for mistakes. Note that Function is eliminated here: SortBy[Extract[2]] /@ GatherBy[SomeData, First] {{{a, 1, 2}, {a, 2, 3}, {a, 3, 8}}, {{b, 1, 9}, {b, 2, 3}, {b, 3, 4}}, {{c, 1, 10}, {c, 2, 9}, {c, 3, 4}}} Since Sort will by ...


2

Try this: names = FileNames["*.txt"]; Export[StringInsert[#, "_output", -5], Sort /@ Import[#, "Table"][[2 ;;, 2 ;;]], "TSV"] & /@ names


1

Just for something different: list1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; list2 = {"It", "is", "only", "the", "morning", "the", "man", "complained", "I", "shall", "consider", "nothing"}; Join @@ Last@ Reap[MapThread[Sow[#2, Mod[#1, 3]] &, {list1, list2}], _, List@#2 &]



Top 50 recent answers are included