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

(repr "A") is incorrect #818

Closed
ngeiswei opened this issue Dec 12, 2024 · 4 comments · Fixed by #828
Closed

(repr "A") is incorrect #818

ngeiswei opened this issue Dec 12, 2024 · 4 comments · Fixed by #828
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ngeiswei
Copy link
Contributor

ngeiswei commented Dec 12, 2024

Describe the bug

I think the output of (repr "A") is incorrect.

To Reproduce
Run

(repr "A")

Expected behavior

["\"A\""]

Actual behavior

[""A""]

Additional context

  • MeTTa version: 0.2.1+g8795f59b.d20241129
  • (repr 'A') or (repr A) is correct, only (repr "A") isn't.
@vsbogd
Copy link
Collaborator

vsbogd commented Dec 12, 2024

Looks like the issue with string atom formatting in Rust. For example !(foo "\"A\"") (which is not reduced) also is printed as (foo ""A"").

@vsbogd
Copy link
Collaborator

vsbogd commented Dec 12, 2024

@ngeiswei does it break something or you just reported it to fix at some point?

@vsbogd vsbogd added bug Something isn't working good first issue Good for newcomers labels Dec 12, 2024
@ngeiswei
Copy link
Contributor Author

It doesn't break my code as long as I use MeTTaLog, which behaves correctly. It's just that I like to be able to switch back and forth between MeTTaLog and HE.

@ngeiswei
Copy link
Contributor Author

ngeiswei commented Dec 13, 2024

I think a deeper problem is that MeTTa should show the string representation instead of printing it.

For instance

! "A\nB"

should output

["A\nB"]

instead of

["A
B"]

However

!(println! "A\nB")

should output

A
B

as it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants