Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer using ML, thank you in advance for the help! 18. Write a function point_of_json of type json -> point option. If the argument

Please answer using ML, thank you in advance for the help!

image text in transcribed

18. Write a function point_of_json of type json -> point option. If the argument is a json object that contains fields named "latitude" and "longitude", both of which are json numbers, then point_of_json returns Some p where p is the point represented by these coordinates. Otherwise, it returns None. Solution is 5 lines and uses dot and nested patterns. 19. Write a function filter_access_path_in_rect of type string list -> rect -> json list -> json list. The output should be a subset of the third argument, containing exactly those elements of the input list that (1) have a field available via the given access path, (2) that field's contents are a JSON object that can be converted to a point via point_of_json, and (3) the resulting point is within the rectangle specified by the second argument. Sample solution is less than 15 lines. 18. Write a function point_of_json of type json -> point option. If the argument is a json object that contains fields named "latitude" and "longitude", both of which are json numbers, then point_of_json returns Some p where p is the point represented by these coordinates. Otherwise, it returns None. Solution is 5 lines and uses dot and nested patterns. 19. Write a function filter_access_path_in_rect of type string list -> rect -> json list -> json list. The output should be a subset of the third argument, containing exactly those elements of the input list that (1) have a field available via the given access path, (2) that field's contents are a JSON object that can be converted to a point via point_of_json, and (3) the resulting point is within the rectangle specified by the second argument. Sample solution is less than 15 lines

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

Discuss all branches of science

Answered: 1 week ago