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

Document that parsing 'N' is different from N #1412

Open
c3d opened this issue Feb 3, 2025 · 1 comment
Open

Document that parsing 'N' is different from N #1412

c3d opened this issue Feb 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@c3d
Copy link
Owner

c3d commented Feb 3, 2025

When parsing 'N', DB48X creates an equation (type 9), whereas HP calculators create a symbol (type 6). This may cause various problems.

One such problem was already reported for the following program fragment:

'A' 1 →List

This produces { 'A' } on DB48x vs. { A } on HP50G. As a result, a program that used such a fragment to generate { 10 0 N } as an argument for Input was incorrectly generating something that Input would not recognize as requesting numerical input.

@c3d c3d added the bug Something isn't working label Feb 3, 2025
@c3d
Copy link
Owner Author

c3d commented Feb 4, 2025

After evaluating options and how HP calculators behave, it looks like they are "complicating" things quite a bit.

Notably, « 'N' N » parses as a program with a quoted and an unquoted name, but { 'N' N } parses as { N N }, which is not very consistent, and makes it quite difficult to programmatically build a program containing a quoted name.

As a matter of fact, I have not found a good way short of parsing text.

In any case, the implications seem to be way too far-reaching for the change to be worth it at that stage. So it's probably better to just document it.

And to reword this issue.

@c3d c3d changed the title Create a symbol when parsing 'N' Document that parsing 'N' is different from N Feb 4, 2025
c3d added a commit that referenced this issue Feb 6, 2025
On HP calculators, `'N'` is a symbol, not an expression, with the
exception of programs.

In other words, `« 'N' N »` parses as you would expect, like on DB48x,
but `{ 'N' N }` parses as `{ N N }`, which makes it a bit difficult to
programmatically build programs without parsing text.

The DB48x approach appears more consistent and easier, so document it
instead of trying to mimic the exact behaviour of HP calculators.

Fixes: #1412

Signed-off-by: Christophe de Dinechin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant