This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CycleIterator[B <: A, +A](elements: Iterable[B]) extends Iterator[A] { | |
var iterator: Iterator[B] = Iterator.empty | |
def hasNext: Boolean = { | |
if (!iterator.hasNext) { | |
iterator = elements.iterator | |
} | |
iterator.hasNext | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +filosganga is my blockchain ID. https://onename.com/filosganga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FizzBuzz(divisors = Map(3->"Fizz", 5->"Buzz")) { | |
def fizzBuzz(n: Int): String = { | |
divisors.foldLeft(""){(res, d)=> | |
n % d._1 match { | |
case 0 => res + d._2 | |
case _ => res | |
} | |
} match { | |
case "" => n.toString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import util.parsing.combinator.JavaTokenParsers | |
case class Rule(val selectors : List[String], val properties : List[Property]) | |
case class Property(name: String, value: String) | |
object CssParser extends JavaTokenParsers { | |
def rules = rule+ |
NewerOlder