Skip to main content

Timeline for Gather list elements by labels

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Jul 15, 2013 at 17:10 comment added Pinguin Dirk ok :) it's not code golfing, and I'd have chosen the same approach! +1
Jul 15, 2013 at 17:07 comment added sebhofer @PinguinDirk Sure that also works, I would contest it's shorter though. You can do Sort[GatherBy[Transpose[{labels, list}], First], #1[[1, 1]] < #2[[1, 1]] &][[All, All, 2]] then it is shorter, but only by 7 keystrokes :)
Jul 15, 2013 at 16:55 comment added Pinguin Dirk Another idea for the sorting might be: Sort[GatherBy[Transpose[{labels, list}], First], First@#1[[1]] < First@#2[[1]] &][[All, All, 2]] (possibly slower than your ideas, but at least it's rather short :) )
Jul 15, 2013 at 14:25 history edited sebhofer CC BY-SA 3.0
Jul 15, 2013 at 13:44 comment added sebhofer @tchronis I realised this is easy to change, see my edit.
Jul 15, 2013 at 13:43 history edited sebhofer CC BY-SA 3.0
added 421 characters in body
Jul 15, 2013 at 13:39 comment added tchronis Thank you @sebhofer. Yes the non sorted drawback matters in my case.
Jul 15, 2013 at 13:30 history answered sebhofer CC BY-SA 3.0