Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f1 = Mod[#, 4] &;
- f2 = Mod[#, 7] &;
- SortBy[Range@10, {f1, f2}]
- {#, f1@#, f2@#} & /@ % // Grid
- {8, 4, 1, 9, 5, 2, 10, 6, 7, 3}
- string = {"cat", "fish", "catfish", "Cat"};
- Sort[string]
- out: {"cat", "Cat", "catfish", "fish"}
- ToCharacterCode[string]
- out: {{99, 97, 116}, {102, 105, 115, 104}, {99, 97, 116, 102, 105, 115,104}, {67, 97, 116}}
- SortBy[ToCharacterCode[string], First]
- out: {{67, 97, 116}, {99, 97, 116}, {99, 97, 116, 102, 105, 115, 104}, {102, 105, 115, 104}}
- FromCharacterCode[
- SortBy[ToCharacterCode[string], First]
- ]
- out: {"Cat", "cat", "catfish", "fish"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement