Square each element of a Scala list
There are two practical ways to square each element of a list, and return the new list. For example, if we input a List(5, 10) »
There are two practical ways to square each element of a list, and return the new list. For example, if we input a List(5, 10) »
Given some lower bound a = na/da and upper bound nb/db, write a function that calculates the summation of f(nk/dk), where k is »
Problem Given some amount of money integer, and an array of integer coins, calculate the total number of ways to make change. Approach Suppose that we »
def forall(s: Set, p: Int => Boolean): Boolean = { def iter(a: Int): Boolean = { if (contains(s, a) && !p(a)) false // If the predicate »
Material: https://class.coursera.org/progfun-005/ A type is basically an alias. It allows for neater code, and simplified readability. Since we can have function types, »