BlogKontaktTagcloud

First Week FMFP

For the first week I got you some simple extra exercises. Most of them were already covered in the lecture or in the tutorial. But probably it might be helpful to repeat it by your own.

Start GHCi and define y and x by typing "let x= 31" and "let y=11". So now do some math with this directly in the GHCi-Console.

  • Add x and y
  • Subtract y from x
  • Multiply x and y
  • Divide 3 by 5
  • Divide x by y in such a way that you get the next lower Integer
  • Find the modulo of x divided by y
  • Get x to the power of y
  • Get the square root of x
  • Get the cube root of 27 (Hint: If you need help, look how the square root is defined in prelude)


Define the function for the n-th Factorial. You might try the different methods in haskell to get such a function.

Prove kn(<k1,k2>), kn({s}k1) |- kn(s) with the knowledge derivation rules in http://people.inf.ethz.ch/meiersi/teaching/fmfp10/tut-sheet1.pdf (that should be now really easy for you). Solve the knowledge proofs in this file without looking at the solution.

I will put up some solution for this some when next week.

Ähnliche Beiträge:
Solution First Week FMFP
Types inference FMFP
Third Week FMFP
Third Week FMFP
Proof by induction example
Comments (0)  Permalink

comments

add a comment

The Trackback URL to this comment is:
http://leo.freeflux.net/blog/plugin=trackback(2797).xml

Keine (weiteren) neuen Kommentare erlaubt.