Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q2 - This is a non-recursive function that needs to be implemented, without using any List module functions. Using fold or map is optional, helper

Q2 - This is a non-recursive function that needs to be implemented, without using any List module functions. Using fold or map is optional, helper functions can be used. (below)

image text in transcribed

Note * -The implementation already on Chegg is wrong, and when I asked this question they copied it from Chegg

fold and map functions given :

image text in transcribed

jumping_tuples 1st1 1st2 - Type: ('a * 'b) list ( ('c * 'a) list 'a list - Description: Given two lists of two element tuples, lst1 and lst2, returns a list with the first element of every odd indexed tuple in 1st1, and the second element of every even indexed tuple in 151s2, interwoven together (starting from index 0 ). For this function, consider 0 as even. If the lists are not the same length, the resulting list should have the length of the shorter of the input lists. - Examples: jumping_tuples [(1,2);(3,4);(5,6)][(7,8);(9,10);(11,12)]=[8;3;12] jumping_tuples [( true,"a"); (false, "b") [(100, false )]=[ false ] jumping_tuples [("first", "second"); ("third", "fourth") ][( "fifth", "sixth"); ("seventh", "eighth")] = ["sixth"; "third"] jumping_tuples [][]=[] let rec map fxs= match xs with [][] x::xt(fx)::( map fxt) let rec fold f a xs = match xs with []a x::xtfoldf(fax)xt let rec fold_right fxs a = match xs with []a x:xtfx (fold_right fxta)

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions