Discuss Scratch
- Discussion Forums
- » Suggestions
- » Sort lists!
- 8bitjake
- Scratcher
100+ posts
Sort lists!
Hey there, fellow Scratchers! 8BitJake here, and I want to suggest a new block for the List blocks:
The “Sort list by” block! This block would take any list and sort it by what you choose. The default is “recent.”
Example:
Here's how it could be used in an example script:
There could also be:
They could be used like this:
The “Sort list by” block! This block would take any list and sort it by what you choose. The default is “recent.”
Example:
sort [list v] by [sort type v]
Here's how it could be used in an example script:
when I receive [Show Scores v]
sort [scores v] by [greatest to least v]
show list [scores v]
There could also be:
([list v] sort type)and
<[ list v] is sorted by [sort type v] ?>
They could be used like this:
foreverWhat do you think???
if <[ list 1 v] is sorted by ([list 2 v] sort type) ?> then
say [Yay!]
end
end
- HighFlyer222
- Scratcher
100+ posts
Sort lists!
Semi-support. There were sorting algorithms made by users before, this will make that process a lot easier. But I think the last two will be hard to implement, because say if you have a list which is already sorted, but not with the block. What would happen? Also, is there a-z and z-a sort types? What would happen if you did those at a numerical list, or any sorting type on a random list including words and numbers?
(note: you can make the blocks look like they are on the list category by adding ::list next to them.)
(note: you can make the blocks look like they are on the list category by adding ::list next to them.)
Suggestions forum is love, suggestions forum is life
- 8bitjake
- Scratcher
100+ posts
Sort lists!
Semi-support. There were sorting algorithms made by users before, this will make that process a lot easier. But I think the last two will be hard to implement, because say if you have a list which is already sorted, but not with the block. What would happen? Also, is there a-z and z-a sort types? What would happen if you did those at a numerical list, or any sorting type on a random list including words and numbers?It would say “custom” when outputted. Here are all the sorts:
(note: you can make the blocks look like they are on the list category by adding ::list next to them.)
sort [list v] by [default (recent to most recent) v] ::list
sort [list v] by [a-z v] ::list
sort [list v] by [z-a v] ::list
sort [list v] by [numerical order v] ::list
sort [list v] by [custom... ] ::list
sort [list 1 v] by [sort type of...] ::list
sort [list v] by [reverse numerical order v] ::list
sort [list v] by [random sort v] ::list
sort [any list v] by [sort type v] ::list
Last edited by 8bitjake (May 12, 2020 16:20:18)
- PizzaAddict4Life
- Scratcher
1000+ posts
Sort lists!
I think this is a duplicate. Not sure where though
Projects
#SaveCubeupload | Kumquat Attack | Game in which you can submit your avatar
Studios
Be Moist | Forum Helpers
Topics
#RoadToMoist100
Press CTRL+SHIFT+DOWN after highlighting a bit of my signature to see the rest of my signature (and keep doing it)
Whats a stick?
If you suggest that the days since 2000 block is removed, you are going to feel the wrath of my TNT recklessness
My kumquat protectors: (~˘▾˘)~ ( ಠ ͜ʖರೃ) ( ಠ ͜ʖರೃ) ( ಠ ͜ʖರೃ) (◕‿◕✿) ( ಠ ͜ʖರೃ) ( ಠ ͜ʖರೃ) ༼ つ ◕_◕ ༽つ
Total Power: 35
Ok this is the end of my signature, but scroll down some more if you want some nice color hex codes.
Turquoise ish green: #17e67b
Epic nice blue: #0090c0
Cool light blue: #c4ffec, #a3ffe1, #85ffd7
Bippity Boppity Boo wow you found me congrats
#SaveCubeupload | Kumquat Attack | Game in which you can submit your avatar
Studios
Be Moist | Forum Helpers
Topics
#RoadToMoist100
Press CTRL+SHIFT+DOWN after highlighting a bit of my signature to see the rest of my signature (and keep doing it)
Whats a stick?
If you suggest that the days since 2000 block is removed, you are going to feel the wrath of my TNT recklessness
My kumquat protectors: (~˘▾˘)~ ( ಠ ͜ʖರೃ) ( ಠ ͜ʖರೃ) ( ಠ ͜ʖರೃ) (◕‿◕✿) ( ಠ ͜ʖರೃ) ( ಠ ͜ʖರೃ) ༼ つ ◕_◕ ༽つ
Total Power: 35
Ok this is the end of my signature, but scroll down some more if you want some nice color hex codes.
Turquoise ish green: #17e67b
Epic nice blue: #0090c0
Cool light blue: #c4ffec, #a3ffe1, #85ffd7
Bippity Boppity Boo wow you found me congrats
- Maximouse
- Scratcher
1000+ posts
Sort lists!
I think just
sort [list v] :: listwould be enough: it would sort using the
<[] < []>and
<[] > []>operators. This means that numbers would be automatically sorted in numerical order and text in alphabetical order. A
reverse [list v] :: listblock would also be useful.
- Discussion Forums
- » Suggestions
- » Sort lists!