restructure project
Some checks failed
Build / build (push) Failing after 5m21s
Publish Image / publish (push) Failing after 32s
Test / build (push) Failing after 5m8s

This commit is contained in:
Chuck Smith
2024-03-28 16:20:09 -04:00
parent 362138ff2e
commit fc6ceee02c
93 changed files with 479 additions and 194 deletions

41
internal/object/int.go Normal file
View File

@@ -0,0 +1,41 @@
package object
import "fmt"
type Integer struct {
Value int64
}
func (i *Integer) Bool() bool {
return i.Value != 0
}
func (i *Integer) Type() ObjectType {
return INTEGER_OBJ
}
func (i *Integer) Inspect() string {
return fmt.Sprintf("%d", i.Value)
}
func (i *Integer) Clone() Object {
return &Integer{Value: i.Value}
}
func (i *Integer) String() string {
return i.Inspect()
}
func (i *Integer) Compare(other Object) int {
if obj, ok := other.(*Integer); ok {
switch {
case i.Value < obj.Value:
return -1
case i.Value > obj.Value:
return 1
default:
return 0
}
}
return -1
}