yuin #1229(2007/07/21 05:13 GMT) [ Scala ] Rating1/1=1.00
reverseMapを自前で。
1 2 3 4 5 6
def reverseMap[A](l:Seq[A],f:A=>unit):unit = l match { case Nil => () case x::Nil => f(x) case x => f(x.last);reverseMap[A](l.slice(0, l.length-1),f) } reverseMap(List(1,2,3,4,5), println)
Rating1/1=1.00-0+
[ reply ]
yuin
#1229()
[
Scala
]
Rating1/1=1.00
def reverseMap[A](l:Seq[A],f:A=>unit):unit = l match { case Nil => () case x::Nil => f(x) case x => f(x.last);reverseMap[A](l.slice(0, l.length-1),f) } reverseMap(List(1,2,3,4,5), println)Rating1/1=1.00-0+
[ reply ]