flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

View file

@ -0,0 +1,139 @@
declare function multiplication(a: number, b: number): number;
declare function division(a: number, b: number): number;
declare function addition(a: number, b: number): number;
declare function last(...a: Array<number>): number;
declare function subtraction(a: number, b: number): number;
declare function negation(a: number): number;
declare function comma(...a: Array<number | string>): Array<number | string>;
declare function min(...a: Array<number>): number;
declare function max(...a: Array<number>): number;
declare const defaultSymbols: {
symbols: {
'*': {
infix: {
symbol: '*';
f: multiplication;
notation: 'infix';
precedence: 4;
rightToLeft: 0;
argCount: 2;
};
symbol: '*';
regSymbol: '\\*';
};
'/': {
infix: {
symbol: '/';
f: division;
notation: 'infix';
precedence: 4;
rightToLeft: 0;
argCount: 2;
};
symbol: '/';
regSymbol: '/';
};
'+': {
infix: {
symbol: '+';
f: addition;
notation: 'infix';
precedence: 2;
rightToLeft: 0;
argCount: 2;
};
prefix: {
symbol: '+';
f: last;
notation: 'prefix';
precedence: 3;
rightToLeft: 0;
argCount: 1;
};
symbol: '+';
regSymbol: '\\+';
};
'-': {
infix: {
symbol: '-';
f: subtraction;
notation: 'infix';
precedence: 2;
rightToLeft: 0;
argCount: 2;
};
prefix: {
symbol: '-';
f: negation;
notation: 'prefix';
precedence: 3;
rightToLeft: 0;
argCount: 1;
};
symbol: '-';
regSymbol: '-';
};
',': {
infix: {
symbol: ',';
f: comma;
notation: 'infix';
precedence: 1;
rightToLeft: 0;
argCount: 2;
};
symbol: ',';
regSymbol: ',';
};
'(': {
prefix: {
symbol: '(';
f: last;
notation: 'prefix';
precedence: 0;
rightToLeft: 0;
argCount: 1;
};
symbol: '(';
regSymbol: '\\(';
};
')': {
postfix: {
symbol: ')';
f: undefined;
notation: 'postfix';
precedence: 0;
rightToLeft: 0;
argCount: 1;
};
symbol: ')';
regSymbol: '\\)';
};
min: {
func: {
symbol: 'min';
f: min;
notation: 'func';
precedence: 0;
rightToLeft: 0;
argCount: 1;
};
symbol: 'min';
regSymbol: 'min\\b';
};
max: {
func: {
symbol: 'max';
f: max;
notation: 'func';
precedence: 0;
rightToLeft: 0;
argCount: 1;
};
symbol: 'max';
regSymbol: 'max\\b';
};
};
};
export default defaultSymbols;

View file

@ -0,0 +1,162 @@
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
function last() {
var _ref;
return _ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref];
}
function negation(a) {
return -a;
}
function addition(a, b) {
return a + b;
}
function subtraction(a, b) {
return a - b;
}
function multiplication(a, b) {
return a * b;
}
function division(a, b) {
return a / b;
}
function max() {
return Math.max.apply(Math, arguments);
}
function min() {
return Math.min.apply(Math, arguments);
}
function comma() {
return Array.of.apply(Array, arguments);
}
var defaultSymbols = {
symbols: {
'*': {
infix: {
symbol: '*',
f: multiplication,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2
},
symbol: '*',
regSymbol: '\\*'
},
'/': {
infix: {
symbol: '/',
f: division,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2
},
symbol: '/',
regSymbol: '/'
},
'+': {
infix: {
symbol: '+',
f: addition,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2
},
prefix: {
symbol: '+',
f: last,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1
},
symbol: '+',
regSymbol: '\\+'
},
'-': {
infix: {
symbol: '-',
f: subtraction,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2
},
prefix: {
symbol: '-',
f: negation,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1
},
symbol: '-',
regSymbol: '-'
},
',': {
infix: {
symbol: ',',
f: comma,
notation: 'infix',
precedence: 1,
rightToLeft: 0,
argCount: 2
},
symbol: ',',
regSymbol: ','
},
'(': {
prefix: {
symbol: '(',
f: last,
notation: 'prefix',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: '(',
regSymbol: '\\('
},
')': {
postfix: {
symbol: ')',
f: undefined,
notation: 'postfix',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: ')',
regSymbol: '\\)'
},
min: {
func: {
symbol: 'min',
f: min,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'min',
regSymbol: 'min\\b'
},
max: {
func: {
symbol: 'max',
f: max,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'max',
regSymbol: 'max\\b'
}
}
};
var _default = exports["default"] = defaultSymbols;
module.exports = exports.default;

View file

@ -0,0 +1,168 @@
// @flow
function last(...a: Array<number>): number {
return a[a.length - 1]
}
function negation(a: number): number {
return -a
}
function addition(a: number, b: number): number {
return a + b
}
function subtraction(a: number, b: number): number {
return a - b
}
function multiplication(a: number, b: number): number {
return a * b
}
function division(a: number, b: number): number {
return a / b
}
function max(...a: Array<number>): number {
return Math.max(...a)
}
function min(...a: Array<number>): number {
return Math.min(...a)
}
function comma(...a: Array<number | string>): Array<number | string> {
return Array.of(...a)
}
const defaultSymbols = {
symbols: {
'*': {
infix: {
symbol: '*',
f: multiplication,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2,
},
symbol: '*',
regSymbol: '\\*',
},
'/': {
infix: {
symbol: '/',
f: division,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2,
},
symbol: '/',
regSymbol: '/',
},
'+': {
infix: {
symbol: '+',
f: addition,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2,
},
prefix: {
symbol: '+',
f: last,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1,
},
symbol: '+',
regSymbol: '\\+',
},
'-': {
infix: {
symbol: '-',
f: subtraction,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2,
},
prefix: {
symbol: '-',
f: negation,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1,
},
symbol: '-',
regSymbol: '-',
},
',': {
infix: {
symbol: ',',
f: comma,
notation: 'infix',
precedence: 1,
rightToLeft: 0,
argCount: 2,
},
symbol: ',',
regSymbol: ',',
},
'(': {
prefix: {
symbol: '(',
f: last,
notation: 'prefix',
precedence: 0,
rightToLeft: 0,
argCount: 1,
},
symbol: '(',
regSymbol: '\\(',
},
')': {
postfix: {
symbol: ')',
f: undefined,
notation: 'postfix',
precedence: 0,
rightToLeft: 0,
argCount: 1,
},
symbol: ')',
regSymbol: '\\)',
},
min: {
func: {
symbol: 'min',
f: min,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1,
},
symbol: 'min',
regSymbol: 'min\\b',
},
max: {
func: {
symbol: 'max',
f: max,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1,
},
symbol: 'max',
regSymbol: 'max\\b',
},
},
}
export default defaultSymbols

View file

@ -0,0 +1,45 @@
declare function factorial(a: number): number;
declare function power(a: number, b: number): number;
declare function sqrt(a: number): number;
declare const exponentialSymbols: {
symbols: {
'!': {
postfix: {
symbol: '!';
f: factorial;
notation: 'postfix';
precedence: 6;
rightToLeft: 0;
argCount: 1;
};
symbol: '!';
regSymbol: '!';
};
'^': {
infix: {
symbol: '^';
f: power;
notation: 'infix';
precedence: 5;
rightToLeft: 1;
argCount: 2;
};
symbol: '^';
regSymbol: '\\^';
};
sqrt: {
func: {
symbol: 'sqrt';
f: sqrt;
notation: 'func';
precedence: 0;
rightToLeft: 0;
argCount: 1;
};
symbol: 'sqrt';
regSymbol: 'sqrt\\b';
};
};
};
export default exponentialSymbols;

View file

@ -0,0 +1,58 @@
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
function factorial(a) {
if (a % 1 || !(+a >= 0)) return NaN;
if (a > 170) return Infinity;else if (a === 0) return 1;else {
return a * factorial(a - 1);
}
}
function power(a, b) {
return Math.pow(a, b);
}
function sqrt(a) {
return Math.sqrt(a);
}
var exponentialSymbols = {
symbols: {
'!': {
postfix: {
symbol: '!',
f: factorial,
notation: 'postfix',
precedence: 6,
rightToLeft: 0,
argCount: 1
},
symbol: '!',
regSymbol: '!'
},
'^': {
infix: {
symbol: '^',
f: power,
notation: 'infix',
precedence: 5,
rightToLeft: 1,
argCount: 2
},
symbol: '^',
regSymbol: '\\^'
},
sqrt: {
func: {
symbol: 'sqrt',
f: sqrt,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'sqrt',
regSymbol: 'sqrt\\b'
}
}
};
var _default = exports["default"] = exponentialSymbols;
module.exports = exports.default;

View file

@ -0,0 +1,61 @@
// @flow
function factorial(a: number): number {
if (a % 1 || !(+a >= 0)) return NaN
if (a > 170) return Infinity
else if (a === 0) return 1
else {
return a * factorial(a - 1)
}
}
function power(a: number, b: number): number {
return a ** b
}
function sqrt(a: number): number {
return Math.sqrt(a)
}
const exponentialSymbols = {
symbols: {
'!': {
postfix: {
symbol: '!',
f: factorial,
notation: 'postfix',
precedence: 6,
rightToLeft: 0,
argCount: 1,
},
symbol: '!',
regSymbol: '!',
},
'^': {
infix: {
symbol: '^',
f: power,
notation: 'infix',
precedence: 5,
rightToLeft: 1,
argCount: 2,
},
symbol: '^',
regSymbol: '\\^',
},
sqrt: {
func: {
symbol: 'sqrt',
f: sqrt,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1,
},
symbol: 'sqrt',
regSymbol: 'sqrt\\b',
},
},
}
export default exponentialSymbols