Fizzbuzz in Scheme/Racket

No idea why I did this…

(define (fizzbuzz listIn [currentList empty])
  (define (showWhich itemToTell)
    (let ([testString
            (if (= (modulo itemToTell 3) 0) "Fizz" "")
            (if (= (modulo itemToTell 5) 0) "Buzz" ""))])
      (if (= (string-length testString) 0)
  (define (add-head-to-list itemList listTAddTo)
    (append listTAddTo (list (showWhich (first itemList) ))))  
    [(null? listIn) currentList]
    [(null? (rest listIn)) (add-head-to-list listIn currentList)]
    [else (fizzbuzz (rest listIn) (add-head-to-list listIn currentList))]))

Create An X Delimited String From A Char List Using Linq Aggregate

A quick example of how to use the Aggregate method to create a string of delimited members, or in this case characters. You might wonder why this example, or at least you should. It’s true, the character list to delimited string is pretty useless, but some idiot from where I work needed it.

public void GetStringFromCharacters()
    var charList = Enumerable.Range(0, 10).Select(x => 'a').ToList();

        .Aggregate("", (inner, outer) => inner + outer.ToString() + ",")

The big thing here is the “” in the Aggregate method signature. That basically says that Inner is a string. If I didn’t have that specified, both inner and outer would be a character.