Tin

Examples · learn/13-modules/lib · 192 of 339

joints

lib/joints.tin: a file of types and functions for other files to use.

examples/learn/13-modules/lib/joints.tintin run examples/learn/13-modules/lib/joints.tin
// lib/joints.tin: a file of types and functions for other files to use.

type Joint = { name: string, angle: float, limit: float }

/// The names of the joints that are past their limit.
fn overLimit(joints: Joint[]): string[] {
  joints.filter((j) => abs(j.angle) > j.limit).map((j) => j.name)
}