Giter Club home page Giter Club logo

Comments (5)

Necr0x0Der avatar Necr0x0Der commented on August 16, 2024 1

-| looks ok. It could be convenient in certain cases. OTOH, if we have multiple type traits (e.g. determinism, totality, etc.), then it might be less convenient. However, we can always make -| just a syntactic sugar...

from hyperon-experimental.

ngeiswei avatar ngeiswei commented on August 16, 2024

Term equality in pure MeTTa

It's awesome that term equality can be implemented in pure MeTTa, but how does it work? Why the following reduction path

(eq a a) -> (eq-wrap (pure-eq a a)) -> False

using the fourth then third equation, is inhibited?

Type annotation to indicate determinism

I like the idea of enforcing determinism in the type. I was wondering, as an alternative to Det, maybe to use a different application type constructor. For instance to indicate that foo is non-deterministic one could write

(: foo (-| $a $a Bool))

That is -> would still indicate deterministism, symbolizing that every input points to a single value, while -| would be used to indicate non-deterministism, symbolizing that some input may point to many values. Then it brings some concerns such as what to do when combining -> and -| like in

(: foo (-| $a (-> $a Bool))

etc. So not saying it is better than Det, but just a suggestion that crossed my mind. Maybe existing non-deterministic functional programming languages such as https://curry.pages.ps.informatik.uni-kiel.de/curry-lang.org/ could be a source of inspiration. I know nothing of such language so I cannot tell.

from hyperon-experimental.

vsbogd avatar vsbogd commented on August 16, 2024

Why the following reduction path (eq a a) -> (eq-wrap (pure-eq a a)) -> False using the fourth then third equation, is inhibited?

@ngeiswei the reason is that (pure-eq a a) is reduced to True before trying to reduce (eq-wrap (pure-eq a a)). From non-deterministic execution perspective this is not quite correct because interpreter should execute both paths. But this behavior is saved from the very first version and it allows doing tricks like above before this issue is resolved correctly.

from hyperon-experimental.

vsbogd avatar vsbogd commented on August 16, 2024

Using -| to designate non-deterministic paths sounds like an interesting idea. I don't even see any contradiction in constructions like (: foo (-| $a (-> $a Bool)). It can be interpreted as foo is a function which non-deterministically returns deterministic function (-> $a Bool).

It seems that type annotations are also required and using them to designate determinism or non-determinism can be even more simple from the code complexity perspective.

from hyperon-experimental.

Necr0x0Der avatar Necr0x0Der commented on August 16, 2024

From non-deterministic execution perspective this is not quite correct because interpreter should execute both paths.

Well, yes, this is an interesting point. I wonder whether this should be considered a bug or a feature :)
We can describe this as an intended behavior if we wish, but if some examples appear, in which it will be highly desirable to have "full non-determinism", then we can reconsider this. In any case, we shouldn't rely too much on this "feature" now I guess (although I wonder how many unit tests implicitly exploit it).

from hyperon-experimental.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.