func if_s(env *environment.Environment, a types.Type) (types.Type, error) { test, err := types.Car(a) if err != nil { return nil, err } b, err := Eval(env, test) if err != nil { return nil, err } var toEval types.Type if b.(*types.Bool).Value { toEval, err = types.Cadr(a) if err != nil { return nil, err } } else { temp, err := types.Cdr(a) if err != nil { return nil, err } toEval, err = types.Cadr(temp) if err != nil { return nil, err } } return Eval(env, toEval) }
func define(env *environment.Environment, args types.Type) error { name, err := types.Car(args) if err != nil { return err } value, err := types.Cadr(args) if err != nil { return err } evaldValue, err := Eval(env, value) if err != nil { return err } environment.Define(env, name.(*types.Symbol), evaldValue) return nil }