Always learning
Monday, February 16, 2015
Level Up
›
Read these: http://courses.csail.mit.edu/iap/interview/materials.php
Thursday, October 06, 2011
Scala By Example Chapter 11 Solutions - Exercise 11.3.2
›
Exercise 11.3.2 Another way is to define an or-gate by a combination of inverters and and gates. Define a function orGate in terms of andGat...
Scala By Example Chapter 11 Solutions - Exercise 11.3.1
›
Exercise 11.3.1 Write the implementation of orGate. Note that the delay parameter in the function afterDelay has not been used since it rem...
Wednesday, October 05, 2011
Scala By Example Chapter 11 Solutions - Exercise 11.2.1
›
Exercise 11.2.1 Write a function repeatLoop with also additional syntax for an until clause. The repeat { command } until (condition) was ...
Scala By Example Chapter 10 Solutions - Exercise 10.3.2
›
Exercise 10.3.2 Translate the following for comprehensions to higher-order functions.
Scala By Example Chapter 10 Solutions - Exercise 10.3.1
›
Exercise 10.3.1 Define the following function in terms of for. This will be revisited later.
Scala By Example Chapter 10 Solutions - Exercise 10.1.1
›
Exercise10.1.1 Write the function isSafe.
Scala By Example Chapter 9 Solutions - Exercise 9.4.3
›
Exercise 9.4.3 Fill in the missing expressions to complete the following definitions of some basic list-manipulation operations as fold oper...
Scala By Example Chapter 9 Solutions - Exercise 9.4.2
›
Exercise 9.4.2 What would be the difference in asymptotic complexity between the two versions of flatten? This will be revisited later.
Scala By Example Chapter 9 Solutions - Unnamed Exercise after 9.4.1
›
Exercise: Define forall and exists in terms of filter. As before, since class List cannot be extended in scala, the methods are implemented...
Scala By Example Chapter 9 Solutions - Exercise 9.4.1
›
Exercise 9.4.1 Consider a function which squares all elements of a list and re- turns a list with the results. Complete the following two eq...
Friday, September 23, 2011
Scala By Example Chapter 9 Solutions - Exercise 9.2.1
›
Exercise 9.2.1 Design a tail-recursive version of length. Ah, tail recursion again. Re-iterating that in a tail recursion, the last line o...
Scala By Example Chapter 9 Solutions - Exercise 9.1.1
›
Exercise 9.1.1 Provide an implementation of the missing function insert. Insert will also be recursive, and its pretty easy to lay down th...
Scala By Example Chapter 7 Solutions - Exercise 7.2.2
›
Exercise 7.2.2 Complete the following implementations of function contains and insert for IntTree’s. This is similar to the IntSet impleme...
Scala By Example Chapter 6 Solutions - Exercise 6.0.3
›
Exercise 6.0.3 Write an implementation Integer of integer numbers The implementation should support all operations of class Nat while adding...
Scala By Example Chapter 6 Solutions - Exercise 6.0.2
›
Exercise 6.0.2 Add a method def excl(x: Int) to return the given set without the element x. To accomplish this, it is useful to also impleme...
Scala By Example Chapter 6 Solutions - Exercise 6.0.1
›
Exercise 6.0.1 Write methods union and intersection to form the union and intersection between two sets. This will be revisited later.
Wednesday, September 14, 2011
Scala By Example Chapter 5 Solutions - Exercise 5.3.1
›
Exercise 5.3.1 Write a function for cube roots using fixedPoint and averageDamp. Both fixedPoint and averageDamp functions remain the same...
Monday, September 12, 2011
Scala By Example Chapter 5 Solutions - Exercise 5.2.4
›
Exercise 5.2.4 Can you write an even more general function which generalizes both sum and product? This function abstracts out the operati...
Scala By Example Chapter 5 Solutions - Exercise 5.2.3
›
Exercise 5.2.3 Write factorial in terms of product.
Scala By Example Chapter 5 Solutions - Exercise 5.2.2
›
Exercise5.2.2 Write a function product that computes the product of the values of functions at points over a given range. This is very sim...
Thursday, September 08, 2011
Scala By Example Chapter 5 Solutions - Exercise 5.2.1
›
Exercise 5.2.1 1. The sum function uses a linear recursion. Can you write a tail- recursive one by filling in the ??’s? The key is to unde...
›
Home
View web version