Example #1
0
		if Keyword_Q(a[0]) {
			return a[0], nil
		} else {
			return NewKeyword(a[0].(string))
		}
	},
	"keyword?": func(a []MalType) (MalType, error) {
		return Keyword_Q(a[0]), nil
	},

	"pr-str":  func(a []MalType) (MalType, error) { return pr_str(a) },
	"str":     func(a []MalType) (MalType, error) { return str(a) },
	"prn":     func(a []MalType) (MalType, error) { return prn(a) },
	"println": func(a []MalType) (MalType, error) { return println(a) },
	"read-string": func(a []MalType) (MalType, error) {
		return reader.Read_str(a[0].(string))
	},
	"slurp": slurp,
	"readline": func(a []MalType) (MalType, error) {
		return readline.Readline(a[0].(string))
	},

	"<": func(a []MalType) (MalType, error) {
		return a[0].(int) < a[1].(int), nil
	},
	"<=": func(a []MalType) (MalType, error) {
		return a[0].(int) <= a[1].(int), nil
	},
	">": func(a []MalType) (MalType, error) {
		return a[0].(int) > a[1].(int), nil
	},
Example #2
0
// read
func READ(str string) (MalType, error) {
	return reader.Read_str(str)
}