Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to write on the OCaml... I'm not sure how to write the intro for each function. 1. In trees.ml: - Copy this line

I have to write on the OCaml... I'm not sure how to write the intro for each function.

image text in transcribed

1. In trees.ml: - Copy this line to the start of the file: Node of 'a * 'a tree * 'a tree - Write a function of type that returns a tree with one node. For example, is is Node ("2041", Leaf, Leaf) because the tree is a leaf. - Write a function of type that returns the rightmost datum in the tree. If the tree is only a leaf, it returns For example, (Node ("hello", Leaf, Node ("world", Leaf, Leaf))) is - is(Node(3. because the tree is a leaf. - Write a function of type that horizontally flips the tree. Grab a piece of paper to draw some trees. For example, , Node (2, Node (1, Leaf, Leaf), Leaf), Node (4, Leaf, Leaf))) is Node ( 3 , Node (4, Leaf, Leaf), Node (2, Leaf, Node ( 1 , Leaf, Leaf))) is ("hi", Leaf, Leaf)) is (the same as input) because it is symmetric Write a function of type ((a b bool) ' tree bool where checks whether there is any datum in the tree such that is . For example, is because the functional argument is - Try different predicates and trees! It is a useful skill to come up with new cases, and you are encouraged to share those cases with others

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions