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)) fill in blank spaces of a , b , and c
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)) fill in blank spaces of a , b , and c
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
Related questions
Question
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))
fill in blank spaces of a , b , and c
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning