Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IntSet (IN ML) module is an abstract data types for sets of integers, represent by type t module type INTSET = sig type t val

IntSet (IN ML) module is an abstract data types for "sets of integers", represent by type t

module type INTSET = sig

type t

val empty : t

val contains : int -> t -> bool

val insert : int -> t -> t

val remove : int -> t -> t

val fold : ('a -> int -> 'a) ->

'a -> t -> 'a

val to_string : t -> string

end

Question: complete module implementation IntSet1 in the "todo section", in your implementation of fold, follow the order of elements in the list. Note that insert can cause duplicates to be in the list.

module IntSet1 : INTSET = struct

type t = int list

let empty = [ ]

let contains = List.mem

let insert = List.cons

let remove = fun _ -> //todo

let fold = fun _ ->//todo

let to_string = fun _ -> //todo

end

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

WHAT IS AUTOMATION TESTING?

Answered: 1 week ago

Question

What is Selenium? What are the advantages of Selenium?

Answered: 1 week ago

Question

Explain the various collection policies in receivables management.

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago