@@ -14,6 +14,8 @@ type Symbol struct {
1414
1515var (
1616 symbolRegex = regexp .MustCompile (`^(?:[^0-9/].*/)?(?:/|[^0-9/][^/]*)$` )
17+
18+ _ IFn = (* Symbol )(nil )
1719)
1820
1921// NewSymbol creates a new symbol.
@@ -34,7 +36,7 @@ func NewSymbol(s string) *Symbol {
3436 }
3537}
3638
37- func InternSymbol (ns , name interface {} ) * Symbol {
39+ func InternSymbol (ns , name any ) * Symbol {
3840 if ns == nil {
3941 return NewSymbol (name .(string ))
4042 }
@@ -127,7 +129,7 @@ func (s *Symbol) String() string {
127129 return s .ns + "/" + s .name
128130}
129131
130- func (s * Symbol ) Equals (v interface {} ) bool {
132+ func (s * Symbol ) Equals (v any ) bool {
131133 if s == v {
132134 return true
133135 }
@@ -145,7 +147,7 @@ func (s *Symbol) Meta() IPersistentMap {
145147 return s .meta
146148}
147149
148- func (s * Symbol ) WithMeta (meta IPersistentMap ) interface {} {
150+ func (s * Symbol ) WithMeta (meta IPersistentMap ) any {
149151 if s .meta == meta {
150152 return s
151153 }
@@ -160,3 +162,18 @@ func (s *Symbol) Hash() uint32 {
160162 h .Write ([]byte (s .ns + "/" + s .name ))
161163 return h .Sum32 () ^ symbolHashMask
162164}
165+
166+ func (s * Symbol ) Invoke (args ... any ) any {
167+ switch len (args ) {
168+ case 1 :
169+ return Get (args [0 ], s )
170+ case 2 :
171+ return GetDefault (args [0 ], s , args [1 ])
172+ default :
173+ panic (NewIllegalArgumentError ("symbol invoke expects 1 or 2 arguments" ))
174+ }
175+ }
176+
177+ func (s * Symbol ) ApplyTo (args ISeq ) any {
178+ return s .Invoke (seqToSlice (args )... )
179+ }
0 commit comments