Esempio n. 1
0
func inferValue(val Value) lisp.Value {
	switch lv := val.Read().(type) {
	case int:
		return lisp.NumberValue(int64(lv))
	case int32:
		return lisp.NumberValue(int64(lv))
	case int64:
		return lisp.NumberValue(lv)
	case string:
		return lisp.StringValue(lv)
	case *Result:
		return lisp.MapValue(&lispResult{lv})
	default:
	}

	return lisp.StringValue(fmt.Sprintf("%s", val.Read()))
}
Esempio n. 2
0
func (pe *PlayEnv) Set(key string, val interface{}) {
	pe.Vars[key] = val

	switch lv := val.(type) {
	case int64:
		pe.lispScope.Set(key, lisp.NumberValue(lv))
	default:
		pe.lispScope.Set(key, lisp.StringValue(fmt.Sprintf("%s", lv)))
	}
}