Last active
August 29, 2015 13:56
-
-
Save iduhetonas/9318958 to your computer and use it in GitHub Desktop.
Confused about the Ord class for multi-dimensional lists.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This makes sense | |
Prelude> max 1 2 | |
2 | |
-- So does this | |
Prelude> max [1] [2] | |
[2] | |
-- Not really sure about this. | |
Prelude> max [1,2] [1] | |
[1,2] | |
-- At first I assumed that it cuts off the extra dimensions, much like zip | |
Prelude> max [2,1] [1] | |
[2,1] | |
-- But then this doesn't make sense | |
Prelude> max [1,2] [1,2,4] | |
[1,2,4] | |
Prelude> max [1,2,4] [1,2] | |
[1,2,4] | |
-- Another example | |
Prelude> max [[1,2,3],[2,3,4]] [[1,2],[2,3],[2,4]] | |
[[1,2,3],[2,3,4]] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment