]> gitweb.factorcode.org Git - factor.git/commitdiff
factlog vocab ==> logic vocab
authorkusumotonorio <47816570+kusumotonorio@users.noreply.github.com>
Tue, 3 Mar 2020 12:04:46 +0000 (21:04 +0900)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 3 Mar 2020 15:59:07 +0000 (15:59 +0000)
21 files changed:
extra/logic/examples/factorial/factorial-tests.factor
extra/logic/examples/factorial/factorial.factor
extra/logic/examples/fib/fib-tests.factor
extra/logic/examples/fib/fib.factor
extra/logic/examples/fib2/fib2-tests.factor
extra/logic/examples/fib2/fib2.factor
extra/logic/examples/hanoi/hanoi-tests.factor
extra/logic/examples/hanoi/hanoi.factor
extra/logic/examples/hanoi2/hanoi2-tests.factor
extra/logic/examples/hanoi2/hanoi2.factor
extra/logic/examples/money/money-tests.factor
extra/logic/examples/money/money.factor
extra/logic/examples/zebra-short/zebra-short-tests.factor
extra/logic/examples/zebra-short/zebra-short.factor
extra/logic/examples/zebra/zebra-tests.factor
extra/logic/examples/zebra/zebra.factor
extra/logic/examples/zebra2/zebra2-tests.factor
extra/logic/examples/zebra2/zebra2.factor
extra/logic/logic-docs.factor
extra/logic/logic-tests.factor
extra/logic/logic.factor

index 80bc330a99b5f696bdec028687ed97abc6391c86..645ae926c0257faa018c3ac70ff68e8e5b6662e3 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog factlog.examples.factorial ;
-IN: factlog.examples.factorial.tests
+USING: tools.test logic logic.examples.factorial ;
+IN: logic.examples.factorial.tests
 
 { { H{ { F 1 } } } } [ { factorial 0 F } query ] unit-test
 
index 0c3ced21693f209853c1af76c1f59062039b98d9..aba3caaf3341786f5ba2ef221baf9a0cb5640ec9 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog kernel assocs math ;
-IN: factlog.examples.factorial
+USING: logic kernel assocs math ;
+IN: logic.examples.factorial
 
 LOGIC-PREDS: factorial ;
 LOGIC-VARS: N F N2 F2 ;
index 1e9884c832ec29067045400e7a502615eef25c0e..364ba8f114dcd747764f471c20c71e09f2f7bd87 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog lists factlog.examples.fib ;
-IN: factlog.examples.fib.tests
+USING: tools.test logic lists logic.examples.fib ;
+IN: logic.examples.fib.tests
 
 { { H{ { L L{ 0 } } } } } [ { fibo 0 L } query ] unit-test
 
index f10681757a547bd9396b2c086a061b653d71fdde..0e784ffdf49bddaeb6c870195161a54e2a35360b 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog kernel lists assocs math ;
-IN: factlog.examples.fib
+USING: logic kernel lists assocs math ;
+IN: logic.examples.fib
 
 LOGIC-PREDS: fibo ;
 LOGIC-VARS: F F1 F2 N N1 L ;
index 786d0335710a09c6fa624119b1b6b7d9ed52f208..8bb3bb3b0053c6f13b47067886574f54f75400c4 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog factlog.examples.fib2 ;
-IN: factlog.examples.fib2.tests
+USING: tools.test logic logic.examples.fib2 ;
+IN: logic.examples.fib2.tests
 
 { { H{ { F 6765 } } } } [
     { fibo 20 F } query
index a4233eecccd78ed595973dd89723d2c9891fac55..6e537e82b00397acafa1bbafe51a32d268a83b7d 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog kernel lists assocs locals math ;
-IN: factlog.examples.fib2
+USING: logic kernel lists assocs locals math ;
+IN: logic.examples.fib2
 
 LOGIC-PREDS: fibo ;
 LOGIC-VARS: F F1 F2 N N1 N2 ;
index d36b3aa38856d1e26807a45afe61eafaabca212f..c7a4178bd9a4b6e7c4cea0b4962055d65c1d4c48 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog factlog.examples.hanoi
+USING: tools.test logic logic.examples.hanoi
 formatting sequences ;
-IN: factlog.examples.hanoi.tests
+IN: logic.examples.hanoi.tests
 
 { t } [
     {
index 323416b2a6a3aa81152460d8259408025d7323b2..3650d74f1d9294fc210eb11d3c1071f84e1772da 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog kernel assocs math ;
-IN: factlog.examples.hanoi
+USING: logic kernel assocs math ;
+IN: logic.examples.hanoi
 
 LOGIC-PREDS: hanoi moveo informo ;
 LOGIC-VARS: A B C M N X Y ;
index fe86313e2c3a8eb9e911ae826053e5f35f3930d4..f3e5261b04a7783c57f698f5c475281020b2f468 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog lists factlog.examples.hanoi2
+USING: tools.test logic lists logic.examples.hanoi2
 formatting sequences ;
-IN: factlog.examples.hanoi2.tests
+IN: logic.examples.hanoi2.tests
 
 { t } [
     {
index e1a20eebc24c367600d310a9fbfa84dea540283f..d0611eb80b5c75017febac93e62ebff6469593e8 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog lists sequences assocs formatting ;
-IN: factlog.examples.hanoi2
+USING: logic lists sequences assocs formatting ;
+IN: logic.examples.hanoi2
 
 LOGIC-PREDS: hanoi write-move ;
 LOGIC-VARS: A B C X Y Z ;
index ee2adbe3f3ad872c770dfae194a6d2a86ae1e270..47e9f9eb50a09b4781f9ab8cbe44a5da10169e44 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog lists factlog.examples.money ;
-IN: factlog.examples.money.tests
+USING: tools.test logic lists logic.examples.money ;
+IN: logic.examples.money.tests
 
 {
     {
index 9fccd66a6afac2b25273354f931a646f3dfc32a9..58d62b599b0494caa4d1f2b234681537514b61ef 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog lists assocs sequences kernel math
+USING: logic lists assocs sequences kernel math
 locals formatting io ;
-IN: factlog.examples.money
+IN: logic.examples.money
 
 LOGIC-PREDS: sumo sum1o digitsumo delo donaldo moneyo ;
 LOGIC-VARS: S E N D M O R Y A L G B T
index 3b5e81808f90facc6a827107553e7a0fdfc7cb08..315fcb6f32be0fa3144a0dea9e96b7242331c52e 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019 Your name.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog factlog.examples.zebra-short ;
-IN: factlog.examples.zebra-short.tests
+USING: tools.test logic logic.examples.zebra-short ;
+IN: logic.examples.zebra-short.tests
 
 {
     { H{ { X japanese } } H{ { X japanese } } }
index caad63ac26b482bcb4544cca4ef9fd845111c7ed..576e37eccaa03d94abea4273e57968c4a85202ed 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog arrays ;
-IN: factlog.examples.zebra-short
+USING: logic arrays ;
+IN: logic.examples.zebra-short
 
 ! Do the same as this Prolog program
 !
index 07c39914afa6f64dc75c2ba0f1dfddcd12dcd57a..366c97c1d8e8291129d690e8b73da5b67ab1a291 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog lists factlog.examples.zebra ;
-IN: factlog.examples.zebra.tests
+USING: tools.test logic lists logic.examples.zebra ;
+IN: logic.examples.zebra.tests
 
 {
     {
index fdc299b7efc627b7f76d42d97ae3589c735c1776..f3d3ceada90bb0e31ae2a8e066e37747f94b7510 100644 (file)
@@ -3,8 +3,8 @@
 
 ! Zebra Puzzle: https://rosettacode.org/wiki/Zebra_puzzle
 
-USING: factlog lists ;
-IN: factlog.examples.zebra
+USING: logic lists ;
+IN: logic.examples.zebra
 
 LOGIC-PREDS: houseso neighboro zebrao watero nexto lefto ;
 LOGIC-VARS: Hs A B Ls X Y ;
index 0485b6f3c016e43e5b35ada7de4e52033a086f14..6669e6715428390c24b41fbfe34feaab873a5467 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog lists factlog.examples.zebra2 ;
-IN: factlog.examples.zebra2.tests
+USING: tools.test logic lists logic.examples.zebra2 ;
+IN: logic.examples.zebra2.tests
 
 {
     {
index bce5768c3d40356a6b53d62d82794e90b5ae14db..5cae46b3b42b1db8549a80e1de186e972c24cb43 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: factlog lists ;
-IN: factlog.examples.zebra2
+USING: logic lists ;
+IN: logic.examples.zebra2
 
 LOGIC-PREDS: existso righto middleo firsto nexto
              houseso zebrao watero ;
index 8f6fc4a39079066dd5815800e8fc0dfc8951e3d3..eb0a51d55fa9b1f1df5faa4e5fa2296ba6e6d987 100644 (file)
@@ -1,15 +1,15 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays help.markup help.syntax kernel quotations sequences
-    prettyprint assocs math make lists urls factlog.private ;
-IN: factlog
+    prettyprint assocs math make lists urls logic.private ;
+IN: logic
 
 HELP: !!
 { $var-description "The cut operator.\nUse the cut operator to suppress backtracking." }
 { $examples
   "In the following example, it is used to define that cats generally eat mice, but Tom does not."
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: is-ao consumeso ;"
@@ -96,7 +96,7 @@ HELP: =:=
     { "quot" quotation }
     { "goal" logic-goal }
 }
-{ $description "The quotations takes an environment and returns two values. " { $snippet "=:=" } " returns the internal representation of the goal which returns t if values returned by the quotation are same numbers.\n" { $snippet "=:=" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, factlog uses the internal definition of the goal obtained by calling it." }
+{ $description "The quotations takes an environment and returns two values. " { $snippet "=:=" } " returns the internal representation of the goal which returns t if values returned by the quotation are same numbers.\n" { $snippet "=:=" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, " { $snippet "logic" } " uses the internal definition of the goal obtained by calling it." }
 { $see-also (==) =\= } ;
 
 HELP: =\=
@@ -104,7 +104,7 @@ HELP: =\=
     { "quot" quotation }
     { "goal" logic-goal }
 }
-{ $description "The quotations takes an environment and returns two values. " { $snippet "=\\=" } " returns the internal representation of the goal which returns t if values returned by the quotation are numbers and are not same.\n" { $snippet "=\\=" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, factlog uses the internal definition of the goal obtained by calling it." }
+{ $description "The quotations takes an environment and returns two values. " { $snippet "=\\=" } " returns the internal representation of the goal which returns t if values returned by the quotation are numbers and are not same.\n" { $snippet "=\\=" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, " { $snippet "logic" } " uses the internal definition of the goal obtained by calling it." }
 { $see-also (==) =:= } ;
 
 HELP: LOGIC-PREDS:
@@ -112,7 +112,7 @@ HELP: LOGIC-PREDS:
 { $syntax "LOGIC-PREDS: preds... ;" }
 { $examples
   { $code
-    "USE: factlog"
+    "USE: logic"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: cato mouseo ;"
@@ -128,7 +128,7 @@ HELP: LOGIC-VARS:
 { $syntax "LOGIC-VARS: vars... ;" }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: mouseo ;"
@@ -145,7 +145,7 @@ HELP: %!
 { $syntax "%! comment !%" }
 { $examples
     { $example
-        "USE: factlog"
+        "USE: logic"
         "%! I think that I shall never see"
         "   A proof lovely as a factlog. !%"
         ""
@@ -156,7 +156,7 @@ HELP: \+
 { $var-description "Express negation. \\+ acts on the goal immediately following it.\n" }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: cato mouseo creatureo ;"
@@ -187,7 +187,7 @@ HELP: __
 { $var-description "An anonymous logic variable.\nUse in place of a regular logic variable when you do not need its name and value." }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "SYMBOLS: Tom Jerry Nibbles ;"
@@ -220,7 +220,7 @@ HELP: appendo
 { $syntax "{ appendo List1 List2 List1+List2 }" }
 { $examples
   { $example
-    "USING: factlog lists prettyprint ;"
+    "USING: logic lists prettyprint ;"
     "IN: scratchpad"
     ""
     "SYMBOLS: Tom Jerry Nibbles ;"
@@ -268,7 +268,7 @@ HELP: clear-pred
 { $description "Clears all the definition information for the given logic predicate." }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: mouseo ;"
@@ -293,7 +293,7 @@ HELP: fact
 { $description "Registers the fact to the end of the logic predicate that is in the head." }
 { $examples
   { $code
-    "USE: factlog"
+    "USE: logic"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: cato mouseo ;"
@@ -318,7 +318,7 @@ HELP: facts
 { $description "Registers these facts to the end of the logic predicate that is in the head." }
 { $examples
   { $code
-    "USE: factlog"
+    "USE: logic"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: cato mouseo ;"
@@ -338,18 +338,18 @@ HELP: is
     { "quot" quotation } { "dist" "a logic predicate" }
     { "goal" logic-goal }
 }
-{ $description "Takes a quotation and a logic variable to be unified. Each of the two quotations takes an environment and returns a value. " { $snippet "is" } " returns the internal representation of the goal.\n" { $snippet "is" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, factlog uses the internal definition of the goal obtained by calling it." } ;
+{ $description "Takes a quotation and a logic variable to be unified. Each of the two quotations takes an environment and returns a value. " { $snippet "is" } " returns the internal representation of the goal.\n" { $snippet "is" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, " { $snippet "logic" } " uses the internal definition of the goal obtained by calling it." } ;
 
 HELP: invoke
 { $values
     { "quot" quotation }
     { "goal" logic-goal }
 }
-{ $description "Creates a goal which uses the values of obtained logic variables. It can be used to add new rules to or drop rules from the database while a " { $link query } " is running.\nThe argument " { $snippet "quot" } " must not return any values, the created goal always return " { $link t } ".\n" { $snippet "invoke" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, factlog uses the internal definition of the goal obtained by calling it." }
+{ $description "Creates a goal which uses the values of obtained logic variables. It can be used to add new rules to or drop rules from the database while a " { $link query } " is running.\nThe argument " { $snippet "quot" } " must not return any values, the created goal always return " { $link t } ".\n" { $snippet "invoke" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, " { $snippet "logic" } " uses the internal definition of the goal obtained by calling it." }
 { $examples
   "In this example, the calculated values are memorized to eliminate recalculation."
   { $example
-    "USING: factlog kernel lists assocs locals math prettyprint ;"
+    "USING: logic kernel lists assocs locals math prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: fibo ;"
@@ -380,7 +380,7 @@ HELP: invoke*
     { "quot" quotation }
     { "goal" logic-goal }
 }
-{ $description "Creates a goal which uses the values of obtained logic variables. The difference with " { $link invoke } " is that " { $snippet "quot" } " returns " { $link t } " or " { $link f } ", and the created goal returns it.\n" { $snippet "invoke*" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, factlog uses the internal definition of the goal obtained by calling it." }
+{ $description "Creates a goal which uses the values of obtained logic variables. The difference with " { $link invoke } " is that " { $snippet "quot" } " returns " { $link t } " or " { $link f } ", and the created goal returns it.\n" { $snippet "invoke*" } " is intended to be used in a quotation. If there is a quotation in the definition of rule, " { $snippet "logic" } " uses the internal definition of the goal obtained by calling it." }
 { $see-also invoke } ;
 
 HELP: lengtho
@@ -388,7 +388,7 @@ HELP: lengtho
 { $syntax "{ lengtho List X }" }
 { $examples
   { $example
-    "USING: factlog lists prettyprint ;"
+    "USING: logic lists prettyprint ;"
     "IN: scratchpad"
     ""
     "SYMBOLS: Tom Jerry Nibbles ;"
@@ -405,7 +405,7 @@ HELP: listo
 { $syntax "{ listo X }" }
 { $examples
   { $example
-    "USING: factlog lists prettyprint ;"
+    "USING: logic lists prettyprint ;"
     "IN: scratchpad"
     ""
     "SYMBOLS: Tom Jerry Nibbles ;"
@@ -421,7 +421,7 @@ HELP: membero
 { $syntax "{ membero X List }" }
 { $examples
   { $example
-    "USING: factlog lists prettyprint ;"
+    "USING: logic lists prettyprint ;"
     "IN: scratchpad"
     ""
     "SYMBOLS: Tom Jerry Nibbles Spike ;"
@@ -467,7 +467,7 @@ When you query with logic variable(s), you will get the answer for the logic var
 }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: cato mouseo creatureo ;"
@@ -502,7 +502,7 @@ HELP: retract
 { $description "Removes the first definition that matches the given head information." }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: mouseo ;"
@@ -526,7 +526,7 @@ HELP: retract-all
 { $description "Removes all definitions that match a given head goal definition." }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: mouseo ;"
@@ -559,7 +559,7 @@ If the body array contains only one goal definition, you can write it instead of
     Gh Gb rule" }
 { $examples
   { $example
-    "USING: factlog prettyprint ;"
+    "USING: logic prettyprint ;"
     "IN: scratchpad"
     ""
     "LOGIC-PREDS: mouseo youngo young-mouseo ;"
@@ -651,23 +651,23 @@ HELP: writeo
 { $syntax "{ writeo X }" }
 { $see-also writenlo nlo } ;
 
-ARTICLE: "factlog" "How to use factlog"
-{ $vocab-link "factlog" }
-" is an embedded language that runs on "{ $url "https://github.com/factor/factor" "Factor" } " with the capabilities of a subset of Prolog." $nl
+ARTICLE: "logic" "Logic"
+{ $vocab-link "logic" }
+" is a vocab for an embedded language that runs on "{ $url "https://github.com/factor/factor" "Factor" } " with the capabilities of a subset of Prolog." $nl
 "It is an extended port from tiny_prolog and its descendants, " { $url "https://github.com/preston/ruby-prolog" "ruby-prolog" } "." $nl
 { $code
-"USE: factlog
+"USE: logic
 
 LOGIC-PREDS: cato mouseo creatureo ;
 LOGIC-VARS: X Y ;
 SYMBOLS: Tom Jerry Nibbles ;"
 } $nl
-"In factlog, words that represent relationships are called " { $strong "logic predicates" } ". Use " { $link \ LOGIC-PREDS: } " to declare the predicates you want to use. " { $strong "Logic variables" } " are used to represent relationships. use " { $link \ LOGIC-VARS: } " to declare the logic variables you want to use." $nl
+"In the DSL, words that represent relationships are called " { $strong "logic predicates" } ". Use " { $link \ LOGIC-PREDS: } " to declare the predicates you want to use. " { $strong "Logic variables" } " are used to represent relationships. use " { $link \ LOGIC-VARS: } " to declare the logic variables you want to use." $nl
 "In the above code, logic predicates end with the character 'o', which is a convention borrowed from miniKanren and so on, and means relation. This is not necessary, but it is useful for reducing conflicts with the words of, the parent language, Factor. We really want to write them as: " { $snippet "cat°" } ", " { $snippet "mouse°" } " and " { $snippet "creature°" } ", but we use 'o' because it's easy to type." $nl
-{ $strong "Goals" } " are questions that factlog tries to meet to be true. To represent a goal, write an array with a logic predicate followed by zero or more arguments. factlog converts such definitions to internal representations." $nl
+{ $strong "Goals" } " are questions that " { $snippet "logic" } " tries to meet to be true. To represent a goal, write an array with a logic predicate followed by zero or more arguments. " { $snippet "logic" } " converts such definitions to internal representations." $nl
 { $code "{ LOGIC-PREDICATE ARG1 ARG2 ... }" }
 { $code "{ LOGIC-PREDICATE }" } $nl
-"We will write factlog programs using these goals." $nl
+"We will write logic programs using these goals." $nl
 { $code
 "{ cato Tom } fact
 { mouseo Jerry } fact
@@ -742,7 +742,7 @@ $nl
   "Gh { Gb4 Gb5 } rule"
   "Gh { Gb6 } rule"
 } $nl
-"factlog actually converts the disjunction in that way. You may need to be careful about that when deleting definitions that you registered using " { $link rule } ", etc." $nl
+{ $snippet "logic" } " actually converts the disjunction in that way. You may need to be careful about that when deleting definitions that you registered using " { $link rule } ", etc." $nl
 "You can use " { $link query-n } " to limit the number of answers to a query. Specify a number greater than or equal to 1." $nl
 { $unchecked-example
 "{ creatureo Y } 2 query-n ."
@@ -923,7 +923,7 @@ mouseo clear-pred
 { creatureo X } query ."
 "{ H{ { X Tom } } }\n{ H{ { X big } { Y a-big-cat } } H{ { X small } { Y a-small-cat } } }\n{ H{ { X Tom } } H{ { X Jerry } } H{ { X Nibbles } }"
 } $nl
-"If you need to identify a logic predicate that has a different " { $strong "arity" } ", that is numbers of arguments, express it with a slash and an arity number. For example, " { $snippet "cato" } " with arity 1 is " { $snippet "cato/1" } ", " { $snippet "cato" } " with arity 2 is " { $snippet "cato/2" } ". But, note that factlog does not recognize these names." $nl
+"If you need to identify a logic predicate that has a different " { $strong "arity" } ", that is numbers of arguments, express it with a slash and an arity number. For example, " { $snippet "cato" } " with arity 1 is " { $snippet "cato/1" } ", " { $snippet "cato" } " with arity 2 is " { $snippet "cato/2" } ". But, note that " { $snippet "logic" } " does not recognize these names." $nl
 { $link clear-pred } " will clear all definitions of any arity. If you only want to remove the definition of a certain arity, you should use " { $link retract-all } " with logic variables." $nl
 { $unchecked-example
 "{ cato __ __ } retract-all
@@ -931,14 +931,14 @@ mouseo clear-pred
 "{ cato X } query ."
 "f\n{ H{ { X Tom } } }"
 } $nl
-"You can " { $strong "trace" } " factlog's execution. The word to do this is " { $link trace } "." $nl
+"You can " { $strong "trace" } " " { $snippet "logic" } "'s execution. The word to do this is " { $link trace } "." $nl
 "The word to stop tracing is " { $link notrace } "." $nl
 "Here is a Prolog definition for the factorial predicate " { $snippet "factorial" } "." $nl
 "factorial(0, 1)." $nl
 "factorial(N, F) :- N > 0, N2 is N - 1, factorial(N2, F2), F is F2 * N." $nl
-"Let's think about how to do the same thing with factlog. It is mostly the following code, but is surrounded by backquotes where it has not been explained." $nl
+"Let's think about how to do the same thing. It is mostly the following code, but is surrounded by backquotes where it has not been explained." $nl
 { $code
-"USE: factlog
+"USE: logic
 
 LOGIC-PREDS: factorialo ;
 LOGIC-VARS: N N2 F F2 ;
@@ -951,7 +951,7 @@ LOGIC-VARS: N N2 F F2 ;
     `F is F2 * N`
 } rule"
 } $nl
-"Within these backquotes are comparisons, calculations, and assignments (to be precise, " { $strong "unifications" } "). factlog has a mechanism to call Factor code to do these things. Here are some example." $nl
+"Within these backquotes are comparisons, calculations, and assignments (to be precise, " { $strong "unifications" } "). " { $snippet "logic" } " has a mechanism to call Factor code to do these things. Here are some example." $nl
 { $code "LOGIC-PREDS: N_>_0  N2_is_N_-_1  F_is_F2_*_N ;" }
 { $code "{ N_>_0 N } [ N of 0 > ] callback" }
 { $code "{ N2_is_N_-_1 N2 N } [ dup N of 1 - N2 unify ] callback" }
@@ -960,7 +960,7 @@ LOGIC-VARS: N N2 F F2 ;
 "The word " { $link unify } " unifies the two following the environment in that environment." $nl
 "Now we can rewrite the definition of factorialo to use them." $nl
 { $code
-"USE: factlog
+"USE: logic
 
 LOGIC-PREDS: factorialo N_>_0  N2_is_N_-_1  F_is_F2_*_N ;
 LOGIC-VARS: N N2 F F2 ;
@@ -992,12 +992,12 @@ LOGIC-VARS: N N2 F F2 ;
 "{ factorialo 10 F } query ."
 "{ H{ { F 3628800 } } }"
 } $nl
-"factlog has features that make it easier to meet the typical requirements shown here." $nl
+{ $snippet "logic" } " has features that make it easier to meet the typical requirements shown here." $nl
 "There are the built-in logic predicates " { $link (<) } ", " { $link (>) } ", " { $link (>=) } ", and " { $link (=<) } " to compare numbers. There are also " { $link (==) } " and " { $link (\==) } " to test for equality and inequality of two arguments." $nl
-"The word " { $link is } " takes a quotation and a logic variable to be unified. The quotation takes an environment and returns a value. And " { $link is } " returns the internal representation of the goal. " { $link is } " is intended to be used in a quotation. If there is a quotation in the definition of " { $link rule } ", factlog uses the internal definition of the goal obtained by calling it." $nl
+"The word " { $link is } " takes a quotation and a logic variable to be unified. The quotation takes an environment and returns a value. And " { $link is } " returns the internal representation of the goal. " { $link is } " is intended to be used in a quotation. If there is a quotation in the definition of " { $link rule } ", " { $snippet "logic" } " uses the internal definition of the goal obtained by calling it." $nl
 "If you use these features to rewrite the definition of " { $snippet "factorialo" } ":" $nl
 { $code
-"USE: factlog
+"USE: logic
 
 LOGIC-PREDS: factorialo ;
 LOGIC-VARS: N N2 F F2 ;
@@ -1012,7 +1012,7 @@ LOGIC-VARS: N N2 F F2 ;
 } $nl
 "Use the built-in logic predicate " { $link (=) } " for unification that does not require processing with a quotation. " { $link (\=) } " will be true when such a unification fails. Note that " { $link (\=) } " does not actually do the unification." $nl
 { $link varo } " takes a argument and is true if it is a logic variable with no value. On the other hand, " { $link nonvaro } " is true if its argument is not a logic variable or is a concrete logic variable." $nl
-"Now almost everything about factlog is explained."
+"Now almost everything about " { $snippet "logic" } " is explained."
 ;
 
-ABOUT: "factlog"
+ABOUT: "logic"
index 9e6c4044825a693b2f709d59f76939d9913f894c..3fbb06f7a1cfa8a3e905dec817fa7a9955439c4d 100644 (file)
@@ -1,17 +1,17 @@
 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test factlog lists assocs math kernel namespaces
+USING: tools.test logic lists assocs math kernel namespaces
 accessors sequences
-factlog.examples.factorial
-factlog.examples.fib
-factlog.examples.fib2
-factlog.examples.hanoi
-factlog.examples.hanoi2
-factlog.examples.money
-factlog.examples.zebra
-factlog.examples.zebra2 ;
-
-IN: factlog.tests
+logic.examples.factorial
+logic.examples.fib
+logic.examples.fib2
+logic.examples.hanoi
+logic.examples.hanoi2
+logic.examples.money
+logic.examples.zebra
+logic.examples.zebra2 ;
+
+IN: logic.tests
 
 LOGIC-PREDS: cato mouseo creatureo ;
 LOGIC-VARS: X Y ;
index 07c2e555ad7d3972c33111559f98397761a251a4..2c347a7d695ce4094530f7a8c76a5dd8ae8a9509 100644 (file)
@@ -8,7 +8,7 @@ prettyprint.custom prettyprint.sections quotations sequences
 sequences.deep sets splitting strings words words.symbol
 vectors ;
 
-IN: factlog
+IN: logic
 
 SYMBOL: !!    ! cut operator         in prolog: !
 SYMBOL: __    ! anonymous variable   in prolog: _
@@ -270,7 +270,7 @@ SYMBOL: *anonymouse-var-no*
 : proxy-var-for-'__' ( -- var-symbol )
     [
         *anonymouse-var-no* counter "ANON-%d_" sprintf
-        "factlog.private" create-word dup dup
+        "logic.private" create-word dup dup
         define-symbol
         ANONYMOUSE-LOGIC-VAR swap set-global
     ] with-compilation-unit ;