Question: Write a Scala function transform. It should take a Traversable[ A=>A ] and a Traversable[A] as its arguments, returning a Traversable[A]. (Traversable is a superclass
Write a Scala function transform. It should take a Traversable[ A=>A ] and a Traversable[A] as its arguments, returning a Traversable[A]. (Traversable is a superclass of List, ListBuffer, Array, IndexedSeq, etc. You can use forcomprehensions to iterator through Traversables.) The first argument is a sequence of transformations to apply in order to each element in the latter argument. Each function is applied to each element. For example, if the first argument is List( { (x: Double) => x * x }, { (x: Double) => x 1 } ), and the second is Vector(1, 2, 3), then the result would be the sequence 0, 3, 8.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
