Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
accessing
sortEntries

entries sort: [:aEntry :bEntry | | aPriority bPriority |
aPriority := aEntry matchNarrowString: narrowString.
bPriority := bEntry matchNarrowString: narrowString.
aPriority = bPriority
ifTrue: [aEntry <= bEntry]
ifFalse: [aPriority >= bPriority]]
| seen |
entries sort:
[:entry | entry matchNarrowString: narrowString] descending
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, cool, no idea #descending worked on BlockClosure 👍

, [:aEntry :bEntry | aEntry <= bEntry ifTrue: [-1] ifFalse: [0]]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the , operator on BlockClosure come from???
Is that new? It doesn't work on my system.

Or am I reading the syntax incorrectly?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, descending returns a PropertySortFunction that can be comma-chained...
That's wild 😅, but okay.

, [:aEntry :bEntry | (aEntry contents compare: bEntry contents caseSensitive: ECPreferences caseSensitive) - 2].

"remove any duplicates"
seen := Set new.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind removing duplicates, as discussed in #39 , duplicates are just a side-effect of adding all selectors in the untyped model.
There's no real point in displaying them.

How is performance though? First sorting, then converting into a Set sounds a bit expensive 🤔
Especially in the untyped model that contains all selectors.

entries removeAllSuchThat: [:entry |
(seen ifAbsentAdd: entry contents) not].
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"resetSelectors" : "ul 9/26/2010 19:23",
"selectorsAsSymbols" : "LM 3/20/2019 15:23",
"setClass:" : "bar 1/6/2005 08:54",
"sortEntries" : "LM 4/9/2019 16:37",
"sortEntries" : "ct 12/21/2023 20:27",
"theClass" : "bar 3/1/2006 15:48",
"title" : "bar 12/6/2004 14:44",
"toggleExpand" : "bar 12/5/2004 23:17" } }