On this page:
trivial
trivial?

5 Trivial Values🔗ℹ

 (require lathe-comforts/trivial)
  package: lathe-comforts-lib

Some values never really vary at all. Perhaps some library accepts an argument that it’ll pass through, but the library’s client has no need for its pass-through services this time. Perhaps some data structure can store annotations on certain nodes, but the client doesn’t really care to annotate any of the nodes this time. In cases like these, it’s useful to have a particular value that doesn’t mean anything.

Racket programs sometimes use (void) for this purpose, but that value is more commonly used as the return value of side-effecting operations which will never have a meaningful result to print at the top level. If a user exploring at the top level uses an operation that typically returns a pass-through value or label, but in this case it happens to return a trivial pass-through value or a trivial label, that’s potentially interesting information for the user, since they may not have even known they were dealing with trivial data yet.

So Lathe Comforts provides a very simple structure type, trivial, to represent trivial values.

syntax

trivial

syntax

(trivial)

match expander

(trivial)

procedure

(trivial? v)  boolean?

  v : any/c
Struct-like operations which construct and deconstruct a trivial value.

Every two trivial values are equal?.