Question: pls help with 5,6 SS CMSC 351 CMSC 330 ELMS Q5 OCaml Fill In The Blank 5 Points You are desperately searching for a PS5
pls help with 5,6


SS CMSC 351 CMSC 330 ELMS Q5 OCaml Fill In The Blank 5 Points You are desperately searching for a PS5 and have come across a handy database where you can check if a store has a PS5 in stock. However, this database uses OCaml records and types to structure information, and it's your job to write the appropriate functions to find which stores have a PS5. The store type is an OCaml record that is defined as follows: en com type store = {store_id: string; ps5_in_stock: bool) Here are the type definitions for map. fold_left, and fold_right: map : ('a -> b) -> 'a list -> 'b list fold_left: ('a -> 'b-> a) - a - b list -> 'a fold_right: ('a -> ' -> '0) -> 'a list -> b -> 'b Given a list of stores, fill in the blanks so that the store_quantity function will return the number of stores that have a PS5 in stock. For example: store_quantity {store_id="target_01"; ps5_in_stock-true); {store_id = "walmart_01"; ps5_in_stock = false}, {store_id = "gamestop_01"; ps5_in_stock - true}] B stores: let store_quantity stores - fold left A Enter your answer here B. Enter your answer here Q6 OCaml Coding CMSC 351 CMSC 330 quizl-solu ELMS WWW muamura Pagenerauery {store_id = "gamestop_01"; ps5_in_stock = true}] => 2 let store_quantity stores = fold_left A B stores; A Enter your answer here B Enter your answer here Q6 OCaml Coding 5 Points As you scour the Internet for information on PS5s, you run into another database which has slightly more information on PSS stock - it now includes quantity at each storel However, the data is not nicely structured and is given to you as a list of tuples. For example: [("target_0101", 5); ("walmart_0101", 3); ("gamestop_0101", 1)) Write a function find_large_stores, which takes an order:int, a (string - int) list of stores and quantities, and returns the list of stores that have enough PS5s (quantity >= order) for the order For example: find_large_stores 3 [("target_0101", 5); "walmart_0101", 3); ("gamestop_0101", 1) 1 --> { "target_0101"; "walmart_0101"] Enter your answer here Submit & View Submission> SS CMSC 351 CMSC 330 ELMS Q5 OCaml Fill In The Blank 5 Points You are desperately searching for a PS5 and have come across a handy database where you can check if a store has a PS5 in stock. However, this database uses OCaml records and types to structure information, and it's your job to write the appropriate functions to find which stores have a PS5. The store type is an OCaml record that is defined as follows: en com type store = {store_id: string; ps5_in_stock: bool) Here are the type definitions for map. fold_left, and fold_right: map : ('a -> b) -> 'a list -> 'b list fold_left: ('a -> 'b-> a) - a - b list -> 'a fold_right: ('a -> ' -> '0) -> 'a list -> b -> 'b Given a list of stores, fill in the blanks so that the store_quantity function will return the number of stores that have a PS5 in stock. For example: store_quantity {store_id="target_01"; ps5_in_stock-true); {store_id = "walmart_01"; ps5_in_stock = false}, {store_id = "gamestop_01"; ps5_in_stock - true}] B stores: let store_quantity stores - fold left A Enter your answer here B. Enter your answer here Q6 OCaml Coding CMSC 351 CMSC 330 quizl-solu ELMS WWW muamura Pagenerauery {store_id = "gamestop_01"; ps5_in_stock = true}] => 2 let store_quantity stores = fold_left A B stores; A Enter your answer here B Enter your answer here Q6 OCaml Coding 5 Points As you scour the Internet for information on PS5s, you run into another database which has slightly more information on PSS stock - it now includes quantity at each storel However, the data is not nicely structured and is given to you as a list of tuples. For example: [("target_0101", 5); ("walmart_0101", 3); ("gamestop_0101", 1)) Write a function find_large_stores, which takes an order:int, a (string - int) list of stores and quantities, and returns the list of stores that have enough PS5s (quantity >= order) for the order For example: find_large_stores 3 [("target_0101", 5); "walmart_0101", 3); ("gamestop_0101", 1) 1 --> { "target_0101"; "walmart_0101"] Enter your answer here Submit & View Submission>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
