Question: tail x num Type : int -> int -> int Description : Returns the last num digits of x. If there are fewer than num

tail x num

  • Type: int -> int -> int
  • Description: Returns the last num digits of x. If there are fewer than num digits in x, return x in its entirety.
  • Assumptions: num and x are both non-negative.
  • Examples:
tail 154 1 = 4 tail 154 2 = 54 tail 154 3 = 154 tail 154 4 = 154 tail 154 0 = 0

Should be implemented by Ocaml. Try several ways to approach but can't update local variable in else statement.

Can someone help? MUST USE RECURSION

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!