Skip to content
EXAMPLES

Verified programs, from source to result.

Browse independently executed SS projects by level and subject. Every entry includes complete source or its packaged dependencies, accepted output, a free project download, and a local-browser SS Lab handoff.

5 verified examples

Essentials · Language foundations

Arrays, continuation, and control flow

Complete executable V1 source from the authoritative language specification.

Problem and formulation

Sum a finite force vector and branch on the exact scalar result.

Verification

Executed with SS 1.0.0; observed output matched expected.out.txt.

Complete executable main.ss
let forces = [10, 20, 30]
let area = 200

let total = (
    forces[0]
    + forces[1]
    + forces[2]
)

if total == 60 {
    printLine("Solved", total)
}

Expected output: Solved 60

Accepted provenance: packages/examples/projects/introduction/main.ss
Essentials · Dimensional computing

Physical quantities and custom units

Dimensioned literals, derived quantities, and a user-defined multiplicative unit.

Problem and formulation

Stress is evaluated as force divided by area while dimensional units remain part of each value.

Verification

Executed with SS 1.0.0; all three observed quantity outputs matched expected.out.txt.

Complete executable main.ss
let force = 20 kN
let area = 200 mm^2
let stress = force / area

unit furlong = 201.168 m
let distance = 3 furlong

printLine(force)
printLine(stress)
printLine(distance)

Expected output: 20 kN; 100000000.00000001 m^-1*kg*s^-2; 3 furlong

Accepted provenance: packages/examples/projects/quantities/main.ss
Advanced Studies · Concurrency
SS.Concurrency 1.0.0

Bounded parallel atomic sum

Sum a fixed integer range with four bounded workers and one atomic accumulator.

Problem and formulation

The static half-open range 0..999 has exact sum 999 × 1000 / 2 = 499500; FetchAdd makes each accumulation indivisible.

Verification

Executed independently on native, interpreter, and CIL backends; all observed outputs matched the accepted oracle.

Complete executable main.ss
module Main
import Concurrency

let total = AtomicInt32(0)
Parallel.For(0, 1000, (index) => { total.FetchAdd(index) }, 4, "static")
printLine("Concurrency API:", Concurrency.concurrencyApiVersion())
printLine("Parallel atomic sum:", total.Load())

Expected output: Concurrency API: 1.0.0; Parallel atomic sum: 499500

Accepted provenance: SS.Concurrency/Examples/parallel-atomic.ss
Download project
Advanced Studies · Statistics
SS.Statistics 1.2.0

Descriptive statistics

Summarize a measured sample using the verified SS.Statistics package example.

Problem and formulation

For five observations, compute count, arithmetic mean, and unbiased sample variance.

Verification

Qualified SS.Statistics example; observed count, mean, and sample variance match the accepted output.

Executable entry point; dependencies included in project download
module Main
import Statistics

let result = Statistics.summarize([12.0, 15.0, 13.0, 10.0, 15.0])
printLine("count", result.count, "mean", result.mean, "sample variance", result.sampleVariance)
Browser-local rendition

This dependency-free program evaluates the same accepted formulation and result when opened in SS Lab; the download retains the qualified package project.

Complete executable SS Lab source
let values = [12.0, 15.0, 13.0, 10.0, 15.0]
let count = 5
let mean = (values[0] + values[1] + values[2] + values[3] + values[4]) / count
let sampleVariance = ((values[0] - mean) * (values[0] - mean)
    + (values[1] - mean) * (values[1] - mean)
    + (values[2] - mean) * (values[2] - mean)
    + (values[3] - mean) * (values[3] - mean)
    + (values[4] - mean) * (values[4] - mean)) / (count - 1)
printLine("count", count, "mean", mean, "sample variance", sampleVariance)

Expected output: count 5, mean 13, sample variance 4.5

Accepted provenance: Examples/ProfessionalFreePackages/SS.Statistics/Beginner/main.ss
Applied Projects · Mechanics
SS.Mechanics 1.2.0

Constant-acceleration motion

Compute position and velocity with the verified SS.Mechanics beginner example.

Problem and formulation

x(t) = x0 + v0 t + 1/2 a t² and v(t) = v0 + a t for a = 9.81 m/s² and t = 2 s.

Verification

Qualified SS.Mechanics example; observed position and velocity both equal 19.62.

Executable entry point; dependencies included in project download
module Main
import Mechanics

let motion = Mechanics.constantAcceleration(0.0, 0.0, 9.81, 2.0)
printLine("position_m", motion.position, "velocity_m_per_s", motion.velocity)
Browser-local rendition

This dependency-free program evaluates the same accepted formulation and result when opened in SS Lab; the download retains the qualified package project.

Complete executable SS Lab source
let initialPosition = 0.0
let initialVelocity = 0.0
let acceleration = 9.81
let time = 2.0
let position = initialPosition + initialVelocity * time + 0.5 * acceleration * time * time
let velocity = initialVelocity + acceleration * time
printLine("position_m", position, "velocity_m_per_s", velocity)

Expected output: position_m 19.62, velocity_m_per_s 19.62

Accepted provenance: Examples/ProfessionalFreePackages/SS.Mechanics/Beginner/main.ss