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 capture should be supported #199

Open
ngeiswei opened this issue Nov 21, 2024 · 4 comments
Open

Built-in capture should be supported #199

ngeiswei opened this issue Nov 21, 2024 · 4 comments
Labels
bug Issues that represent errors in the code compatibility Issues related compatibility with other versions of MeTTa started Work has begun on this issue

Comments

@ngeiswei
Copy link
Contributor

What is your problem?

The built-in capture of https://github.com/trueagi-io/hyperon-experimental is not supported.

How to reproduce your problem?

Run the following metta program

(= (f) a)
(= (f) a)
!(unique (capture (f)))

What should it normally output?

[a]

What does it output instead?

[(capture a)]

What else do you have to say?

Unlike https://github.com/trueagi-io/hyperon-experimental, MeTTaLog properly supports unique, therefore capture in that example isn't useful after all. I realized that after writing most of the issue. I thought I would submit it anyway since capture should eventually be supported.

@ngeiswei ngeiswei added the compatibility Issues related compatibility with other versions of MeTTa label Nov 21, 2024
@TeamSPoon
Copy link
Collaborator

TeamSPoon commented Nov 22, 2024

I need help understanting capture:

(@doc capture
  (@desc "Wraps an atom and capture the current space")
  (@params (
    (@param "Function name which space need to be captured")))
  (@return "Function"))

I always thought that it meant that it made a captured copy of the space so like...

(foo)
(bar)
(= (baz) 1)
!(capture the-space) ; [the-space]
!(the-space)  ; [(foo), (bar), (= (baz) 1)]

but it does something different in H-E. what it does i cant quite tell.
I need some sort of test or example to understand it. I cant find any in H-E

@TeamSPoon TeamSPoon added the bug Issues that represent errors in the code label Nov 22, 2024
@ngeiswei
Copy link
Contributor Author

@vsbogd, @Necr0x0Der, what is the formal definition of capture?

@vsbogd
Copy link

vsbogd commented Nov 26, 2024

Capture inputs the function and returns the function which evaluation is bound to the current space. Main goal is to "capture" the passed function with its local space context and be able passing it into another space for evaluation.
See this comment to find an example of usage trueagi-io/hyperon-experimental#354 (comment)

@vsbogd
Copy link

vsbogd commented Nov 26, 2024

"capture" the passed function with its local space context

In fact capture captures the space in which it is used.

@TeamSPoon TeamSPoon added the started Work has begun on this issue label Dec 5, 2024
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 compatibility Issues related compatibility with other versions of MeTTa started Work has begun on this issue
Projects
None yet
Development

No branches or pull requests

3 participants