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

cdr-atom when called with a list of variables #488

Closed
noskill opened this issue Nov 7, 2023 · 6 comments
Closed

cdr-atom when called with a list of variables #488

noskill opened this issue Nov 7, 2023 · 6 comments
Assignees

Comments

@noskill
Copy link
Contributor

noskill commented Nov 7, 2023

!(cdr-atom ($A $B $C))

@noskill noskill added the blocker label Nov 7, 2023
@vsbogd
Copy link
Collaborator

vsbogd commented Nov 7, 2023

@noskill , please explain what do you expect, what do you see and which version of the interpreter do you use: Rust or minimal MeTTa?

@Necr0x0Der
Copy link
Collaborator

I dug into the issue a little bit deeper. The original problem was that

(: makelist (-> Atom Atom))
(= (makelist $x)
   (if (== () $x) Nil
       (let $cdr (cdr-atom $x) (Cons (car-atom $x) (makelist $cdr)))))

! (makelist ($A $B $C))

doesn't work even after #473 . I encountered that !(cdr-atom ($A $B $C)) doesn't work returning (Error (cdr-atom $C) cdr-atom expects one argument: expression), which turned out to be confusing, because it looked like !(cdr-atom ($A $B $C)) is incorrectly reduced to (cdr-atom $C). But it appeared that this behavior depends on the content of the space that implies that some matching takes place.
Basically, it appeared that #473 doesn't stop reduction of variable atoms by default (as it was mentioned somewhere). If you remove "variable_operation" from default = in Cargo.toml, the code above starts to work. @noskill , take a note.

@noskill
Copy link
Contributor Author

noskill commented Nov 7, 2023

@Necr0x0Der does it work on minimal metta?

@noskill
Copy link
Contributor Author

noskill commented Nov 7, 2023

@vsbogd I expect !(cdr-atom ($A $B $C)) to return ($B $C), trying it on minimal metta

@noskill noskill added the minimal label Nov 7, 2023
@noskill
Copy link
Contributor Author

noskill commented Nov 7, 2023

@Necr0x0Der when i run with python runner process never stops, when i run with rust runner it prints

[(Cons $A (Cons Cons (Cons (Error (car-atom $C) car-atom expects one argument: expression) (Cons (Cons Error (Cons (Error (cdr-atom $C) cdr-atom expects one argument: expression) (Cons cdr-atom expects one argument: expression Nil))) Nil))))]

@Necr0x0Der
Copy link
Collaborator

Yes, it seems to not work on Minimal MeTTa, so we can reopen it specifically for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants