in bijection-clojure/codegen/Generator.scala [29:46]
def implicitIFn(i: Int): String = {
val func = "function" + i
val types = genParams(i + 1) { upperLetters(_) }
val funcType = "%s[%s]".format(func.capitalize, types)
val bijectionType = "Bijection[%s, IFn]".format(funcType)
""" implicit def %sToIFn[%s]: %s =
new Abstract%s {
def apply(fn: %s) = new AFn {
override def invoke(%s): AnyRef = fn.apply(%s).asInstanceOf[AnyRef]
}
override def invert(fn: IFn) = { (%s) => fn.invoke(%s).asInstanceOf[%s] }
}""".format(func, types, bijectionType, bijectionType, funcType,
genParams(i) { "%s: AnyRef" format lowerLetters(_) },
genParams(i)(castParam),
genParams(i){ lowerLetters(_) },
genParams(i){ lowerLetters(_) },
upperLetters(i))
}