Great idea!monte wrote:While we are pondering on filter it would be nice to consider arrays:
Code: Select all
filter [keys|elements of] <container> [ not ] matching [ pattern ] <pattern>
Pete
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark
Great idea!monte wrote:While we are pondering on filter it would be nice to consider arrays:
Code: Select all
filter [keys|elements of] <container> [ not ] matching [ pattern ] <pattern>
Code: Select all
foo,bar
baz,qux
Code: Select all
filter items of theList with "b*"
Code: Select all
bar
baz
Code: Select all
foo,bar,bad
baz,qux
Code: Select all
bar
bad
baz
Code: Select all
bar,bad
baz
Code: Select all
bar,bad
baz
Code: Select all
foo,bar,bad
baz,qut
Code: Select all
bad
baz,bar,foo,qut
OK, I understand now, thanks Bjornke. I redid the test with just one line in the variable and ti worked as expected with the items in the correct sorted order.BvG wrote:sort items ignores lines. just as sort lines ignores words. If you want to sort stuff that contains lines by item, it's your job to make sure that you only sort within those lines, not the engines. You specified items, and that's what you get
Similar, if you filter by items, it's not the engine's job to care wether you're using lines or not. So sorting a multi-line item list will be confusing (and only usefull in very rare corner cases), but sorting a list of items will work just fine.
At least that's what I'd expect.
Code: Select all
filter lines of theList with "b*" by chunkExpression of each
Yep, that's pretty much it, but I think that's destined for phase II.monte wrote:Hmm... I don't think I've ever used sort items on a multi-line container. My guess is the intention of sort items is for single lines containers. For multi-line containers we probably want:
Code: Select all
filter lines of theList with "b*" by chunkExpression of each
Code: Select all
filter theList by item 2 of each begins with "b"
filter lines of theList by MyFilterFunction(each)