Sorting a list of lists by a specific index of internal lists
I have a list that looks something like this:
[["Local 7" 1 "say" "Say: Inspect Fences"] ["Local 7" 1 "do" "Do: Shepherd Cows"] ["Local 6" 1 "say" "Say: Shepherd Cows"] ["Local 6" 1 "do" "Do: Shepherd Cows"] ["Local 6" 2 "say" "Say: Shepherd Cows"] ["Local 6" 2 "do" "Do: Shepherd Cows"] ["Local 7" 2 "say" "Say: Inspect Fences"] ["Local 7" 2 "do" "Do: Shepherd Cows"] ["Local 6" 3 "say" "Say: Shepherd Cows"] ["Local 6" 3 "do" "Do: Shepherd Cows"] ["Local 7" 3 "say" "Say: Inspect Fences"] ["Local 7" 3 "do" "Do: Inspect Fences"]]
I would like to sort the list item 1
. (I know this is already in the copy / paste version, but it may not always be.)
sort
just returns an empty list (I'm not even sure why, but I'm guessing it's a separate question) and sort-by
doesn't seem to work because it needs a reporter that resolves the boolean.
Is there a sane way to do this? Or do I need to first get a list of values ββthat I want to sort, then sort, and then loop over that list, creating a new list of values ββin the original list that matches the corresponding item value?
+3
source to share