我想创建一个通用的permutations函数。 def permutation(size: Int): Stream[List[Int]] = ...
permutation(1) # same as: for { x <- (1 to 10).toStream } yield List(x)
permutation(2) # same as: for { x <- (1 to 10).t
我正在寻找一种方法来捕获在理解本身的类型中用于理解的类型。为此,我所指定的粗糙界面: trait Chain[A]{
type ChainMethod = A => A //type of the method chained so far
def flatMap[B](f: A => Chain[B]): Chain[B] //the ChainMethod needs t