Skip to content

Instantly share code, notes, and snippets.

@iduhetonas
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iduhetonas/9318958 to your computer and use it in GitHub Desktop.
Save iduhetonas/9318958 to your computer and use it in GitHub Desktop.
Confused about the Ord class for multi-dimensional lists.
-- 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