Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OCAML! (* infinite precision natural numbers can be represented as lists of ints between 0 and 9 Write a function that takes an integer and

OCAML! (*

infinite precision natural numbers can be represented as lists of ints between 0 and 9

Write a function that takes an integer and represents it with a list of integers between 0 and 9 where the head

of the list holds the least signifigant digit and the very last element of the list represents the most significant digit.

If the input is negative return None. We provide you with some use cases:

For example:

toDec 1234 = Some [4; 3; 2; 1]

toDec 20 = Some []

toDec -1234 = None

*)

(* Hint use

mod 10

/ 10

*)

let rec toDec (i : int) : int list option = failwith "unimplemented"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago