@mojir/lits 2.1.10 → 2.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lits.iife.js CHANGED
@@ -698,7 +698,7 @@ var Lits = (function (exports) {
698
698
  if (a === b)
699
699
  return true;
700
700
  if (typeof a === 'number' && typeof b === 'number')
701
- return Math.abs(a - b) < 1e-10;
701
+ return approxEqual(a, b);
702
702
  if (Array.isArray(a) && Array.isArray(b)) {
703
703
  if (a.length !== b.length)
704
704
  return false;
@@ -798,9 +798,8 @@ var Lits = (function (exports) {
798
798
  // Use relative error for larger values
799
799
  return diff / (absA + absB) < epsilon;
800
800
  }
801
- function approxZero(value, epsilon) {
802
- if (epsilon === void 0) { epsilon = EPSILON; }
803
- return Math.abs(value) < epsilon;
801
+ function approxZero(value) {
802
+ return Math.abs(value) < EPSILON;
804
803
  }
805
804
 
806
805
  // isArray not needed, use Array.isArary
@@ -2561,30 +2560,6 @@ var Lits = (function (exports) {
2561
2560
  },
2562
2561
  paramCount: {},
2563
2562
  },
2564
- '~': {
2565
- evaluate: function (params, sourceCodeInfo) {
2566
- var _a;
2567
- var _b = __read(getNumberVectorOrMatrixOperation([params[0], params[1]], sourceCodeInfo), 2), operation = _b[0], operands = _b[1];
2568
- var eplsilon = (_a = params[2]) !== null && _a !== void 0 ? _a : 1e-10;
2569
- assertNumber(eplsilon, sourceCodeInfo, { positive: true, finite: true });
2570
- if (operation === 'number') {
2571
- var _c = __read(operands, 2), first = _c[0], second = _c[1];
2572
- return approxEqual(first, second, eplsilon);
2573
- }
2574
- else if (operation === 'vector') {
2575
- var firstVector = operands[0];
2576
- var secondVector_1 = operands[1];
2577
- return firstVector.every(function (val, i) { return approxEqual(val, secondVector_1[i], eplsilon); });
2578
- }
2579
- else {
2580
- var firstMatrix = operands[0];
2581
- var secondMatrix_1 = operands[1];
2582
- return firstMatrix.every(function (row, i) { return row.every(function (val, j) { return approxEqual(val, secondMatrix_1[i][j], eplsilon); }); });
2583
- }
2584
- },
2585
- paramCount: { min: 2, max: 3 },
2586
- aliases: ['≈'],
2587
- },
2588
2563
  'quot': {
2589
2564
  evaluate: function (params, sourceCodeInfo) {
2590
2565
  var _a = __read(getNumberVectorOrMatrixOperation(params, sourceCodeInfo), 2), operation = _a[0], operands = _a[1];
@@ -2593,13 +2568,13 @@ var Lits = (function (exports) {
2593
2568
  }
2594
2569
  else if (operation === 'vector') {
2595
2570
  var firstVector = operands[0];
2596
- var secondVector_2 = operands[1];
2597
- return firstVector.map(function (val, i) { return Math.trunc(val / secondVector_2[i]); });
2571
+ var secondVector_1 = operands[1];
2572
+ return firstVector.map(function (val, i) { return Math.trunc(val / secondVector_1[i]); });
2598
2573
  }
2599
2574
  else {
2600
2575
  var firstMatrix = operands[0];
2601
- var secondMatrix_2 = operands[1];
2602
- return firstMatrix.map(function (row, i) { return row.map(function (val, j) { return Math.trunc(val / secondMatrix_2[i][j]); }); });
2576
+ var secondMatrix_1 = operands[1];
2577
+ return firstMatrix.map(function (row, i) { return row.map(function (val, j) { return Math.trunc(val / secondMatrix_1[i][j]); }); });
2603
2578
  }
2604
2579
  },
2605
2580
  paramCount: 2,
@@ -2613,19 +2588,19 @@ var Lits = (function (exports) {
2613
2588
  }
2614
2589
  else if (operation === 'vector') {
2615
2590
  var firstVector = operands[0];
2616
- var secondVector_3 = operands[1];
2591
+ var secondVector_2 = operands[1];
2617
2592
  return firstVector.map(function (dividend, i) {
2618
- var divisor = secondVector_3[i];
2593
+ var divisor = secondVector_2[i];
2619
2594
  var quotient = Math.floor(dividend / divisor);
2620
2595
  return dividend - divisor * quotient;
2621
2596
  });
2622
2597
  }
2623
2598
  else {
2624
2599
  var firstMatrix = operands[0];
2625
- var secondMatrix_3 = operands[1];
2600
+ var secondMatrix_2 = operands[1];
2626
2601
  return firstMatrix.map(function (row, i) { return row.map(function (val, j) {
2627
- var quotient = Math.floor(val / secondMatrix_3[i][j]);
2628
- return val - secondMatrix_3[i][j] * quotient;
2602
+ var quotient = Math.floor(val / secondMatrix_2[i][j]);
2603
+ return val - secondMatrix_2[i][j] * quotient;
2629
2604
  }); });
2630
2605
  }
2631
2606
  },
@@ -2639,13 +2614,13 @@ var Lits = (function (exports) {
2639
2614
  }
2640
2615
  else if (operation === 'vector') {
2641
2616
  var firstVector = operands[0];
2642
- var secondVector_4 = operands[1];
2643
- return firstVector.map(function (dividend, i) { return dividend % secondVector_4[i]; });
2617
+ var secondVector_3 = operands[1];
2618
+ return firstVector.map(function (dividend, i) { return dividend % secondVector_3[i]; });
2644
2619
  }
2645
2620
  else {
2646
2621
  var firstMatrix = operands[0];
2647
- var secondMatrix_4 = operands[1];
2648
- return firstMatrix.map(function (row, i) { return row.map(function (dividend, j) { return dividend % secondMatrix_4[i][j]; }); });
2622
+ var secondMatrix_3 = operands[1];
2623
+ return firstMatrix.map(function (row, i) { return row.map(function (dividend, j) { return dividend % secondMatrix_3[i][j]; }); });
2649
2624
  }
2650
2625
  },
2651
2626
  paramCount: 2,
@@ -2695,13 +2670,13 @@ var Lits = (function (exports) {
2695
2670
  }
2696
2671
  else if (operation === 'vector') {
2697
2672
  var firstVector = operands[0];
2698
- var secondVector_5 = operands[1];
2699
- return firstVector.map(function (base, i) { return Math.pow(base, secondVector_5[i]); });
2673
+ var secondVector_4 = operands[1];
2674
+ return firstVector.map(function (base, i) { return Math.pow(base, secondVector_4[i]); });
2700
2675
  }
2701
2676
  else {
2702
2677
  var firstMatrix = operands[0];
2703
- var secondMatrix_5 = operands[1];
2704
- return firstMatrix.map(function (row, i) { return row.map(function (base, j) { return Math.pow(base, secondMatrix_5[i][j]); }); });
2678
+ var secondMatrix_4 = operands[1];
2679
+ return firstMatrix.map(function (row, i) { return row.map(function (base, j) { return Math.pow(base, secondMatrix_4[i][j]); }); });
2705
2680
  }
2706
2681
  },
2707
2682
  paramCount: 2,
@@ -3113,6 +3088,40 @@ var Lits = (function (exports) {
3113
3088
  },
3114
3089
  paramCount: 1,
3115
3090
  },
3091
+ 'to-rad': {
3092
+ evaluate: function (params, sourceCodeInfo) {
3093
+ var _a = __read(getNumberVectorOrMatrixOperation(params, sourceCodeInfo), 2), operation = _a[0], operands = _a[1];
3094
+ if (operation === 'number') {
3095
+ return (operands[0] * Math.PI) / 180;
3096
+ }
3097
+ else if (operation === 'vector') {
3098
+ var vector = operands[0];
3099
+ return vector.map(function (val) { return (val * Math.PI) / 180; });
3100
+ }
3101
+ else {
3102
+ var matrix = operands[0];
3103
+ return matrix.map(function (row) { return row.map(function (val) { return (val * Math.PI) / 180; }); });
3104
+ }
3105
+ },
3106
+ paramCount: 1,
3107
+ },
3108
+ 'to-deg': {
3109
+ evaluate: function (params, sourceCodeInfo) {
3110
+ var _a = __read(getNumberVectorOrMatrixOperation(params, sourceCodeInfo), 2), operation = _a[0], operands = _a[1];
3111
+ if (operation === 'number') {
3112
+ return (operands[0] * 180) / Math.PI;
3113
+ }
3114
+ else if (operation === 'vector') {
3115
+ var vector = operands[0];
3116
+ return vector.map(function (val) { return (val * 180) / Math.PI; });
3117
+ }
3118
+ else {
3119
+ var matrix = operands[0];
3120
+ return matrix.map(function (row) { return row.map(function (val) { return (val * 180) / Math.PI; }); });
3121
+ }
3122
+ },
3123
+ paramCount: 1,
3124
+ },
3116
3125
  };
3117
3126
 
3118
3127
  function isEqual(_a, sourceCodeInfo) {
@@ -3732,9 +3741,9 @@ var Lits = (function (exports) {
3732
3741
  },
3733
3742
  'zero?': {
3734
3743
  evaluate: function (_a, sourceCodeInfo) {
3735
- var _b = __read(_a, 1), first = _b[0];
3736
- assertNumber(first, sourceCodeInfo, { finite: true });
3737
- return first === 0;
3744
+ var _b = __read(_a, 1), value = _b[0];
3745
+ assertNumber(value, sourceCodeInfo, { finite: true });
3746
+ return Math.abs(value) < EPSILON;
3738
3747
  },
3739
3748
  paramCount: 1,
3740
3749
  },
@@ -6580,6 +6589,10 @@ var Lits = (function (exports) {
6580
6589
  return vector.map(function (item) { return item * scalar; });
6581
6590
  }
6582
6591
 
6592
+ function length(vector) {
6593
+ return Math.sqrt(vector.reduce(function (acc, item) { return acc + Math.pow(item, 2); }, 0));
6594
+ }
6595
+
6583
6596
  var linearAlgebraNormalExpression = {
6584
6597
  'lin:rotate2d': {
6585
6598
  evaluate: function (_a, sourceCodeInfo) {
@@ -6904,7 +6917,7 @@ var Lits = (function (exports) {
6904
6917
  evaluate: function (_a, sourceCodeInfo) {
6905
6918
  var _b = __read(_a, 1), vector = _b[0];
6906
6919
  assertNonEmptyVector(vector, sourceCodeInfo);
6907
- return Math.sqrt(vector.reduce(function (acc, val) { return acc + val * val; }, 0));
6920
+ return length(vector);
6908
6921
  },
6909
6922
  paramCount: 1,
6910
6923
  aliases: ['lin:l2-norm', 'lin:length'],
@@ -7210,6 +7223,31 @@ var Lits = (function (exports) {
7210
7223
  },
7211
7224
  paramCount: 2,
7212
7225
  },
7226
+ 'lin:to-polar': {
7227
+ evaluate: function (_a, sourceCodeInfo) {
7228
+ var _b = __read(_a, 1), vector = _b[0];
7229
+ assert2dVector(vector, sourceCodeInfo);
7230
+ if (isZeroVector(vector)) {
7231
+ return [0, 0];
7232
+ }
7233
+ var r = Math.sqrt(Math.pow(vector[0], 2) + Math.pow(vector[1], 2));
7234
+ var theta = Math.atan2(vector[1], vector[0]);
7235
+ return [r, theta];
7236
+ },
7237
+ paramCount: 1,
7238
+ },
7239
+ 'lin:from-polar': {
7240
+ evaluate: function (_a, sourceCodeInfo) {
7241
+ var _b = __read(_a, 1), polar = _b[0];
7242
+ assert2dVector(polar, sourceCodeInfo);
7243
+ var _c = __read(polar, 2), r = _c[0], theta = _c[1];
7244
+ if (r === 0) {
7245
+ return [0, 0];
7246
+ }
7247
+ return [r * Math.cos(theta), r * Math.sin(theta)];
7248
+ },
7249
+ paramCount: 1,
7250
+ },
7213
7251
  };
7214
7252
 
7215
7253
  /**
@@ -12892,8 +12930,6 @@ var Lits = (function (exports) {
12892
12930
  '=', // equal
12893
12931
  '!=', // not equal
12894
12932
  '≠', // not equal
12895
- '~', // approximate
12896
- '≈', // approximate
12897
12933
  '&', // bitwise AND
12898
12934
  'xor', // bitwise XOR
12899
12935
  '|', // bitwise OR
@@ -12903,6 +12939,8 @@ var Lits = (function (exports) {
12903
12939
  '|>', // pipe
12904
12940
  ];
12905
12941
  var otherOperators = [
12942
+ '?', // conditional operator
12943
+ ':', // conditional operator
12906
12944
  '->', // lambda
12907
12945
  '...', // rest
12908
12946
  '.', // property accessor
@@ -12912,17 +12950,12 @@ var Lits = (function (exports) {
12912
12950
  ];
12913
12951
  var symbolicOperators = __spreadArray(__spreadArray([], __read(binaryOperators), false), __read(otherOperators), false);
12914
12952
  var nonFunctionOperators = [
12915
- '??',
12916
- '&&',
12917
- '||',
12918
12953
  'comment',
12919
12954
  'cond',
12920
12955
  'def',
12921
12956
  'defined?',
12922
- // 'defn',
12923
12957
  'do',
12924
12958
  'doseq',
12925
- // 'fn',
12926
12959
  'if',
12927
12960
  'let',
12928
12961
  'loop',
@@ -13500,8 +13533,9 @@ var Lits = (function (exports) {
13500
13533
  }, '');
13501
13534
  }
13502
13535
 
13503
- var exponentiationPrecedence = 11;
13504
- var binaryFunctionalOperatorPrecedence = 2;
13536
+ var exponentiationPrecedence = 12;
13537
+ var binaryFunctionalOperatorPrecedence = 3;
13538
+ var conditionalOperatorPrecedence = 1;
13505
13539
  var placeholderRegexp = /^\$([1-9]\d?)?$/;
13506
13540
  function withSourceCodeInfo(node, sourceCodeInfo) {
13507
13541
  if (sourceCodeInfo) {
@@ -13516,40 +13550,39 @@ var Lits = (function (exports) {
13516
13550
  case '*': // multiplication
13517
13551
  case '/': // division
13518
13552
  case '%': // remainder
13519
- return 10;
13553
+ return 11;
13520
13554
  case '+': // addition
13521
13555
  case '-': // subtraction
13522
- return 9;
13556
+ return 10;
13523
13557
  case '<<': // left shift
13524
13558
  case '>>': // signed right shift
13525
13559
  case '>>>': // unsigned right shift
13526
- return 8;
13560
+ return 9;
13527
13561
  case '++': // string concatenation
13528
- return 7;
13562
+ return 8;
13529
13563
  case '<': // less than
13530
13564
  case '<=': // less than or equal
13531
13565
  case '≤': // less than or equal
13532
13566
  case '>': // greater than
13533
13567
  case '>=': // greater than or equal
13534
13568
  case '≥': // greater than or equal
13535
- return 6;
13569
+ return 7;
13536
13570
  case '=': // equal
13537
13571
  case '!=': // not equal
13538
13572
  case '≠': // not equal
13539
- case '~': // approximate
13540
- case '≈': // approximate
13541
- return 5;
13573
+ return 6;
13542
13574
  case '&': // bitwise AND
13543
13575
  case 'xor': // bitwise XOR
13544
13576
  case '|': // bitwise OR
13545
- return 4;
13577
+ return 5;
13546
13578
  case '&&': // logical AND
13547
13579
  case '||': // logical OR
13548
13580
  case '??': // nullish coalescing
13549
- return 3;
13581
+ return 4;
13582
+ // leave room for binaryFunctionalOperatorPrecedence = 3
13550
13583
  case '|>': // pipe
13551
- return 1;
13552
- // leave room for binaryFunctionalOperatorPrecedence = 2
13584
+ return 2;
13585
+ // leave room for conditionalOperatorPrecedence = 1
13553
13586
  /* v8 ignore next 2 */
13554
13587
  default:
13555
13588
  throw new LitsError("Unknown binary operator: ".concat(operatorSign), sourceCodeInfo);
@@ -13591,21 +13624,21 @@ var Lits = (function (exports) {
13591
13624
  case '&':
13592
13625
  case 'xor':
13593
13626
  case '|':
13594
- case '~':
13595
- case '≈':
13596
13627
  case '|>':
13597
13628
  return createNamedNormalExpressionNode(symbolNode, [left, right], sourceCodeInfo);
13598
13629
  case '&&':
13599
13630
  case '||':
13600
13631
  case '??':
13601
13632
  return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes[operatorName], [left, right]]], sourceCodeInfo);
13602
- /* v8 ignore next 10 */
13633
+ /* v8 ignore next 11 */
13603
13634
  case '.':
13604
13635
  case ';':
13605
13636
  case ':=':
13606
13637
  case ',':
13607
13638
  case '->':
13608
13639
  case '...':
13640
+ case '?':
13641
+ case ':':
13609
13642
  throw new LitsError("Unknown binary operator: ".concat(operatorName), sourceCodeInfo);
13610
13643
  default:
13611
13644
  throw new LitsError("Unknown binary operator: ".concat(operatorName), sourceCodeInfo);
@@ -13721,6 +13754,19 @@ var Lits = (function (exports) {
13721
13754
  }
13722
13755
  left = createNamedNormalExpressionNode(operatorSymbol, [left, right], operator[2]);
13723
13756
  }
13757
+ else if ((operator === null || operator === void 0 ? void 0 : operator[1]) === '?') {
13758
+ if (conditionalOperatorPrecedence <= precedence) {
13759
+ break;
13760
+ }
13761
+ this.advance();
13762
+ var trueNode = this.parseExpression();
13763
+ if (!isOperatorToken(this.peek(), ':')) {
13764
+ throw new LitsError('Expected :', this.peekSourceCodeInfo());
13765
+ }
13766
+ this.advance();
13767
+ var falseNode = this.parseExpression();
13768
+ left = withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.if, [left, trueNode, falseNode]]], left[2]);
13769
+ }
13724
13770
  else {
13725
13771
  break;
13726
13772
  }
@@ -14978,7 +15024,6 @@ var Lits = (function (exports) {
14978
15024
  '-',
14979
15025
  '*',
14980
15026
  '/',
14981
- '~',
14982
15027
  'mod',
14983
15028
  'rem',
14984
15029
  'quot',
@@ -15010,6 +15055,8 @@ var Lits = (function (exports) {
15010
15055
  'asinh',
15011
15056
  'acosh',
15012
15057
  'atanh',
15058
+ 'to-rad',
15059
+ 'to-deg',
15013
15060
  ],
15014
15061
  functional: [
15015
15062
  '|>',
@@ -15282,6 +15329,8 @@ var Lits = (function (exports) {
15282
15329
  'lin:cross-correlation',
15283
15330
  'lin:rref',
15284
15331
  'lin:solve',
15332
+ 'lin:to-polar',
15333
+ 'lin:from-polar',
15285
15334
  ],
15286
15335
  numberTheory: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(getNumberTheorySequenceNames('abundant')), false), __read(getNumberTheorySequenceNames('bell')), false), __read(getNumberTheorySequenceNames('catalan')), false), __read(getNumberTheorySequenceNames('composite')), false), __read(getNumberTheorySequenceNames('factorial')), false), __read(getNumberTheorySequenceNames('fibonacci')), false), __read(getNumberTheorySequenceNames('geometric')), false), __read(getNumberTheorySequenceNames('golomb')), false), __read(getNumberTheorySequenceNames('happy')), false), __read(getNumberTheorySequenceNames('look-and-say')), false), __read(getNumberTheorySequenceNames('lucas')), false), __read(getNumberTheorySequenceNames('lucky')), false), __read(getNumberTheorySequenceNames('mersenne')), false), __read(getNumberTheorySequenceNames('padovan')), false), __read(getNumberTheorySequenceNames('partition')), false), __read(getNumberTheorySequenceNames('pell')), false), __read(getNumberTheorySequenceNames('perfect')), false), __read(getNumberTheorySequenceNames('perfect-cube')), false), __read(getNumberTheorySequenceNames('perfect-power')), false), __read(getNumberTheorySequenceNames('perfect-square')), false), __read(getNumberTheorySequenceNames('polygonal')), false), __read(getNumberTheorySequenceNames('prime')), false), __read(getNumberTheorySequenceNames('recaman')), false), __read(getNumberTheorySequenceNames('sylvester')), false), __read(getNumberTheorySequenceNames('thue-morse')), false), __read(getNumberTheorySequenceNames('tribonacci')), false), [
15287
15336
  'nth:collatz-seq',
@@ -16991,29 +17040,6 @@ var Lits = (function (exports) {
16991
17040
  '[[1, 2, 3], [4, 5, 6]] / 2',
16992
17041
  ],
16993
17042
  },
16994
- '~': {
16995
- title: '~',
16996
- category: 'Math',
16997
- linkName: '-tilde',
16998
- returns: {
16999
- type: ['number', 'vector', 'matrix'],
17000
- },
17001
- args: __assign({}, mixedOperatorArgs),
17002
- variants: [
17003
- { argumentNames: ['a, b'] },
17004
- ],
17005
- description: 'The `~` checks for approximately equal values, returning `true` if the absolute difference between the two numbers is less than or equal to a small threshold (default: `1e-10`). It works on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it checks each element for approximate equality.',
17006
- examples: [
17007
- '~(0.1, 0.1)',
17008
- '~(0.1, 0.10000000000001)',
17009
- '~(0.1, 0.2)',
17010
- '~(0.1, 0.101, 0.1)',
17011
- '~([1, 2, 3], [1.00000000000001, 2.00000000000001, 3.00000000000001])',
17012
- '~([1, 2, 3], [1.1, 2.1, 3.1])',
17013
- '~([[1, 2, 3], [1, 2, 3]], [[1.01, 2.01, 3.01], [1.01, 2.01, 3.01]], 0.1)',
17014
- ],
17015
- aliases: ['≈'],
17016
- },
17017
17043
  'mod': {
17018
17044
  title: 'mod',
17019
17045
  category: 'Math',
@@ -17791,6 +17817,56 @@ var Lits = (function (exports) {
17791
17817
  'atanh([[0.1, 0.2], [0.3, 0.4]])',
17792
17818
  ],
17793
17819
  },
17820
+ 'to-rad': {
17821
+ title: 'to-rad',
17822
+ category: 'Math',
17823
+ linkName: 'to-rad',
17824
+ returns: {
17825
+ type: ['number', 'vector', 'matrix'],
17826
+ },
17827
+ args: {
17828
+ x: {
17829
+ type: ['number', 'vector', 'matrix'],
17830
+ },
17831
+ },
17832
+ variants: [
17833
+ { argumentNames: ['x'] },
17834
+ ],
17835
+ description: 'The `to-rad` function converts an angle from degrees to radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',
17836
+ examples: [
17837
+ 'to-rad(0)',
17838
+ 'to-rad(90)',
17839
+ 'to-rad(180)',
17840
+ 'to-rad(360)',
17841
+ 'to-rad([0, 90, 180])',
17842
+ 'to-rad([[0, 90], [180, 360]])',
17843
+ ],
17844
+ },
17845
+ 'to-deg': {
17846
+ title: 'to-deg',
17847
+ category: 'Math',
17848
+ linkName: 'to-deg',
17849
+ returns: {
17850
+ type: ['number', 'vector', 'matrix'],
17851
+ },
17852
+ args: {
17853
+ x: {
17854
+ type: ['number', 'vector', 'matrix'],
17855
+ },
17856
+ },
17857
+ variants: [
17858
+ { argumentNames: ['x'] },
17859
+ ],
17860
+ description: 'The `to-deg` function converts an angle from radians to degrees, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',
17861
+ examples: [
17862
+ 'to-deg(0)',
17863
+ 'to-deg(PI)',
17864
+ 'to-deg(PI / 2)',
17865
+ 'to-deg(3 * PI / 2)',
17866
+ 'to-deg([0, PI, PI / 2])',
17867
+ 'to-deg([[0, PI], [PI / 2, 3 * PI / 2]])',
17868
+ ],
17869
+ },
17794
17870
  };
17795
17871
 
17796
17872
  var miscReference = {
@@ -24244,6 +24320,51 @@ var Lits = (function (exports) {
24244
24320
  'lin:solve([[2, 3], [1, -1]], [8, 2])',
24245
24321
  ],
24246
24322
  },
24323
+ 'lin:to-polar': {
24324
+ title: 'lin:to-polar',
24325
+ category: 'Linear Algebra',
24326
+ description: 'Converts a 2D vector to polar coordinates.',
24327
+ linkName: 'lin-colon-to-polar',
24328
+ returns: {
24329
+ type: 'vector',
24330
+ },
24331
+ args: {
24332
+ vector: {
24333
+ type: 'vector',
24334
+ description: '2D Vector to convert.',
24335
+ },
24336
+ },
24337
+ variants: [
24338
+ { argumentNames: ['vector'] },
24339
+ ],
24340
+ examples: [
24341
+ 'lin:to-polar([1, 2])',
24342
+ 'lin:to-polar([3, 4])',
24343
+ ],
24344
+ },
24345
+ 'lin:from-polar': {
24346
+ title: 'lin:from-polar',
24347
+ category: 'Linear Algebra',
24348
+ description: 'Converts polar coordinates to a 2D vector.',
24349
+ linkName: 'lin-colon-from-polar',
24350
+ returns: {
24351
+ type: 'vector',
24352
+ },
24353
+ args: {
24354
+ polar: {
24355
+ type: 'vector',
24356
+ description: 'Polar coordinates to convert.',
24357
+ },
24358
+ },
24359
+ variants: [
24360
+ { argumentNames: ['polar'] },
24361
+ ],
24362
+ examples: [
24363
+ 'lin:from-polar([1, PI / 4])',
24364
+ 'lin:from-polar([1, 0])',
24365
+ 'lin:from-polar([1, -PI / 2])',
24366
+ ],
24367
+ },
24247
24368
  };
24248
24369
 
24249
24370
  var predicateReference = {