/usr/share/axiom-20170501/src/algebra/PATLRES.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 | )abbrev domain PATLRES PatternMatchListResult
++ Author: Manuel Bronstein
++ Date Created: 4 Dec 1989
++ Date Last Updated: 4 Dec 1989
++ Description:
++ A PatternMatchListResult is an object internally returned by the
++ pattern matcher when matching on lists.
++ It is either a failed match, or a pair of PatternMatchResult,
++ one for atoms (elements of the list), and one for lists.
-- not exported
PatternMatchListResult(R,S,L) : SIG == CODE where
R : SetCategory
S : SetCategory
L : ListAggregate S
SIG ==> SetCategory with
failed? : % -> Boolean
++ failed?(r) tests if r is a failed match.
failed : () -> %
++ failed() returns a failed match.
new : () -> %
++ new() returns a new empty match result.
makeResult : (PatternMatchResult(R,S), PatternMatchResult(R,L)) -> %
++ makeResult(r1,r2) makes the combined result [r1,r2].
atoms : % -> PatternMatchResult(R, S)
++ atoms(r) returns the list of matches that match atoms
++ (elements of the lists).
lists : % -> PatternMatchResult(R, L)
++ lists(r) returns the list of matches that match lists.
CODE ==> add
Rep := Record(a:PatternMatchResult(R, S), l:PatternMatchResult(R, L))
new() == [new(), new()]
atoms r == r.a
lists r == r.l
failed() == [failed(), failed()]
failed? r == failed?(atoms r)
x = y == (atoms x = atoms y) and (lists x = lists y)
makeResult(r1, r2) ==
failed? r1 or failed? r2 => failed()
[r1, r2]
coerce(r:%):OutputForm ==
failed? r => atoms(r)::OutputForm
RecordPrint(r, Rep)$Lisp
|