Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here is a helper dot functions Please help me i was struggling with this questions thank you so much!!! let rec assoc (k, xs) =

here is a helper dot functions

Please help me i was struggling with this questions thank you so much!!!

let rec assoc (k, xs) =

match xs with

| [] -> None

| (k1,v1)::t ->if(k = k1) then Some v1 else assoc(k,t)

(* 9 *)

let dot (j, f) =

match j with

| Object o -> assoc(f, o)

| _ -> None

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 "Iongitude", 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. 20. After your definition of filter_access_path_in_rect, write a comment containing 1-3 sentences describing the similarities with filter_access_path_value. Can you think of any way to refactor these two function to use a common, more general function? (Do not actually do this refactoring.) On a scale from 1 to 10 , how annoyed are you about having to write both of these functions on the same

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions