optimizations
This commit is contained in:
@@ -19,6 +19,19 @@ func (b Builtin) Inspect() string {
|
||||
return fmt.Sprintf("<built-in function %s>", b.Name)
|
||||
}
|
||||
|
||||
func (b Builtin) Compare(other Object) int {
|
||||
if obj, ok := other.(Builtin); ok {
|
||||
if b.Name > obj.Name {
|
||||
return 1
|
||||
}
|
||||
if b.Name == obj.Name {
|
||||
return 0
|
||||
}
|
||||
return -1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func (b Builtin) String() string {
|
||||
return b.Inspect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user