Created
May 16, 2016 03:40
-
-
Save TangerineCat/93450b1ae160adddbf6b8114cbcdf93b 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
module Lab5 where | |
import Control.Monad | |
import Data.List | |
-- A.1 | |
hrSolutions :: [((Integer, Integer), (Integer, Integer), Integer)] | |
hrSolutions = do | |
i <- [1..] | |
j <- [1..i-1] | |
k <- [1..j-1] | |
l <- [1..k-1] | |
guard $ i^3 + l^3 == j^3 + k^3 | |
return ((i, l), (j, k), i^3 + l^3) |
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
Errors: 0, Warnings: 7, Hints: 0 | |
/home/ktang/Documents/lab5/lab5.hs: line 8, column 1: | |
Warning: The import of ‘Data.List’ is redundant | |
except perhaps to import instances from ‘Data.List’ | |
To import instances alone, use: import Data.List() | |
/home/ktang/Documents/lab5/lab5.hs: line 18, column 14: | |
Warning: Defaulting the following constraint(s) to type ‘Integer’ | |
(Integral b0) arising from a use of ‘^’ at lab5.hs:18:14 | |
(Num b0) arising from the literal ‘3’ at lab5.hs:18:15 | |
In the first argument of ‘(+)’, namely ‘i ^ 3’ | |
In the first argument of ‘(==)’, namely ‘i ^ 3 + l ^ 3’ | |
In the second argument of ‘($)’, namely | |
‘i ^ 3 + l ^ 3 == j ^ 3 + k ^ 3’ | |
/home/ktang/Documents/lab5/lab5.hs: line 18, column 20: | |
Warning: Defaulting the following constraint(s) to type ‘Integer’ | |
(Integral b0) arising from a use of ‘^’ at lab5.hs:18:20 | |
(Num b0) arising from the literal ‘3’ at lab5.hs:18:21 | |
In the second argument of ‘(+)’, namely ‘l ^ 3’ | |
In the first argument of ‘(==)’, namely ‘i ^ 3 + l ^ 3’ | |
In the second argument of ‘($)’, namely | |
‘i ^ 3 + l ^ 3 == j ^ 3 + k ^ 3’ | |
/home/ktang/Documents/lab5/lab5.hs: line 18, column 27: | |
Warning: Defaulting the following constraint(s) to type ‘Integer’ | |
(Integral b0) arising from a use of ‘^’ at lab5.hs:18:27 | |
(Num b0) arising from the literal ‘3’ at lab5.hs:18:28 | |
In the first argument of ‘(+)’, namely ‘j ^ 3’ | |
In the second argument of ‘(==)’, namely ‘j ^ 3 + k ^ 3’ | |
In the second argument of ‘($)’, namely | |
‘i ^ 3 + l ^ 3 == j ^ 3 + k ^ 3’ | |
/home/ktang/Documents/lab5/lab5.hs: line 18, column 33: | |
Warning: Defaulting the following constraint(s) to type ‘Integer’ | |
(Integral b0) arising from a use of ‘^’ at lab5.hs:18:33 | |
(Num b0) arising from the literal ‘3’ at lab5.hs:18:34 | |
In the second argument of ‘(+)’, namely ‘k ^ 3’ | |
In the second argument of ‘(==)’, namely ‘j ^ 3 + k ^ 3’ | |
In the second argument of ‘($)’, namely | |
‘i ^ 3 + l ^ 3 == j ^ 3 + k ^ 3’ | |
/home/ktang/Documents/lab5/lab5.hs: line 19, column 30: | |
Warning: Defaulting the following constraint(s) to type ‘Integer’ | |
(Integral b0) arising from a use of ‘^’ at lab5.hs:19:30 | |
(Num b0) arising from the literal ‘3’ at lab5.hs:19:31 | |
In the first argument of ‘(+)’, namely ‘i ^ 3’ | |
In the expression: i ^ 3 + l ^ 3 | |
In the first argument of ‘return’, namely | |
‘((i, l), (j, k), i ^ 3 + l ^ 3)’ | |
/home/ktang/Documents/lab5/lab5.hs: line 19, column 36: | |
Warning: Defaulting the following constraint(s) to type ‘Integer’ | |
(Integral b0) arising from a use of ‘^’ at lab5.hs:19:36 | |
(Num b0) arising from the literal ‘3’ at lab5.hs:19:37 | |
In the second argument of ‘(+)’, namely ‘l ^ 3’ | |
In the expression: i ^ 3 + l ^ 3 | |
In the first argument of ‘return’, namely | |
‘((i, l), (j, k), i ^ 3 + l ^ 3)’ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment