Open CICS-Oleg opened 2 months ago
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?
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.
have you tried them?
Not yet. I searched for them but perhaps inattentively. Where are they?
Where are they?
https://github.com/trueagi-io/hyperon-experimental/blob/c775589c108d62d3f8f9ef2061e43031de0907ea/lib/src/metta/runner/stdlib_minimal.metta#L293 https://github.com/trueagi-io/hyperon-experimental/blob/c775589c108d62d3f8f9ef2061e43031de0907ea/lib/src/metta/runner/stdlib_minimal.metta#L309
@vsbogd Thank you!
Do we have ones? I've made my own funtional variants inspired by SICP examples, but it seems they are lacking efficiency.