Question: 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!

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!