* The words this level used, explained once each, and only the ones it used. * * Tied to what is on screen rather than to a fixed vocabulary list: a glossary * that explains "entry point" on a symbol that is not one is a page of reading * in front of the answer, and it teaches the junior that th
(ir: SemanticIR, facets: ReadonlySet<Facet>)
| 884 | * them. |
| 885 | */ |
| 886 | function juniorTerms(ir: SemanticIR, facets: ReadonlySet<Facet>): TwinTerm[] { |
| 887 | const wanted: string[] = []; |
| 888 | const add = (term: string): void => { |
| 889 | if (TERM_EXPLANATIONS[term] !== undefined && !wanted.includes(term)) { |
| 890 | wanted.push(term); |
| 891 | } |
| 892 | }; |
| 893 | if (ir.steps.value.length > 0 && (facets.has(Facet.Logic) || facets.has(Facet.Calls))) { |
| 894 | add('call site'); |
| 895 | } |
| 896 | if (facets.has(Facet.Calls) && ir.calledBy.value.length > 0) { |
| 897 | add('caller'); |
| 898 | } |
| 899 | if (facets.has(Facet.Errors) && ir.throws.value.length > 0) { |
| 900 | add('raise'); |
| 901 | } |
| 902 | if (facets.has(Facet.Data) && ir.reads.value.length > 0) { |
| 903 | add('environment read'); |
| 904 | } |
| 905 | if (facets.has(Facet.Tests) && ir.tests.value.length > 0) { |
| 906 | add('test caller'); |
| 907 | } |
| 908 | if (ir.complexity.state === 'known' && ir.complexity.value.isEntryPoint) { |
| 909 | add('entry point'); |
| 910 | } |
| 911 | return wanted.map((term) => ({ term, explanation: TERM_EXPLANATIONS[term] })); |
| 912 | } |
| 913 | |
| 914 | function junior(ir: SemanticIR, presentation: ResolvedPresentation): TwinViewModel { |
| 915 | const facets = presentation.facets; |