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

Built-in get-type fails on a simple data construction #238

Open
ngeiswei opened this issue Jan 23, 2025 · 2 comments
Open

Built-in get-type fails on a simple data construction #238

ngeiswei opened this issue Jan 23, 2025 · 2 comments
Labels
bug Issues that represent errors in the code

Comments

@ngeiswei
Copy link
Contributor

ngeiswei commented Jan 23, 2025

What is the problem?

The built-in get-type does not work on a simple user defined type.

How to reproduce your problem?

Run the following program with MeTTaLog

(: Shape Type)
(: Box Shape)
(: Attribute Type)
(: MkShapeAttribute (-> Shape Attribute))
!(get-type (MkShapeAttribute Box))

What do you get?

[error [error [existence_error procedure [ / non_arg_violation_each 3 ]] [context [ / args_conform 4 ] $260]] [file /home/nilg/Work/SingularityNET/ai-dsl/experimental/ai-service-composition/english-to-chinese-song/bug.metta] (get-type (MkShapeAttribute Box))][

What would you normally expect?

[Attribute]

What else do you have to say?

The get-type calls on terms individually works, that is

!(get-type Shape)
!(get-type Box)
!(get-type Attribute)
!(get-type MkShapeAttribute)

properly outputs

[Type]
[Shape]
[Type]
[(-> Shape Attribute)]

It only fails when get-type is called on (MkShapeAttribute Box).

@ngeiswei ngeiswei added the bug Issues that represent errors in the code label Jan 23, 2025
TeamSPoon added a commit to logicmoo/metta-testsuite that referenced this issue Feb 18, 2025
…d unification.

- Tests how `match` and `remove-atom` handle indexed variables.
- Implements `match-alpha` for alpha-equivalent expressions.
- Introduces `match-unifiable` for variable-based unification.
- Includes an optimized indexed lookup version for efficiency.
- Related issue: trueagi-io/metta-wam#238
@TeamSPoon
Copy link
Collaborator

Fixed with with as the test logicmoo/metta-testsuite@059ed14

@ngeiswei
Copy link
Contributor Author

Maybe that is unimportant, but I want to point out that with interpreted MeTTaLog, it incorrectly outputs

[Attribute, Attribute]

While with transpiled MeTTaLog (mettalog --compile=full), it correctly outputs

[Attribute]

TeamSPoon added a commit to logicmoo/metta-wam that referenced this issue Feb 24, 2025
\
- Tests `get-type` on user-defined types, ensuring proper resolution.\
- Reproduces bug trueagi-io#238 where `get-type` fails on constructed terms.\
- Expected output: `(Attribute)`, observed: error.\
- Includes reference to the GitHub issue for tracking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that represent errors in the code
Projects
None yet
Development

No branches or pull requests

2 participants