Skip to content

Instantly share code, notes, and snippets.

case class ElectricCar(b: Battery) { def batteryLevel = b.filledPercentage }
case class GasolineCar(g: GasTank) { def gasLevel = g.filledPercentage }
case class Battery(filledPercentage: Int) { def fill: Battery = Battery(100) }
case class GasTank(filledPercentage: Int) { def fill: GasTank = GasTank(100) }
trait Fills[C] {
def fill(car: C): C
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
(ns test.dialect
(:require [clojure.contrib.string :as st]))
(defn pig-latinize [word]
(let [fs (str (first word))]
(str
(if (re-seq #"(?i)[aeiou]" fs)
word
(str (subs word 1) fs))
"ay")))