First homework focused on Haskell basics with using GHCi, Hackage, Stackage, and Hoogle
Open src/Lib.hs
and implement 10 tasks. You can also check the specification in test/Spec.hs
and run the tests with stack test
.
- Math expression to compute area of convex regular polygon of n sides with size s.
- Boolean expression to check whether given year is leap (has 366 days). Check wikipedia for the rules. Solution with hardcoded years or branching won't be accepted.
- String expression to create info string about reversing given string. For example
infoBackwards "cba"
should give"'abc' is 'cba' backwards"
. Lookup needed function fromPrelude
or guess it. - Function to count number of digits of an integer. It is not needed to use any conditions or recursion, just a combination of functions.
- Math expression to compute Manhattan distance of 2 2D points with coords
x1
,y1
andx2
,y2
. - Function to compute Hamming distance of two strings (that are basically lists of chars). You can use the prepared pattern to avoid using
head
andtail
functions and conditions. - Lookup a function that splits strings by newlines. Write the function name instead of
undefined
(assign it, not as string). Do not reinvent the wheel (i.e. do not implement on your own)! - Lookup and write the type of function
filter
(Prelude
) as a string. For example, type ofodd
would be"Integral a => a -> Bool"
. - Lookup and write the name of
bitvec
package author. For example, forQuickCheck
it would be"Koen Claessen"
. - You need a function that pluralizes given english world. Of course such function is already implemented. Look it up and assign it as in task 7. You may need to add new dependency and import the module as was described in the first lesson. Do not implement the function on your own! (You might find out that used package is not perfect, you can contribute and improve it later on ;-)
- If you encounter some trouble, create an issue in your repository.
- In case you find a bug or have an idea how to improve assignment project, create an issue or PR in this repository.
This project is licensed under the MIT License - see the LICENSE file for more details.