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

Scheme's apply and map analogs in Metta #53

Open
CICS-Oleg opened this issue Sep 20, 2024 · 5 comments
Open

Scheme's apply and map analogs in Metta #53

CICS-Oleg opened this issue Sep 20, 2024 · 5 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@CICS-Oleg
Copy link
Contributor

Do we have ones? I've made my own funtional variants inspired by SICP examples, but it seems they are lacking efficiency.

@CICS-Oleg CICS-Oleg added help wanted Extra attention is needed question Further information is requested labels Sep 20, 2024
@Necr0x0Der
Copy link
Contributor

We don't have a library for them. Their implementation in pure metta will be relatively slow, and this is possibly the reason why we still don't have a library for them. There are two options (besides keeping things as is):

  1. implement functional stuff in pure metta and hope that in the future it will be compilable
  2. implement more efficient ("precompiled") versions in Rust. In fact, we discussed that some recursion schemes could be a part of Atomspace implementation. For example, it doesn't make sense to retrieve a lot of atoms from DAS and filter them on the interpreter side. At least, map-reduce framework on the DAS (or other type of space) side would make sense. But it will not cover all higher-order functional programming.
    The question is whether we want 1 or 2 or both... @vsbogd , do you have any thoughts on this?

@vsbogd
Copy link
Contributor

vsbogd commented Sep 20, 2024

We actually have a functional version of map-atom and foldl-atom in stdlib. @CICS-Oleg have you tried them?
I would implement both options using different names. Functional version can become faster if it is compiled or if interpreter performance is better. Native version can be used as a manual optimization.

@CICS-Oleg
Copy link
Contributor Author

have you tried them?

Not yet. I searched for them but perhaps inattentively. Where are they?

@CICS-Oleg
Copy link
Contributor Author

@vsbogd Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants