Advertisement
Mph0

Untitled

May 13th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.32 KB | None | 0 0
  1. def cc (e : Element, c : Couleur) : Element = {
  2.     e match {
  3.         case Bouton(_) => new Bouton(c)
  4.         case Boite(x) => new Boite(x.map(cc(_, c)))
  5.         }
  6.     }
  7.  
  8. def t (e : Element) : Set[Couleur]  = {
  9.     e match {
  10.         case Bouton(x) => Set(x)
  11.         case Boite(x) => {var s = Set[Couleur](); for (i <- x.map(t)) {s = s.union(i)}; s}
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement