Question: WRITE IT IN HASKELL Using the addition function over the natural numbers, give a recursive definition of multiplication of natural numbers. Question The integer square
WRITE IT IN HASKELL
Using the addition function over the natural numbers, give a recursive definition of multiplication of natural
numbers.
Question The integer square root of a positive integer is the largest integer whose square is less than or
equal to n For instance, the integer square roots of and are and respectively. Given a primitive
recursive definition of this function.
Question Give a recursive definition of a function to find the highest common factor of two positive
integers.
Question Give a definition of the function below
orderTriple : : Integer Integer, IntegerInteger Integer, Integer
which puts the elements of a triple of three integers into ascending order.
Question Define a function to give the length of the perimeter of a geometrical shape, of type Shape. What
is the type of this function?
Question Add an extra constructor to Shape for triangles, and extend the functions isRound, area and
perimeter to include triangles.
Question Give a definition of a function below, which triples all the elements of a list of integers.
tripleAll : : IntegerInteger
Question Give a definition of a function which converts all small letters in a String into capitals, leaving the
other characters unchanged.
capitalize : : String String
Question Define the function below, which returns the list of divisors of a positive integer and the empty
list for other inputs For instance, divisors
divisor : : Integer Integer
Question A prime number is a number whose only divisors are and Using divisors or otherwise define
a function which checks whether or not a positive integer is prime and returns False if its input is not a
positive integer
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
