Skip to content

Commit

Permalink
Merge branch 'trueagi-io:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DaddyWesker authored Oct 24, 2024
2 parents 8279ab8 + fe52f59 commit 1f0633d
Show file tree
Hide file tree
Showing 10 changed files with 418 additions and 258 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ members = [
resolver = "2"

[workspace.package]
version = "0.2.0"
version = "0.2.1"
edition = "2021"

[workspace.dependencies]
hyperon = { path = "./lib", version = "0.2.0" }
hyperon = { path = "./lib", version = "0.2.1" }
regex = "1.11.0"
log = "0.4.0"
env_logger = "0.8.4"
Expand Down
23 changes: 11 additions & 12 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ documentation](https://cibuildwheel.pypa.io/en/stable/) for details.

## How to update the version

Usually it is needed after releasing the artifacts or before making a test
Usually it is needed before releasing the artifacts or before making a test
release.

There are three locations to update:
Expand All @@ -54,17 +54,16 @@ All three locations should contain the same version.

## How to release binaries

Use [Create a new release
link](https://github.com/trueagi-io/hyperon-experimental/releases/new) on the
main page of the GitHub repo. Press `Choose a tag` control and type new tag
which should be in form of `v<next-version>` (for example if next version is
`0.1.7` then tag is `v0.1.7`). Next version should be identical to versions
which are written in locations mentioned in [How to update the
version](#how-to-update-the-version) instruction. After typing the tag press
`Create new tag on publish`. Now press `Generate release notes` button. It will
automatically fill the `Release title` and `Release description` fields. Tick
`Set as a pre-release` checkbox if needed and press `Publish release` button.
Now you have published new GitHub release and triggered a job to build release
Update the version [How to update the version](#how-to-update-the-version) in
the main branch of the repository, raise PR and merge it. Use [Create a new
release link](https://github.com/trueagi-io/hyperon-experimental/releases/new)
on the main page of the GitHub repo. Press `Choose a tag` control and type new
tag which should be in form of `v<version>` (for example if version is
`0.1.7` then tag is `v0.1.7`). After typing the tag press `Create new tag
on publish`. Now press `Generate release notes` button. It will automatically
fill the `Release title` and `Release description` fields. Tick `Set as a
pre-release` checkbox if needed and press `Publish release` button. Now you
have published new GitHub release and triggered a job to build release
artifacts.

After release job is finished one need to approve publishing artifacts to the
Expand Down
73 changes: 57 additions & 16 deletions lib/src/metta/runner/stdlib.metta
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,47 @@
(: empty (-> %Undefined%))
(= (empty) (let a b never-happens))

(@doc unique
(@desc "Function takes non-deterministic input (first argument) and returns only unique entities. E.g. (unique (superpose (a b c d d))) -> [a, b, c, d]")
(@params (
(@param "Non-deterministic set of values")))
(@return "Unique values from input set"))
(: unique (-> Atom Atom))
(= (unique $arg) (let $c (collapse $arg) (let $u (unique-atom $c) (superpose $u))))

(@doc union
(@desc "Function takes two non-deterministic inputs (first and second argument) and returns their union. E.g. (union (superpose (a b b c)) (superpose (b c c d))) -> [a, b, b, c, b, c, c, d]")
(@params (
(@param "Non-deterministic set of values")
(@param "Another non-deterministic set of values")))
(@return "Union of sets"))
(: union (-> Atom Atom Atom))
(= (union $arg1 $arg2)
(let $c1 (collapse $arg1) (let $c2 (collapse $arg2)
(let $u (union-atom $c1 $c2) (superpose $u)))))

(@doc intersection
(@desc "Function takes two non-deterministic inputs (first and second argument) and returns their intersection. E.g. (intersection (superpose (a b c c)) (superpose (b c c c d))) -> [b, c, c]")
(@params (
(@param "Non-deterministic set of values")
(@param "Another non-deterministic set of values")))
(@return "Intersection of sets"))
(: intersection (-> Atom Atom Atom))
(= (intersection $arg1 $arg2)
(let $c1 (collapse $arg1) (let $c2 (collapse $arg2)
(let $u (intersection-atom $c1 $c2) (superpose $u)))))

(@doc subtraction
(@desc "Function takes two non-deterministic inputs (first and second argument) and returns their subtraction. E.g. !(subtraction (superpose (a b b c)) (superpose (b c c d))) -> [a, b]")
(@params (
(@param "Non-deterministic set of values")
(@param "Another non-deterministic set of values")))
(@return "Subtraction of sets"))
(: subtraction (-> Atom Atom Atom))
(= (subtraction $arg1 $arg2)
(let $c1 (collapse $arg1) (let $c2 (collapse $arg2)
(let $u (subtraction-atom $c1 $c2) (superpose $u)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Documentation formatting functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down Expand Up @@ -657,35 +698,35 @@
(@params ())
(@return "Random boolean value"))

(@doc unique
(@desc "Function takes non-deterministic input (first argument) and returns only unique entities. E.g. (unique (superpose (a b c d d))) -> [a, b, c, d]")
(@doc unique-atom
(@desc "Function takes tuple and returns only unique entities. E.g. (unique-atom (a b c d d)) -> (a b c d)")
(@params (
(@param "Non-deterministic set of values")))
(@param "List of values")))
(@return "Unique values from input set"))

(@doc union
(@desc "Function takes two non-deterministic inputs (first and second argument) and returns their union. E.g. (union (superpose (a b b c)) (superpose (b c c d))) -> [a, b, b, c, b, c, c, d]")
(@doc union-atom
(@desc "Function takes two tuples and returns their union. E.g. (union-atom (a b b c) (b c c d)) -> (a b b c b c c d)")
(@params (
(@param "Non-deterministic set of values")
(@param "Another non-deterministic set of values")))
(@param "List of values")
(@param "List of values")))
(@return "Union of sets"))

(@doc intersection
(@desc "Function takes two non-deterministic inputs (first and second argument) and returns their intersection. E.g. (intersection (superpose (a b c c)) (superpose (b c c c d))) -> [b, c, c]")
(@doc intersection-atom
(@desc "Function takes two tuples and returns their intersection. E.g. (intersection-atom (a b c c) (b c c c d)) -> (b c c)")
(@params (
(@param "Non-deterministic set of values")
(@param "Another non-deterministic set of values")))
(@param "List of values")
(@param "List of values")))
(@return "Intersection of sets"))

(@doc subtraction
(@desc "Function takes two non-deterministic inputs (first and second argument) and returns their subtraction. E.g. !(subtraction (superpose (a b b c)) (superpose (b c c d))) -> [a, b]")
(@doc subtraction-atom
(@desc "Function takes two tuples and returns their subtraction. E.g. !(subtraction-atom (a b b c) (b c c d)) -> (a b)")
(@params (
(@param "Non-deterministic set of values")
(@param "Another non-deterministic set of values")))
(@param "List of values")
(@param "List of values")))
(@return "Subtraction of sets"))

(@doc git-module!
(@desc "Provides access to module in a remote git repo, from within MeTTa code. Similar to `register-module!`, this op will bypass the catalog search")
(@params (
(@param "URL to github repo")))
(@return "Unit atom"))
(@return "Unit atom"))
Loading

0 comments on commit 1f0633d

Please sign in to comment.