-
-
Notifications
You must be signed in to change notification settings - Fork 79
Sorting concept #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting concept #1073
Conversation
depial
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good! Just a couple of minor suggestions and a possible switch in an example.
With the exclusion of broadcasting, I think that there is enough in Ranges to have this follow. I'd imagine that we'll end up deleting the bits on multi-dimensional sorting in the introduction.md but everything else seems to be at an appropriate level.
| 'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase) | ||
| 'l': ASCII/Unicode U+006C (category Ll: Letter, lowercase) | ||
| 'u': ASCII/Unicode U+0075 (category Ll: Letter, lowercase) | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not too much information, an example I have found useful is something like:
julia> tups = [(1, 3), (4, 2), (3, 4), (2, 1)];
julia> sort(tups, by=last)
4-element Vector{Tuple{Int64, Int64, Int64}}:
(2, 1)
(4, 2)
(1, 3)
(3, 4)This also kinda gives a nice segue to the multi-dimensional arrays part.
Full example
julia> tups = [(1, 3), (4, 2), (3, 4), (2, 1)];
julia> sort(tups)
4-element Vector{Tuple{Int64, Int64, Int64}}:
(1, 3)
(2, 1)
(3, 4)
(4, 2)
julia> sort(tups, by=last)
4-element Vector{Tuple{Int64, Int64, Int64}}:
(2, 1)
(4, 2)
(1, 3)
(3, 4)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to About, with a forward-reference to the Tuples concept. I think it's too advanced for the Introduction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! I'd forgotten about where Tuples come in. We could change this to Vectors and get the same effect:
julia> vecs = [[1, 3], [4, 2], [3, 4], [2, 1]];
julia> sort(vecs) # by default sorts by the first element of the vectors
4-element Vector{Vector{Int64}}:
[1, 3]
[2, 1]
[3, 4]
[4, 2]
julia> sort(vecs, by=last)
4-element Vector{Vector{Int64}}:
[2, 1]
[4, 2]
[1, 3]
[3, 4]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there might be a stray "about" in the last line:
The final example about will be explained in more detail in the [Tuples Concept][concept-tuples].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I'm fine with tuples for now. Let's wait and see what the exercise ends up needing: this bit may end up being removed from the Introduction regardless.
I'd already done that. I just checked, and I'd really done that (apart from a stray URL in the references), not just imagined it! |
Sorry about that! I was operating under the (unjustified) assumption that |
|
The Introduction appears on the website under my own account, and the About in incognito - nice! I'll read through them again to see what typos slipped through. |
An attempt to address issue #1043.
Placing this in the syllabus will be an interesting challenge. We want it fairly early, to introduce students to mutating and non-mutating functions. On the other hand, the About touches on a wild variety of more advanced concepts, which we'll need to work around.
I'm tentatively thinking the sequence will be either
Ranges -> Sorting -> Vector OperationsorVector Operations -> Sorting -> Functions.Maybe this will be clearer once we have an exercise? I haven't found anything on another track that covers specifically this topic.