Scala

Scala Maybe

I wrote a Maybe (a lazy Option[T]) that I can use in Scala.

Scala Extractors

Scala’s extractors and unapply() represent a concept that I haven’t grok’ed until now. Most demonstrations seem to be too long or use the same types everywhere. Here are my thoughts on the concept; val a: C = ??? val i: I = ??? i match { case a(f: O) => ??? } This will try to call the below method class C { def unapply(i: I): Option[O] = ??? } There’s some more flexibility;

(Scala) Delay Run

I wrote a threading primitive and I’m very pleased with it. I plan to wrap all of my “save file” things in this, from now on. Delay Run This class acts as a sort of “once inactive for X do Y” pattern. In my design, I’m wrapping my save actions in it and triggering schedule() after practically every edit. The class is passed a delay: Long value to specify how long to actually wait - I’m using 1.