/usr/share/axiom-20170501/src/algebra/SWITCH.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | )abbrev domain SWITCH Switch
-- Because of a bug in the compiler:
)bo $noSubsumption:=false
++ Author: Mike Dewar
++ Date Created: April 1991
++ Date Last Updated: March 1994 30.6.94 Added coercion from Symbol MCD
++ Basic Operations:
++ Related Constructors: FortranProgram, FortranCode, FortranTypes
++ Also See:
++ AMS Classifications:
++ Keywords:
++ References:
++ Description:
++ This domain builds representations of boolean expressions for use with
++ the \axiomType{FortranCode} domain.
Switch() : SIG == CODE where
EXPR ==> Union(I:Expression Integer,F:Expression Float,
CF:Expression Complex Float,switch:%)
SIG ==> CoercibleTo OutputForm with
coerce : Symbol -> $
++ coerce(s) is not documented
LT : (EXPR,EXPR) -> $
++ LT(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x<y}.
GT : (EXPR,EXPR) -> $
++ GT(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x>y}.
LE : (EXPR,EXPR) -> $
++ LE(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x<=y}.
GE : (EXPR,EXPR) -> $
++ GE(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x>=y}.
OR : (EXPR,EXPR) -> $
++ OR(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x or y}.
EQ : (EXPR,EXPR) -> $
++ EQ(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x = y}.
AND : (EXPR,EXPR) -> $
++ AND(x,y) returns the \axiomType{Switch} expression
++ representing \spad{x and y}.
NOT : EXPR -> $
++ NOT(x) returns the \axiomType{Switch} expression
++ representing \spad{\~~x}.
NOT : $ -> $
++ NOT(x) returns the \axiomType{Switch} expression
++ representing \spad{\~~x}.
CODE ==> add
Rep := Record(op:BasicOperator,rands:List EXPR)
-- Public function definitions
nullOp : BasicOperator := operator NULL
coerce(s:%):OutputForm ==
rat := (s . op)::OutputForm
ran := [u::OutputForm for u in s.rands]
(s . op) = nullOp => first ran
#ran = 1 =>
prefix(rat,ran)
infix(rat,ran)
coerce(s:Symbol):$ ==
[nullOp,[[s::Expression(Integer)]$EXPR]$List(EXPR)]$Rep
NOT(r:EXPR):% ==
[operator("~"::Symbol),[r]$List(EXPR)]$Rep
NOT(r:%):% ==
[operator("~"::Symbol),[[r]$EXPR]$List(EXPR)]$Rep
LT(r1:EXPR,r2:EXPR):% ==
[operator("<"::Symbol),[r1,r2]$List(EXPR)]$Rep
GT(r1:EXPR,r2:EXPR):% ==
[operator(">"::Symbol),[r1,r2]$List(EXPR)]$Rep
LE(r1:EXPR,r2:EXPR):% ==
[operator("<="::Symbol),[r1,r2]$List(EXPR)]$Rep
GE(r1:EXPR,r2:EXPR):% ==
[operator(">="::Symbol),[r1,r2]$List(EXPR)]$Rep
AND(r1:EXPR,r2:EXPR):% ==
[operator("and"::Symbol),[r1,r2]$List(EXPR)]$Rep
OR(r1:EXPR,r2:EXPR):% ==
[operator("or"::Symbol),[r1,r2]$List(EXPR)]$Rep
EQ(r1:EXPR,r2:EXPR):% ==
[operator("EQ"::Symbol),[r1,r2]$List(EXPR)]$Rep
|