Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

functional programming in haskell 5. (a) What is the type of the following unknown6 function? Give the most general type and include any required class

functional programming in haskell

5. (a) What is the type of the following unknown6 function? Give the most general type and include any required class constraints. The ($) is the low-precedence application operator. (I give several versions below, with and without the $).

> unknown6 m n = take m (map ($ n) . map (*) $ [1..]) > unknown6' m n = take m (map (\f -> f n) . map (*) $ [1..]) > unknown6'' m n = take m ((map (\f -> f n) . map (*)) [1..])

(The 3 definitions above are identical. Use whichever one you are comfortable with ). Note: *Main> ($5)(*)2 <-- prefix notation 10 *Main> (*)2$5 <-- infix notation 10 *Main> (\f -> f 5) (*2) <-- prefix notation 10 *Main>

(b) Give a description of what the unknown6 function in part (a) does. Describe what it does, not how it works.

(c) Give a non-trivial test case for the unknown6 function in part (a) and show the expected results.

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

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago