             }
         }
         
-        // Returns sequence of tokens read from character sequence
+        func characterSequenceFromString(string: String) -> SequenceOf<Character> {
+            trace("characterSequenceFromString", "create character sequence")
+            return SequenceOf(string.generate())
+        }
+        
+        // Returns sequence of tokens scanned from character sequence
         func tokenize(characters: SequenceOf<Character>) -> SequenceOf<Token> {
-            enum State {
+            enum ScannerState {
                 case LookingForToken
                 case ScanningInteger
             }
             
-            return lazySequence { yield in
-                var state = State.LookingForToken
+            return lazySequence { _yield in
+                
+                func yield(token: Token) {
+                    trace("tokenize", "yield(\(token))")
+                    _yield(token)
+                }
+                
+                var state = ScannerState.LookingForToken
                 var scannedIntegerDigits = ""
                 
                 func yieldScannedInteger() {

            }
        }
        
        func evaluateRPN(characters: SequenceOf<Character>) -> SequenceOf<Int> {
            return lazySequence { yield in
                var stack = Stack<Int>()
                for token in tokenize(characters) {
                    switch token {
                        
                    case .Integer(let value):
                        stack.push(value)
                        
                    case .Plus:
                        let a = stack.pop()
                        let b = stack.pop()
                        stack.push(a + b)
                        
                    case .Multiply:
                        let a = stack.pop()
                        let b = stack.pop()
                        stack.push(a * b)
                        
                    case .GetResult:
                        let result = stack.pop()
                        yield(result)
                    }
                }
            }
        }
        
        // Auxiliary function to convert a String to a sequence of character values
        func evaluateRPNString(string: String) -> SequenceOf<Int> {
            return evaluateRPN(SequenceOf(string.generate()))
        }
        
        // Should generate the results [3, 200, 30] (1+2, 10*20, (1+2)*10)
        let results = evaluateRPNString("1 2 + =  10 20 * =  1 2 + 10 * =")
        
        let resultsArray = Array<Int>(results)
        XCTAssertEqual(3, resultsArray.count)


        // Use TestData.txt resource from test bundle
        let testBundle = NSBundle(forClass: KJYieldTests.self)
        let testDataPath = testBundle.pathForResource("TestData", ofType: "txt")
        
        let lines = getLinesFromUTF8EncodedTextFileAtPath(testDataPath)
        var lineNumber = 0
