questionproduce a function mult-stream that takes


Question

Produce a function mult-stream, that takes as input two arguments-

The first argument is a multiplier m, which is a positive integer.

The second argument is a stream strm of digits, representing digits in the decimal representation of a number between 0 and 1. You may suppose that number does not end in an infinite string of 9's.

The function mult-stream makes a stream which is the decimal representation of product of m with number represented by strm. Don't worry about where decimal point goes for this assignment. (Of course, in practice that would be very important! It's not at all hard to figure out, but it's not what I'm concerned about right here.)

Wherever in the course of doing this, you will probably need a function that you might want to name

number->list-of-digits
that takes a non-negative integer as input and returns the directory of single digits that make up decimal representation of that integer. There are a variety of ways to do this. One way is to use some of built-in Scheme functions that operate on strings and characters, such as
number->string
string->list
char->integer

If you do this, please be sure to notice that char->integer returns the ASCII value of a character, so if the character is "3", for instance, what is returned from char->integer is not the number 3. So you will have to alter for that as well.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questionproduce a function mult-stream that takes
Reference No:- TGS0444053

Expected delivery within 24 Hours