Question
Using foldl, define a function dec2int :: [Int] $\rightarrow$ Int that converts a decimal number into an integer. For example:dec2int $[2,3,4,5]$2345
Step 1
We can use the `reverse` function for this. Next, we need to define a helper function that takes an accumulator and a digit, and returns the updated accumulator. The accumulator will keep track of the current value of the decimal number. The helper function can Show more…
Show all steps
Your feedback will help us improve your experience
Watch the video solution with this free unlock.
EMAIL
PASSWORD