Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HASKELL Using foldl, define a function num2int :: [Int] -> Int -> Int that converts a list of numbers and the number n into an

HASKELL

Using foldl, define a function num2int :: [Int] -> Int -> Int that converts a list of numbers and the number n into an integer of base n.

>num2int [3,4,5,6] 10

3456

>num2int [1,1,0,1,0,0,0,1,0,1,0,1,1,0] 2

3456

num2int :: [Int] -> Int -> Int

num2int x y = foldl (\acc (a,b) -> ___a___ + b*y^a) 0 (___b___ (\x y ->(x,y)) [0..] (___c___ x))

Choose the appropriate word to fill blank ___b__

X:XS

zipWith

zip

fold1

Choose the appropriate word to fill blank ___c___.

inverse

reverse

map

scanr

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

7. How might you go about testing these assumptions?

Answered: 1 week ago