You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
762 B
Haskell
29 lines
762 B
Haskell
4 years ago
|
sumSquareOrSquareSum :: (Ord a, Num a) => a -> a -> a
|
||
|
sumSquareOrSquareSum x y = (\sumSquare squareSum ->
|
||
|
if sumSquare > squareSum
|
||
|
then sumSquare
|
||
|
else squareSum) (x * 2 + y * 2) ((x + y) * 2)
|
||
|
|
||
|
doubleDouble :: Num a => a -> a
|
||
|
doubleDouble x = (\dubs -> dubs * 2) (x * 2)
|
||
|
|
||
|
overwrite :: Num p1 => p2 -> p1
|
||
|
overwrite x = (\x ->
|
||
|
(\x ->
|
||
|
(\x -> x) 4
|
||
|
) 3
|
||
|
) 2
|
||
|
|
||
|
inc :: Integer -> Integer
|
||
|
inc = (\x -> x + 1)
|
||
|
|
||
|
double :: Integer -> Integer
|
||
|
double = (\x -> x * 2)
|
||
|
|
||
|
square :: Integer -> Integer
|
||
|
square = (\x -> x ^ 2)
|
||
|
|
||
4 years ago
|
counter :: Num a => a -> a
|
||
4 years ago
|
counter x = (\x -> x + 1)
|
||
|
((\x -> x + 1)
|
||
|
((\x -> x) x))
|