run length encoding って、手続型で書くの面倒だよね。というか、手続型で書くこと考えるの面倒くさくていやだよ。
Scalaちゃんで解いてみる。
scala> def runlength[T](list: List[T]): List[(T, Int)] = list match {
| case Nil => Nil
| case x :: xs => val (first, rest) = xs.span(x ==)
| (x, first.length+1) :: runlength(rest)
| }
runlength: [T](list: List[T])List[(T, Int)]
scala> runlength("aaabbabbbdccbabaaabab".toList)
res11: List[(Char, Int)] = List((a,3), (b,2), (a,1), (b,3), (d,1), (c,2), (b,1), (a,1), (b,1), (a,3), (b,1), (a,1), (b,1))
やった、4行で書けちゃった。仕方ないので(何が?)、糞みたいなコードも書いてみた。
これ見た?
It’s great seeing platforms prioritize a smooth, secure experience – quick registration & easy funding are key! Exploring options like the phfun app casino could be a fun way to unwind responsibly. Remember to set limits & play for enjoyment!
Interesting read! Seeing those RTP stats (95.5-98.2%) at Filbet really highlights their commitment to fair play. Considering the 65% slot game focus, it’s a solid choice for variety. Check out filbet download for more options!
Analyzing race data is fascinating – so much strategy involved! It’s cool to see that approach mirrored in platforms like phdream 11 slot download, where skill & analysis matter. KYC seems key for serious players there, good to know!
JiliOK Casino blends art and math beautifully, offering a refined gaming experience with its AI-driven insights. Check out JiliOK Casino for a platform that truly understands the rhythm of play.