Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to write a SML recursive function called mergePass that will take a list of list and merge pairs of the list. The

I am trying to write a SML recursive function called mergePass that will take a list of list and merge pairs of the list. The number of sublist does not have to be even for example: mergePass([[24],[39],[50],[28],[50],[1],[15],[1],[35],[40],[9],[8],[25],[1],[2]]) returns [[24,39],[28,50],[1,50],[1,15],[35,40],[8,9],[1,25],[2]]

mergePass([[24,39],[28,50],[1,50],[1,15],[35,40],[8,9],[1,25],[2]]) returns [[24,28,39,50],[1,1,15,50],[8,9,35,40],[1,2,25]]

I have this section of code I was trying out hd(x)@hd(tl(x)). If I was to enter [[1],[9],[7],[12]] or any other list of list in place of x it would give me back [1,9] but I need to recursively be able to go through the rest of the list and make other pairs This may not be the only or easiest way to do it but it is all I can come up with

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago