Skip to content

Instantly share code, notes, and snippets.

@shout-poor
shout-poor / InvFizzBuzz.java
Created June 14, 2012 07:02
InverseFizzbuzz for Java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Inverse Fizzbuzz (for Java)
* http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
*/
public class InvFizzBuzz {
public List<Integer> process(String[] args) {
@shout-poor
shout-poor / gist:2705207
Created May 15, 2012 21:15
Inverse Fizzbuzz by k.ONO (shout_poor)
/**
* Inverse Fizzbuzz
* http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
**/
object InverseFizzBuzz extends App {
val fizzbuzz = new PartialFunction[Int, (Int, String)] {
def apply(x:Int) = (x, (x%3,x%5) match {
case (0, 0) => "fizzbuzz"
case (0, _) => "fizz"