FP Laboratory 3

From Marek Běhálek Wiki
Revision as of 10:46, 17 September 2019 by Beh01 (talk | contribs) (Created page with "== Simple functions working with list == Implement following functions: * Create a function that computes length of a list. <syntaxhighlight lang="Haskell">length :: [a] -> I...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Simple functions working with list

Implement following functions:

  • Create a function that computes length of a list.
length :: [a] -> Int
  • Create a function that sums the list of integers.
sumIt :: [Int] -> Int
  • Create a function that merge two lists into one list.
combine :: [a] -> [a] -> [a]
  • Create a function that reverse a list.
reverse :: [a] -> [a]
  • Create a function that merge two lists into one list.
combine :: [a] -> [a] -> [a]
  • Create a function that product scalar multiplication if two vectors.
scalar :: [Int] -> [Int] -> Int
  • Create a function that find the smallest element in the list. Consider input restrictions.
minimum :: [a] -> a -- Is this right?
  • Find all prime divisors of a given number.
divisors :: a -> [a]