As we discussed in previous sections, transducers are a way to compose algorithmic transformations over iterable objects; to see this in action, let's first use a transducer in the most simple iterable object, an array.
To run a transducer over an array we first need a method to run a given transformation in a given iterable object.
For this we use the into() method, which has the following signature:
transducers.into(emptyIterable,transformation,iterable)
It receives three parameters and they are all mandatory:
- emptyIterable: It is an empty iterable used to store the result of the application of the transformation over the iterable object
- transformation: It is the function or transducers to be applied over the iterable object
- iterable: It is the iterable object to be transformed
With the usage of this function we can implement transformations over an array, let's see how we can implement...