Last active
August 29, 2015 14:26
-
-
Save ElvishJerricco/a4241a406743f599f1b5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| index :: l <: [a] - ([]) -> i <: { n <- Int | n < length l; n >= 0 } -> { -- notice the shortcutting, | |
| -- using the l type as an argument to length instead | |
| -- of having to bind l to a name as a foreach. | |
| case (l, i) of -- similar shortcutting | |
| (x:xs, 0) = x | |
| (x:xs, n) = index xs (n - 1) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment