oldk1331
2018-06-12 13:37:12 UTC
Clearly domain "Void" is the unit type:
https://en.wikipedia.org/wiki/Unit_type
So I'm clearing this up.
diff --git a/src/algebra/any.spad b/src/algebra/any.spad
index 02602da6..4d46a77c 100644
--- a/src/algebra/any.spad
+++ b/src/algebra/any.spad
@@ -168,31 +168,28 @@
error "Cannot retract value."
)abbrev domain VOID Void
--- These types act as the top and bottom of the type lattice
--- and are known to the compiler and interpreter for type resolution.
++ Author: Stephen M. Watt
++ Date Created: 1986
++ Basic Operations:
++ Related Domains: ErrorFunctions, ResolveLatticeCompletion, Exit
++ Also See:
++ AMS Classifications:
-++ Keywords: type, mode, coerce, no value
+++ Keywords: type, mode, coerce, unit type
++ Examples:
++ References:
++ Description:
-++ This type is used when no value is needed, e.g., in the \spad{then}
-++ part of a one armed \spad{if}.
+++ \spadtype{Void} implements the unit type in type theory.
+++ It allows only one value thus can hold no information.
+++ Void is used in the \spad{then} part of a one armed \spad{if}.
++ All values can be coerced to type Void. Once a value has been coerced
++ to Void, it cannot be recovered.
-Void : with
- void : () -> % ++ void() produces a void object.
- coerce : % -> OutputForm
- ++ coerce(v) coerces void object to OutputForm.
+Void : CoercibleTo OutputForm with
+ void : () -> %
+ ++ void() returns the void object.
== add
- Rep := String
- void() == voidValue()$Lisp
- coerce(v : %) == coerce(void())$Rep
+ void() == voidValue()$Lisp
+ coerce(v : %) == message "()"
)abbrev domain EXIT Exit
++ Author: Stephen M. Watt
diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot
index 863355a7..4f92dede 100644
--- a/src/interp/i-spec1.boot
+++ b/src/interp/i-spec1.boot
@@ -81,9 +81,11 @@
DEFPARAMETER($breakCount, 0)
DEFPARAMETER($anonymousMapCounter, 0)
---% Void stuff
+--% Void is the unit type that allows only one value.
+--% It can be anything and we use 0 here.
+--% It can't be NIL, see function "getArgValue" in "interpret1".
-voidValue() == '"()"
+voidValue() == 0
--% Handlers for Anonymous Function Definitions
https://en.wikipedia.org/wiki/Unit_type
So I'm clearing this up.
diff --git a/src/algebra/any.spad b/src/algebra/any.spad
index 02602da6..4d46a77c 100644
--- a/src/algebra/any.spad
+++ b/src/algebra/any.spad
@@ -168,31 +168,28 @@
error "Cannot retract value."
)abbrev domain VOID Void
--- These types act as the top and bottom of the type lattice
--- and are known to the compiler and interpreter for type resolution.
++ Author: Stephen M. Watt
++ Date Created: 1986
++ Basic Operations:
++ Related Domains: ErrorFunctions, ResolveLatticeCompletion, Exit
++ Also See:
++ AMS Classifications:
-++ Keywords: type, mode, coerce, no value
+++ Keywords: type, mode, coerce, unit type
++ Examples:
++ References:
++ Description:
-++ This type is used when no value is needed, e.g., in the \spad{then}
-++ part of a one armed \spad{if}.
+++ \spadtype{Void} implements the unit type in type theory.
+++ It allows only one value thus can hold no information.
+++ Void is used in the \spad{then} part of a one armed \spad{if}.
++ All values can be coerced to type Void. Once a value has been coerced
++ to Void, it cannot be recovered.
-Void : with
- void : () -> % ++ void() produces a void object.
- coerce : % -> OutputForm
- ++ coerce(v) coerces void object to OutputForm.
+Void : CoercibleTo OutputForm with
+ void : () -> %
+ ++ void() returns the void object.
== add
- Rep := String
- void() == voidValue()$Lisp
- coerce(v : %) == coerce(void())$Rep
+ void() == voidValue()$Lisp
+ coerce(v : %) == message "()"
)abbrev domain EXIT Exit
++ Author: Stephen M. Watt
diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot
index 863355a7..4f92dede 100644
--- a/src/interp/i-spec1.boot
+++ b/src/interp/i-spec1.boot
@@ -81,9 +81,11 @@
DEFPARAMETER($breakCount, 0)
DEFPARAMETER($anonymousMapCounter, 0)
---% Void stuff
+--% Void is the unit type that allows only one value.
+--% It can be anything and we use 0 here.
+--% It can't be NIL, see function "getArgValue" in "interpret1".
-voidValue() == '"()"
+voidValue() == 0
--% Handlers for Anonymous Function Definitions
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.