First homework focused on Haskell basics with using GHCi, Hayoo, 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 trapezoid with bases a and b, and height h.
- 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
infoReversed "cba"
should give"abc is reversed cba"
. 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 euclidean distance of 2 2D points with coords
x1
,y1
andx2
,y2
. - Function to convert natural number to binary string. You should use prepared condition in combination with recursion. Condition
if <cond> then <A> else <B>
is just an expression and you can do this like:(if a < 5 then 7 else 2) * 7
. - Lookup a function that splits string into words by whitespaces. Write the function name instead of
undefined
(assign it, not as string). - Lookup and write the type of function
all
(Prelude
) as string. For example, type ofodd
would be"Integral a => a -> Bool"
. - Lookup and write the name of
aeson
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 ;-)
- In case of uncertainty, check the dummy homework to recall what is the homework workflow for this course.
- If you encounter some trouble, create an issue in your repository.
- In case you find abug 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.