You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/src/metta/runner/stdlib.metta
+57-16Lines changed: 57 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,47 @@
67
67
(: empty (-> %Undefined%))
68
68
(= (empty) (let a b never-happens))
69
69
70
+
(@doc unique
71
+
(@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]")
(@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]")
80
+
(@params (
81
+
(@param "Non-deterministic set of values")
82
+
(@param "Another non-deterministic set of values")))
(@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]")
91
+
(@params (
92
+
(@param "Non-deterministic set of values")
93
+
(@param "Another non-deterministic set of values")))
(@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]")
102
+
(@params (
103
+
(@param "Non-deterministic set of values")
104
+
(@param "Another non-deterministic set of values")))
(@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]")
701
+
(@doc unique-atom
702
+
(@desc "Function takes tuple and returns only unique entities. E.g. (unique-atom (a b c d d)) -> (a b c d)")
662
703
(@params (
663
-
(@param "Non-deterministic set of values")))
704
+
(@param "List of values")))
664
705
(@return "Unique values from input set"))
665
706
666
-
(@doc union
667
-
(@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]")
707
+
(@doc union-atom
708
+
(@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)")
668
709
(@params (
669
-
(@param "Non-deterministic set of values")
670
-
(@param "Another non-deterministic set of values")))
710
+
(@param "List of values")
711
+
(@param "List of values")))
671
712
(@return "Union of sets"))
672
713
673
-
(@doc intersection
674
-
(@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]")
714
+
(@doc intersection-atom
715
+
(@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)")
675
716
(@params (
676
-
(@param "Non-deterministic set of values")
677
-
(@param "Another non-deterministic set of values")))
717
+
(@param "List of values")
718
+
(@param "List of values")))
678
719
(@return "Intersection of sets"))
679
720
680
-
(@doc subtraction
681
-
(@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]")
721
+
(@doc subtraction-atom
722
+
(@desc "Function takes two tuples and returns their subtraction. E.g. !(subtraction-atom (a b b c) (b c c d)) -> (a b)")
682
723
(@params (
683
-
(@param "Non-deterministic set of values")
684
-
(@param "Another non-deterministic set of values")))
724
+
(@param "List of values")
725
+
(@param "List of values")))
685
726
(@return "Subtraction of sets"))
686
727
687
728
(@doc git-module!
688
729
(@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")
0 commit comments