-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHomSet.class.st
More file actions
104 lines (89 loc) · 2.3 KB
/
Copy pathHomSet.class.st
File metadata and controls
104 lines (89 loc) · 2.3 KB
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
"
Hom(A,B), Hom-Set objects for domain A and codomain B, i.e. sets of all morphisms from A to B. When A = B, this is noted End(A), the set of endomorphisms.
"
Class {
#name : #HomSet,
#superclass : #Domain,
#category : #'Mathematics-Kernel'
}
{ #category : #examples }
HomSet class >> example1 [
"The object Hom(N,Z), the functions from the natural numbers to the integers.
This is the space of sequences. (See class Sequence)."
^ NN hom: ZZ
]
{ #category : #examples }
HomSet class >> example2 [
"The endomorphisms of the rational integers Z.
This is Hom(Z,Z), the set of ring homomorphisms from Z to itself."
^ ZZ endomorphisms
]
{ #category : #'instance creation' }
HomSet class >> from: aDomain to: anotherDomain [
^ self new domain: aDomain; codomain: anotherDomain
]
{ #category : #elements }
HomSet >> ! anObject [
anObject isEvaluable
ifTrue: [ ^ self evaluating: anObject ].
^ super ! anObject
]
{ #category : #accessing }
HomSet >> codomain [
^ self propertyAt: #codomain
]
{ #category : #'accessing-private' }
HomSet >> codomain: aDomain [
self propertyAt: #codomain put: aDomain
]
{ #category : #accessing }
HomSet >> domain [
^ self propertyAt: #domain
]
{ #category : #'accessing-private' }
HomSet >> domain: aDomain [
self propertyAt: #domain put: aDomain
]
{ #category : #elements }
HomSet >> evaluating: aBlock [
^ self domain to: self codomain evaluating: aBlock
]
{ #category : #elements }
HomSet >> evaluatingWithArguments: aBlock [
^ self domain to: self codomain evaluatingWithArguments: aBlock
]
{ #category : #elements }
HomSet >> identity [
^ self isEndomorphisms
ifTrue: [ self domain id ]
]
{ #category : #testing }
HomSet >> includes: aMorphism [
^ (aMorphism isKindOf: Morphism)
and: [ aMorphism domain = self domain
and: [ aMorphism codomain = self codomain ] ]
]
{ #category : #testing }
HomSet >> isEndomorphisms [
^ self domain = self codomain
]
{ #category : #operations }
HomSet >> opposite [
^ self class from: self codomain to: self domain
]
{ #category : #printing }
HomSet >> printOn: aStream [
self isEndomorphisms
ifTrue: [ aStream
nextPutAll: 'End';
nextPut: $(;
print: self domain;
nextPut: $) ]
ifFalse: [ aStream
nextPutAll: 'Hom';
nextPut: $(;
print: self domain;
nextPut: $,;
print: self codomain;
nextPut: $) ]
]