func (self *ClassOf) Call(args ...value.Value) value.Value { if len(args) != 1 { panic(fmt.Errorf( "class-of: arguments number does not match, expected: 1 given: %d", len(args))) } switch args[0].(type) { case *value.Bool: return value.NewSymbol(const_.BOOL) case *value.Int: return value.NewSymbol(const_.INT) case *value.Float: return value.NewSymbol(const_.FLOAT) case *value.Char: return value.NewSymbol(const_.CHAR) case *value.List: return value.NewSymbol(const_.LIST) case *value.Vect: return value.NewSymbol(const_.VECT) case *value.String: return value.NewSymbol(const_.STRING) case *value.Symbol: return value.NewSymbol(const_.SYMBOL) case *value.Closure: return value.NewSymbol(const_.PROC) case *value.Chan: return value.NewSymbol(const_.CHAN) } return nil }
func (self *QuasiQuote) Eval(env *scope.Scope) value.Value { //self.evalQuasiQuote(env, 0) fmt.Println(reflect.TypeOf(self.template)) switch val := self.template.(type) { case *Ident: return value.NewSymbol(val.ExtRep()) case *List: return self.template.Eval(env) default: panic("unexpected expression") } }
func (self *Quote) Eval(env *scope.Scope) value.Value { return value.NewSymbol(self.ExtRep()) }
func (self *Symbol) Eval(env *scope.Scope) value.Value { return value.NewSymbol(self.name) }