[Solved] Write this Scala Matrix multiplication in Haskell [duplicate]

It’ll be perfectly safe with a smart constructor and stored dimensions. Of course there are no natural implementations for the operations signum and fromIntegral (or maybe a diagonal matrix would be fine for the latter). module Matrix (Matrix(),matrix,matrixTranspose) where import Data.List (transpose) data Matrix a = Matrix {matrixN :: Int, matrixM :: Int, matrixElems :: … Read more

[Solved] Function double in haskell

Here are a few hints foldAEB2 Nil Un Conc is the identity function foldAEB2 Nil Un Conc :: AEB2 a -> AEB2 a Un :: a -> AEB2 a \a -> Conc (Un a) (Un a) :: a -> AEB2 a 4 solved Function double in haskell

[Solved] I cannot execute my Haskell code [closed]

You have a couple of typos in your imports. I think you mean: import Data.List import System.IO primeNumbers = [3,5,7,11] morePrime = primeNumbers ++ [13,17,19] i.e. Data.list should be Data.List and Syste.IO should be System.IO. 3 solved I cannot execute my Haskell code [closed]

[Solved] Couldn’t match type Synonym with Either

Either isn’t simply a union of types; it’s a tagged union, which means every value has to explicitly specify which “side” of the type the wrapped value occurs on. Here’s an example, (with a Show instance derived for your Card type): *Main> Card Hearts Jack <interactive>:3:13: error: • Couldn’t match type ‘Court’ with ‘Either Pip … Read more

[Solved] Haskell: Given a list of numbers and a number k, return whether any two numbers from the list add up to k

There are following approaches. 1) Create a list pf pairs which are all combinations [(10,10),(10,15),..,(15,10),(15,3)..]. Now you can use simple any function on this list to check if any pair add up to given number. getCoupleList :: [a]->[(a,a)] getCoupleList [] = [] getCoupleList [x] = [] getCoupleList (x:xs) = map (\y->(x,y)) xs ++ getCoupleList xs … Read more