Skip to content

Instantly share code, notes, and snippets.

@kanshi
Created February 22, 2013 11:46
Show Gist options
  • Save kanshi/5012914 to your computer and use it in GitHub Desktop.
Save kanshi/5012914 to your computer and use it in GitHub Desktop.
Thoughtless class
case class Thoughtless[T <: String](
val sensitivity: Double,
val focus: Int,
val memory: Memory[T] = Memory[T](Set[Mem[T]]()),
val feelings: Feelings = Set[Emotion]()) {
def focusScope(ioi: Set[T]): List[T] = ioi.toList.sortWith(_.length < _.length)
def teach(ioi: T, emotion: Emotion) = Thoughtless[T](
sensitivity, focus,
memory add (Mem[T](ioi, emotion), sensitivity), feelings)
def reason(ioi: Set[T], extent: Int = focus): Set[Mem[T]] =
if (extent < 1) Set[Mem[T]]()
else {
val focused = focusScope(ioi)
(memory scan (focus - extent + 1, focused.head, sensitivity)) ++ reason(focused.tail.toSet, extent - 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment