On Sat, Jun 30, 2018 at 1:07 PM, Bill Page <[email protected]> wrote: >... > (2) -> f(1) > Internal Error > Interpreter code generation failed for expression(|f| 1) > ... > On Sat, Jun 30, 2018 at 11:30 AM, Waldek Hebisch > <[email protected]> wrote: >> The message looks like coming from interpreter and given >> Spad function of correct type interpreter should just blindly >> call it. >> > > Yes, I thought so too.
Actually I just realized that this sort of error was already anticipated by Oldk1331. It looks like evaluating the function f(1) returns the wrong value for Void - NIL instead of voidValue(). See the comment about "getArgValue" in the following patch: ---------- Forwarded message ---------- From: oldk1331 <[email protected]> Date: Tue, Jun 12, 2018 at 9:37 AM Subject: [fricas-devel] [PATCH] Void is the unit type, fix doc and cleanup (use 0 as representation) To: fricas-devel <[email protected]> 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 -- -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
