Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos in code #428

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions documentation/BUILTIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Return the number of intervals in the scale, the length of a string or the size
Convert interval to linear representation. Formatting information of logarithmic quantities is lost.

### lll(*basis*, *weighting = "tenney"*)
Perform Lensta-Lenstra-Lovász basis reduction.
Perform Lenstra-Lenstra-Lovász basis reduction.

### log1p(*x*)
Calculate log1p x.
Expand Down Expand Up @@ -699,10 +699,10 @@ Repeat the popped/given intervals as-is without accumulating equaves.
Repeat the popped/given scale shifted linearly each time.

### replace(*interval*, *replacement*, *scale = ££*)
Obtain a copy of the popped/given scale with occurences of `interval` replaced by `replacement`.
Obtain a copy of the popped/given scale with occurrences of `interval` replaced by `replacement`.

### replaceStep(*step*, *replacement*, *scale = ££*)
Obtain a copy of the popped/given scale with relative occurences of `step` replaced by `replacement`.
Obtain a copy of the popped/given scale with relative occurrences of `step` replaced by `replacement`.

### retrovert(*scale = ££*)
Obtain an retroverted copy of the popped/given scale (negative harmony i.e. reflect and transpose).
Expand Down Expand Up @@ -738,7 +738,7 @@ Cumulatively sum the numbers of the popped/given array.
Stack the popped/given inflections along with the guide generator into a periodic sequence of steps.

### stretch(*amount*, *scale = ££*)
Obtain a copy of the popped/given scale streched by the given amount. A value of `1` corresponds to no change.
Obtain a copy of the popped/given scale stretched by the given amount. A value of `1` corresponds to no change.

### subharmonics(*start*, *end*)
Generate a subharmonic segment including the given start and end points.
Expand Down
2 changes: 1 addition & 1 deletion src/__benchmarks__/prelude.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {PRELUDE_SOURCE, PRELUDE_VOLATILES} from '../stdlib/prelude';
import {RootContext} from '../context';
import {CSS_COLOR_CONTEXT} from '../css-colors';

// NOTE: Most of these are not comparitive benchmarks.
// NOTE: Most of these are not comparative benchmarks.
// Mainly useful for making sure tweaks to the parser won't destroy all performance.
beforeAll(() => {
getSourceVisitor();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/interval.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {FractionLiteral, NedjiLiteral} from '../expression';
import {sw} from '../parser';
import {LOG_PRIMES, PRIME_CENTS, dot} from 'xen-dev-utils';

describe('Idempontent formatting', () => {
describe('Idempotent formatting', () => {
it('has stable ratios (common factor)', () => {
const sixOverFour = TimeMonzo.fromFraction('6/4', 2);
const node = intervalValueAs(sixOverFour, {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/monzo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe('Extended monzo with time', () => {
expect(octave.equals(2)).toBeTruthy();
});

it('can be ambiquous in terms of total size compared to reals', () => {
it('can be ambiguous in terms of total size compared to reals', () => {
const octaveJI = new TimeMonzo(new Fraction(0), [new Fraction(1)]);
const octaveReal = new TimeReal(0, 2);
expect(octaveJI.strictEquals(octaveReal)).toBeFalsy();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scale-workshop-2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Line parser', () => {
expect(() => parseLine('42')).toThrow();
});

it('parses negative fractions and interpretes them as inverses', () => {
it('parses negative fractions and interprets them as inverses', () => {
const result = parseLine('-1/2');
expect(
result.equals(
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {version} = require('../package.json');
/**
* Convert a program in the SonicWeave DSL to the Scala .scl format.
* @param source Source code for a SonicWeave program.
* @returns A string convorming to the [Scala format](https://www.huygens-fokker.org/scala/scl_format.html).
* @returns A string conforming to the [Scala format](https://www.huygens-fokker.org/scala/scl_format.html).
*/
export function toScalaScl(source: string) {
const visitor = evaluateSource(source);
Expand Down
2 changes: 1 addition & 1 deletion src/fjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MAX_EXPONENT = Object.freeze(new Fraction(100));
// Classic radius of tolerance.
const RADIUS_OF_TOLERANCE = valueToCents(65 / 63);

// Using a half-sharp + epsilon as the radius of tolerace closes the gap between minor and major.
// Using a half-sharp + epsilon as the radius of tolerance closes the gap between minor and major.
// https://en.xen.wiki/w/User:FloraC/Critique_on_Functional_Just_System
const SEMIAPOTOME = 0.5 * valueToCents(2187 / 2048) + 1e-6;

Expand Down
2 changes: 1 addition & 1 deletion src/grammars/sonic-weave.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ ChainableUnaryOperator
= '^' / '∧' / '\u2228' / '/' / LiftToken / '\\' / DropToken

// The precedence between exponentiation and fractions is a bit uneasy.
// Uniform unary operators make a seccond appearance here to be valid right operands for exponentiation and fractions.
// Uniform unary operators make a second appearance here to be valid right operands for exponentiation and fractions.
UnaryExpression
= operator: UniformUnaryOperator uniform: '~'? operand: ImplicitCallExpression {
return UnaryExpression(operator, operand, !!uniform);
Expand Down
16 changes: 8 additions & 8 deletions src/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ export class Interval {
node = this.value.asMonzoLiteral();
}
if (!Array.isArray(node.basis)) {
throw new Error('Unexpexted unpruned basis.');
throw new Error('Unexpected unpruned basis.');
}
if (
interchange &&
Expand All @@ -1172,7 +1172,7 @@ export class Interval {
) {
node = this.value.asInterchangeLiteral()!;
if (!Array.isArray(node.basis)) {
throw new Error('Unexpexted unpruned basis.');
throw new Error('Unexpected unpruned basis.');
}
}
if (this.steps) {
Expand Down Expand Up @@ -1786,7 +1786,7 @@ export class ValBasis {
}

/**
* Fix a map in this basis to the stadard basis.
* Fix a map in this basis to the standard basis.
* @param map Tuning map of this basis' elements to cents.
* @returns Tuning map of primes to cents.
*/
Expand Down Expand Up @@ -1869,7 +1869,7 @@ export class ValBasis {
/**
* Rebase intervals from the standard basis to this basis.
* Rebase vals from a foreign subgroup basis to this basis.
* @param other {@link Interval} or {@link Val} to reinterprete.
* @param other {@link Interval} or {@link Val} to reinterpret.
* @return The rebased value.
*/
intrinsicCall(other: Interval): Interval;
Expand Down Expand Up @@ -1980,7 +1980,7 @@ export class ValBasis {
}

/**
* A mappping vector commonly used to convert intervals in just intonation to steps of an equal temperament.
* A mapping vector commonly used to convert intervals in just intonation to steps of an equal temperament.
*/
export class Val {
value: TimeMonzo;
Expand Down Expand Up @@ -2370,7 +2370,7 @@ export class Temperament {
}

/**
* Constuct a temperament that retains the properties shared by all of the given vals.
* Construct a temperament that retains the properties shared by all of the given vals.
* @param vals Vals to mix into a more optimal combination. The number of vals decides the rank of the temperament.
* @param weights Additional weights on top of Tenney weights to tweak what is considered optimal.
* @param pureEquaves Boolean flag to force the tuning of the first basis element to remain pure.
Expand Down Expand Up @@ -2410,7 +2410,7 @@ export class Temperament {
}

/**
* Constuct a temperament that tempers out the given commas.
* Construct a temperament that tempers out the given commas.
* @param commas Commas to temper out. The number of commas decides the co-rank of the temperament.
* @param basis Optional basis. Leave undefined to automatically infer from commas.
* @param weights Additional weights on top of Tenney weights to tweak what is considered optimal.
Expand Down Expand Up @@ -2601,7 +2601,7 @@ export class Temperament {

/**
* Produce an array of generator coefficients.
* @param other A value to interprete.
* @param other A value to interpret.
* @returns An array representing the number of generators adding up to the value.
*/
dot(other: Interval): Interval[] {
Expand Down
14 changes: 7 additions & 7 deletions src/monzo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class TimeReal {

/**
* Create a real-valued frequency.
* @param frequency Frequency of a musical note measuder in hertz.
* @param frequency Frequency of a musical note measured in hertz.
* @returns Frequency value in the absolute echelon.
*/
static fromFrequency(frequency: number) {
Expand Down Expand Up @@ -503,7 +503,7 @@ export class TimeReal {
}

/**
* Subrtact another time real from this one in linear space.
* Subtract another time real from this one in linear space.
* @param other Another time real.
* @returns The linear difference of the time reals.
*/
Expand Down Expand Up @@ -1783,7 +1783,7 @@ export class TimeMonzo {
}

/**
* Subrtact another time monzo from this one in linear space.
* Subtract another time monzo from this one in linear space.
* @param other Another time monzo.
* @returns The linear difference of the time monzos.
*/
Expand Down Expand Up @@ -2125,8 +2125,8 @@ export class TimeMonzo {
}
}
}
const respow = other.residual.pow(solution);
if (!respow || respow.compare(this.residual)) {
const residualPow = other.residual.pow(solution);
if (!residualPow || residualPow.compare(this.residual)) {
throw new Error("Logarithm doesn't exist.");
}
return solution;
Expand Down Expand Up @@ -2381,7 +2381,7 @@ export class TimeMonzo {

/**
* Convert a relative time monzo to cents.
* Conert an absosulte time monzo to the size in cents of the scalar of its time unit.
* Covert an absolute time monzo to the size in cents of the scalar of its time unit.
* @param ignoreSign Compute the size of the absolute value.
* @returns Size of the time monzo in cents.
*/
Expand Down Expand Up @@ -2610,7 +2610,7 @@ export class TimeMonzo {
}

/**
* Factorize the time monzo into a Map instace with prime numbers as keys and their multiplicity as values.
* Factorize the time monzo into a Map instance with prime numbers as keys and their multiplicity as values.
* @returns A sparse monzo.
*/
factorize() {
Expand Down
10 changes: 5 additions & 5 deletions src/parser/__tests__/expression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,8 @@ describe('SonicWeave expression evaluator', () => {
});

it("has Lumi's bridging commas (memes)", () => {
const ohno = parseSingle('sm2^0l');
expect(ohno.value.toFraction().toFraction()).toBe('15/14');
const ohNo = parseSingle('sm2^0l');
expect(ohNo.value.toFraction().toFraction()).toBe('15/14');
});

it('has syntonic rastmic subchroma notation (relative artodemisharp)', () => {
Expand Down Expand Up @@ -1770,7 +1770,7 @@ describe('SonicWeave expression evaluator', () => {
expect(fraction).toBe('1024/729');
});

it('has a porkupine inflection', () => {
it('has a porcupine inflection', () => {
const {fraction} = parseSingle('⅓m3_6l');
expect(fraction).toBe('6/5');
});
Expand Down Expand Up @@ -1799,7 +1799,7 @@ describe('SonicWeave expression evaluator', () => {
expect(rootLift[1].valueOf()).toBe(1.5);
});

it('can longtail monzo components starting from a prime', () => {
it('can long-tail monzo components starting from a prime', () => {
const tooMuch = parseSingle('[1 -2 3 -4 5 -6 7 -8 9>@31..');
const pe = tooMuch.value.primeExponents.map(e => e.toFraction());
expect(pe).toEqual([
Expand Down Expand Up @@ -2420,7 +2420,7 @@ describe('SonicWeave expression evaluator', () => {
expect(interval.isAbsolute()).toBe(true);
});

it('coarces too accurate nedji to real', () => {
it('coerces too accurate nedji to real', () => {
const interval = evaluate(
'1000000000000000\\9007199254740997<3>'
) as Interval;
Expand Down
2 changes: 1 addition & 1 deletion src/parser/__tests__/poor-grammar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Angle brackets vs. comparisons', () => {
expect(no).toBe(false);
});

it.fails('features the obstinence of (1°2 < 3) > 4', () => {
it.fails('features the obstinacy of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2<3 >4');
expect(no).toBe(false);
});
Expand Down
2 changes: 1 addition & 1 deletion src/parser/__tests__/sonic-weave-ast.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ describe('SonicWeave Abstract Syntax Tree parser', () => {
]);
});

it('supports multiple subcripts on AbsoluteFJS', () => {
it('supports multiple subscripts on AbsoluteFJS', () => {
const ast = parseSingle('Fb4_5_5');
expect(ast.expression.subscripts).toEqual([
[5, ''],
Expand Down
6 changes: 3 additions & 3 deletions src/parser/__tests__/source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,8 @@ describe('SonicWeave parser', () => {
(* Manual conversion *)
absolute
`);
const freqs = scale.map(i => i.valueOf());
expect(freqs).toEqual([320, 384, 512, 640, 792, 880]);
const frequencies = scale.map(i => i.valueOf());
expect(frequencies).toEqual([320, 384, 512, 640, 792, 880]);
});

it('technically supports partial application', () => {
Expand Down Expand Up @@ -1537,7 +1537,7 @@ describe('SonicWeave parser', () => {
]);
});

it('generates the basic bright mode by defalt', () => {
it('generates the basic bright mode by default', () => {
const scale = expand(`
MOS 3L 2s
K4
Expand Down
12 changes: 6 additions & 6 deletions src/parser/__tests__/stdlib.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ describe('SonicWeave standard library', () => {
expect(D4).toBe('D♮4^73h');
});

it('can replace all occurences of a relative step with others', () => {
it('can replace all occurrences of a relative step with others', () => {
const splitCPS = expand(
'cps([1, 3, 5, 7], 2);replaceStep(7/6, [11/10, 35/33])'
);
Expand Down Expand Up @@ -1382,7 +1382,7 @@ describe('SonicWeave standard library', () => {
]);
});

it('has vectorizing vbool', () => {
it('has vectorized vbool', () => {
const duckDuckGooseDuck = evaluateExpression('vbool(["", 0, 12, niente])');
expect(duckDuckGooseDuck).toEqual([false, false, true, false]);
});
Expand Down Expand Up @@ -1650,10 +1650,10 @@ describe('SonicWeave standard library', () => {
const scale = expand('afdo(5, 3)');
expect(scale).toEqual(['7/5', '9/5', '11/5', '13/5', '3']);
// Verify that it's an arithmetic progression
const fracs = scale.map(f => new Fraction(f));
fracs.unshift(new Fraction(1));
for (let i = 0; i < fracs.length - 1; ++i) {
expect(fracs[i + 1].sub(fracs[i]).equals('2/5')).toBe(true);
const fractions = scale.map(f => new Fraction(f));
fractions.unshift(new Fraction(1));
for (let i = 0; i < fractions.length - 1; ++i) {
expect(fractions[i + 1].sub(fractions[i]).equals('2/5')).toBe(true);
}
});

Expand Down
16 changes: 8 additions & 8 deletions src/parser/__tests__/tag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ describe('SonicWeave template tag', () => {
});

it('evaluates an array of numbers passed in', () => {
const nums: number[] = [];
const numbers: number[] = [];
for (let i = 0; i < 10 * Math.random(); ++i) {
nums.push(Math.floor(Math.random() * 100));
numbers.push(Math.floor(Math.random() * 100));
}
const value = sw`${nums}` as Interval[];
expect(value.map(i => i.toInteger())).toEqual(nums);
const value = sw`${numbers}` as Interval[];
expect(value.map(i => i.toInteger())).toEqual(numbers);
});

it('evaluates PI passed in', () => {
Expand Down Expand Up @@ -125,12 +125,12 @@ describe('SonicWeave raw template tag', () => {
});

it('evaluates an array of numbers passed in', () => {
const nums: number[] = [];
const numbers: number[] = [];
for (let i = 0; i < 10 * Math.random(); ++i) {
nums.push(Math.floor(Math.random() * 100));
numbers.push(Math.floor(Math.random() * 100));
}
const value = swr`${nums}` as Interval[];
expect(value.map(i => i.toInteger())).toEqual(nums);
const value = swr`${numbers}` as Interval[];
expect(value.map(i => i.toInteger())).toEqual(numbers);
});

it('evaluates PI passed in', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/__tests__/temper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ describe('Features related to tempering', () => {
});

it('can combine three vals to approach the JIP', () => {
const fourtyOne = evaluate('tune([[email protected], [email protected], [email protected]])') as Val;
expect(fourtyOne.value.toIntegerMonzo()).toEqual([41, 65, 95, 115]);
const fortyOne = evaluate('tune([[email protected], [email protected], [email protected]])') as Val;
expect(fortyOne.value.toIntegerMonzo()).toEqual([41, 65, 95, 115]);
});

it('can combine four vals to approach the JIP', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/chord-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function parseBasis(input: string): ValBasis {

/**
* Parse a list of vals separated by '|', '&', ':', ';', ',' or whitespace.
* @param input User input in a context that expects a sequance of vals.
* @param input User input in a context that expects a sequence of vals.
* @param basis Dot-separated subgroup basis or the prime limit parsed by {@link parseBasis}.
* @param includePrelude Whether or not to include the extended standard library. Passing in `false` results in a faster start-up time.
* @returns An array of number arrays representing vals in the subgroup basis.
Expand All @@ -96,7 +96,7 @@ export function parseVals(
throw new Error('Explicit subgroups not supported.');
}
const val = evaluateExpression(part, includePrelude) as Val;
// Just re-interprete in the subgroup's basis.
// Just re-interpret in the subgroup's basis.
result.push(Val.fromBasisMap(val.sval, basis));
} else {
// Add a dummy named subgroup to make the warts parser do the right thing.
Expand Down
Loading
Loading