This file is indexed.

/usr/share/axiom-20170501/src/algebra/ANY.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
)abbrev domain ANY Any
++ Author: Robert S. Sutor
++ Description:
++ \spadtype{Any} implements a type that packages up objects and their
++ types in objects of \spadtype{Any}. Roughly speaking that means
++ that if \spad{s : S} then when converted to \spadtype{Any}, the new
++ object will include both the original object and its type. This is
++ a way of converting arbitrary objects into a single type without
++ losing any of the original information. Any object can be converted
++ to one of \spadtype{Any}.

Any() : SIG == CODE where

  SIG ==> SetCategory with

    any : (SExpression, None) -> %
      ++ any(type,object) is a technical function for creating
      ++ an object of \spadtype{Any}. Arugment \spad{type} is a 
      ++ \spadgloss{LISP} form for the type of \spad{object}.

    domainOf : % -> OutputForm
      ++ domainOf(a) returns a printable form of the type of the
      ++ original object that was converted to \spadtype{Any}.

    objectOf : % -> OutputForm
      ++ objectOf(a) returns a printable form of the
      ++ original object that was converted to \spadtype{Any}.

    dom : % -> SExpression
      ++ dom(a) returns a \spadgloss{LISP} form of the type of the
      ++ original object that was converted to \spadtype{Any}.

    obj : % -> None
      ++ obj(a) essentially returns the original object that was
      ++ converted to \spadtype{Any} except that the type is forced
      ++ to be \spadtype{None}.

    showTypeInOutput : Boolean -> String
      ++ showTypeInOutput(bool) affects the way objects of
      ++ \spadtype{Any} are displayed. If \spad{bool} is true
      ++ then the type of the original object that was converted
      ++ to \spadtype{Any} will be printed. If \spad{bool} is
      ++ false, it will not be printed.
      ++
      ++X u:=[1,7.2,3/2,x**2,"wally"]
      ++X showTypeInOutput(true)
      ++X u       

  CODE ==> add

     Rep := Record(dm: SExpression, ob: None)

     printTypeInOutputP:Reference(Boolean) := ref false

     obj x == 
       x.ob

     dom x == 
       x.dm

     domainOf x == 
       x.dm pretend OutputForm

--     x = y == 
--       (x.dm = y.dm) and EQ(x.ob, y.ob)$Lisp

     x = y == 
       (x.dm = y.dm) and EQUAL(x.ob, y.ob)$Lisp

     objectOf(x : %) : OutputForm ==
       spad2BootCoerce(x.ob, x.dm,
          list("OutputForm"::Symbol)$List(Symbol))$Lisp

     showTypeInOutput(b : Boolean) : String ==
      printTypeInOutputP := ref b
      b=> "Type of object will be displayed in output of a member of Any"
      "Type of object will not be displayed in output of a member of Any"

     coerce(x):OutputForm ==
       obj1 : OutputForm := objectOf x
       not deref printTypeInOutputP => obj1
       dom1 :=
         p:Symbol := prefix2String(devaluate(x.dm)$Lisp)$Lisp
         atom?(p pretend SExpression) => list(p)$List(Symbol)
         list(p)$Symbol
       hconcat cons(obj1,
         cons(":"::OutputForm, [a::OutputForm for a in dom1]))

     any(domain, object) ==
       (isValidType(domain)$Lisp)@Boolean => [domain, object]
       domain := devaluate(domain)$Lisp
       (isValidType(domain)$Lisp)@Boolean => [domain, object]
       error "function any must have a domain as first argument"