- Notifications
You must be signed in to change notification settings - Fork51
fix: various metadata preservation issues (boxing, LaTeX-parsing)#212
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Changes fromall commits
425bd31100e5262534b8e7dd19703e25d947ba30ba5c15292File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { Complex } from 'complex-esm'; | ||
| import type { | ||
| Attributes, | ||
| Expression, | ||
| MathJsonNumber, | ||
| MathJsonString, | ||
| @@ -2036,10 +2037,7 @@ export type EvaluateOptions = { | ||
| * @category Boxed Expression | ||
| */ | ||
| export type Metadata = Pick<Attributes, 'latex' | 'wikidata'>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. May wish to revert this: personally just thought it made sense. | ||
| /** | ||
| * When a unitless value is passed to or returned from a trigonometric function, | ||
| @@ -2277,7 +2275,7 @@ export interface IComputeEngine extends IBigNum { | ||
| _fn( | ||
| name: string, | ||
| ops: ReadonlyArray<BoxedExpression>, | ||
| options?: { canonical?: boolean; metadata?: Metadata } | ||
| ): BoxedExpression; | ||
| parse( | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1924,7 +1924,7 @@ export class ComputeEngine implements IComputeEngine { | ||
| return this._fn( | ||
| 'Rational', | ||
| [this.number(value[0]), this.number(value[1])], | ||
| { metadata, canonical: false } | ||
| ); | ||
| } | ||
| @@ -2015,10 +2015,13 @@ export class ComputeEngine implements IComputeEngine { | ||
| _fn( | ||
| name: MathJsonIdentifier, | ||
| ops: ReadonlyArray<BoxedExpression>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Quite sure that that was a mistake, or at least non-desirable | ||
| options?: { canonical?: boolean; metadata?: Metadata } | ||
| ): BoxedExpression { | ||
| const canonical = options?.canonical ?? true; | ||
| return new BoxedFunction(this, name, ops, { | ||
| metadata: options?.metadata, | ||
| canonical, | ||
| }); | ||
| } | ||
| /** | ||