Expand append
examples and add match
example
#1083
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in nushell/nushell#10486 Some more examples of the various ways to append things to lists/strings/tables would be appreciated. In addition,
str append
was a nice exmaple of how to usematch
and also pattern match on types.This PR adds more examples on the appending in the appropriate sections (specifically more on using the ++ operator which was previously not mentioned).
str append
is also added to the cookbook and expanded upon somewhat. In the linked issue "vectorisation" was also mentioned but I wasn't quite sure how/what part of thestr append
that refers to so I didn't mention that. If someone can explain that part to me and thinks it would be useful to also add, I'd be happy to do so.Finally I think instructions on how to add new pages to the cookbook were outdated (at least as far as I could tell) so I updated that as well in accordance with how I did it. If this is incorrect, Let me know how it should be done instead and I'll happily change it up