sociology.sleela
lib/ui/example/science/sociology.sleela · 74 line(s) · sleela
<<
example/science/sociology.sleela
A runnable SLeeLa SOCIOLOGY program on the native `sociology` subject library
(import sociology;). It exercises the subject library's measures directly via
qualified calls like sociology.rate(...). Sociology depends on Math, so the
subject library requires `import math;`.
Facade (impl/subjects/sociology/sociology_native.cpp):
proportion(part, total) part / total
rate(events, population, scale) events / population * scale
growth_rate(oldValue, newValue) (new - old) / old
transition_probability(transitions, origin) transitions / origin
Inputs are real, dated, sourced US figures from the churn datasets
(churn/2/data/social-labor-us.json, churn/4/data/social-density-us.json):
BLS / Census. Discipline: these are OBSERVED published statistics; any
relation drawn between them is a MODEL, not a causal claim
(ASSOCIATION != CAUSATION — see churn/README.md).
Run:
SLEELA_SHEET=./SHEET.sheet \
SLEELA_SHA256_MANIFEST=./security/sha256-manifest.json \
./impl/build/sleela run example/science/sociology.sleela
>>
#sleela 2.5
material;
import math;
import sociology;
class ScienceSociology {
void banner(String t) {
print("================================================================");
print(" " + t);
print("================================================================");
}
void main() {
banner("SLeeLa Science — Sociology (import sociology;)");
print("All figures are OBSERVED (BLS / Census). ASSOCIATION != CAUSATION.");
// US resident population and labor force (churn social datasets).
double population = 341784857.0; // Census, 2025-07-01
double laborForce = 168000000.0; // ~168M, BLS civilian labor force (approx.)
double landAreaKm2 = 9147420.0; // CIA World Factbook (US land area)
double unemployed = 0.042 * laborForce; // unemployment_rate 4.2% of labor force
print("[proportion]");
print(" labor force as a proportion of population = "
+ sociology.proportion(laborForce, population));
print("[rate] per 100,000");
print(" unemployed per 100,000 of the labor force = "
+ sociology.rate(unemployed, laborForce, 100000.0));
print("[growth_rate]");
print(" unemployment rate 3.8 -> 4.2 percent = "
+ sociology.growth_rate(3.8, 4.2));
print(" median household income 80610 -> 83730 = "
+ sociology.growth_rate(80610.0, 83730.0));
print("[transition_probability]");
print(" transition_probability(30 of 100) = "
+ sociology.transition_probability(30.0, 100.0));
print("[density] population / land area (persons per km^2)");
print(" US population density = "
+ sociology.proportion(population, landAreaKm2));
banner("Done");
print("Sociology is a native subject library (import sociology;); it builds on math.");
}
}