SLIM Coding

Single LIne Methods Coding

Most methods in Scalqa are written as a single line of code and program units never exceed one screen (no need for scrolling down).

For example, this is the definition of Lookup (source) collection trait:

trait Lookup[A,+B] extends Collection[B]:
  def getOpt(key: A)            : Opt[B]
  def get(v: A)                 : B               = getOpt(v) or (throw ZZ.ME(v.tag))
  def getStream(keys: Stream[A]): Stream[B]       = keys.mapOpt(getOpt(_))
  def pairStream                : Stream[(A, B)]
  def keyStream                 : Stream[A]       =
  def stream                    : Stream[B]       =

This format allows to understand the entire program unit in a glance, facilitating different kind of non-linear thinking about program development.

Take a look at few more source code examples: