.:: tl Exercise: quadrant [*] y-aris 10 + Complete the quadrant function below, which should return the quadrant of the

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

.:: tl Exercise: quadrant [*] y-aris 10 + Complete the quadrant function below, which should return the quadrant of the

Post by answerhappygod »

Tl Exercise Quadrant Y Aris 10 Complete The Quadrant Function Below Which Should Return The Quadrant Of The 1
Tl Exercise Quadrant Y Aris 10 Complete The Quadrant Function Below Which Should Return The Quadrant Of The 1 (117.11 KiB) Viewed 50 times
.:: tl Exercise: quadrant [*] y-aris 10 + Complete the quadrant function below, which should return the quadrant of the given x, y point according to the diagram on the right (borrowed from Wikipedia). Points that lie on an axis do not belong to any quandrant. Hints: (a) define a helper function for the sign of an integer, (b) match against a pair. II I P(3,5) T-aris - 10 -5 V 10 type quad = I II III IV type sign = Neg | Zero Pos (0,0) origin III IV let sign (x:int) : sign = - 10 + let quadrant : int*int -> quad option = fun (x,y) -> match ... with -> Some I -> Some II -> Some III 1 -> Some IV -> None Exercise: quadrant when [**] Rewrite the quadrant function to use the when syntax. You won't need your helper function from before. let quadrant_when : int*int -> quad option = function ... when ... -> Some I I... when ... > Some II ... when -> Some III when -> Some IV -> None Exercise: depth [**] Write a function depth : 'a tree -> int that returns the number of nodes in any longest path from the root
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply