]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge Joe Groff's booleans vocab into kernel
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 24 Apr 2009 03:39:31 +0000 (22:39 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 24 Apr 2009 03:39:31 +0000 (22:39 -0500)
basis/booleans/booleans-docs.factor [deleted file]
basis/booleans/booleans-tests.factor [deleted file]
basis/booleans/booleans.factor [deleted file]
core/combinators/combinators-docs.factor
core/kernel/kernel-docs.factor
core/kernel/kernel.factor

diff --git a/basis/booleans/booleans-docs.factor b/basis/booleans/booleans-docs.factor
deleted file mode 100644 (file)
index d3e9dfa..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-! (c)2009 Joe Groff, see bsd license
-USING: help.markup help.syntax ;
-IN: booleans
-
-HELP: boolean
-{ $class-description "A union of the " { $link POSTPONE: t } " and " { $link POSTPONE: f } " classes." } ;
-
diff --git a/basis/booleans/booleans-tests.factor b/basis/booleans/booleans-tests.factor
deleted file mode 100644 (file)
index 4b31542..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-! (c)2009 Joe Groff, see bsd license
-USING: booleans tools.test ;
-IN: booleans.tests
-
-[ t ] [ t boolean? ] unit-test
-[ t ] [ f boolean? ] unit-test
-[ f ] [ 1 boolean? ] unit-test
diff --git a/basis/booleans/booleans.factor b/basis/booleans/booleans.factor
deleted file mode 100644 (file)
index 0ec7db3..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-! (c)2009 Joe Groff, see bsd license
-USING: kernel ;
-IN: booleans
-
-UNION: boolean POSTPONE: t POSTPONE: f ;
index e02103697d15a82f789bd4d2265e2d2d98d64548..cbef25ac3889348c256b0156607a60b1408c13bb 100644 (file)
@@ -198,6 +198,8 @@ ARTICLE: "booleans" "Booleans"
 "In Factor, any object that is not " { $link f } " has a true value, and " { $link f } " has a false value. The " { $link t } " object is the canonical true value."
 { $subsection f }
 { $subsection t }
+"A union class of the above:"
+{ $subsection boolean }
 "There are some logical operations on booleans:"
 { $subsection >boolean }
 { $subsection not }
index 371edcf9955babeee1743349e7e72d5768a77129..1d8c09a9b28617c6d139f58cdfe5611fde250b29 100644 (file)
@@ -129,6 +129,9 @@ HELP: ?
 { $values { "?" "a generalized boolean" } { "true" object } { "false" object } { "true/false" "one two input objects" } }
 { $description "Chooses between two values depending on the boolean value of " { $snippet "cond" } "." } ;
 
+HELP: boolean
+{ $class-description "A union of the " { $link POSTPONE: t } " and " { $link POSTPONE: f } " classes." } ;
+
 HELP: >boolean
 { $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
 { $description "Convert a generalized boolean into a boolean. That is, " { $link f } " retains its value, whereas anything else becomes " { $link t } "." } ;
index baccf5605946a10f2c4a4906ec915683e45002e6..624508022595f40d9944617fdc50b12ea3e1b4db 100644 (file)
@@ -176,12 +176,14 @@ PRIVATE>
 : tri-curry@ ( x y z q -- p' q' r' ) [curry] tri@ ; inline
 
 ! Booleans
+UNION: boolean POSTPONE: t POSTPONE: f ;
+
+: >boolean ( obj -- ? ) [ t ] [ f ] if ; inline
+
 : not ( obj -- ? ) [ f ] [ t ] if ; inline
 
 : and ( obj1 obj2 -- ? ) over ? ; inline
 
-: >boolean ( obj -- ? ) [ t ] [ f ] if ; inline
-
 : or ( obj1 obj2 -- ? ) dupd ? ; inline
 
 : xor ( obj1 obj2 -- ? ) [ f swap ? ] when* ; inline