Exemple #1
0
func questionLike(c term.C) bool {
	for _, char := range c.String() {
		if char == '?' {
			return true
		}
	}
	return false
}
Exemple #2
0
func C(c term.C) term.T {
	switch c := c.(type) {
	case *term.CompoundC:
		args := make([]term.T, len(c.Values()))
		for i, arg := range c.Values() {
			args[i] = C(arg)
		}
		return QuotedCompoundC.T(Template(c.Head()), List(args))
	case term.ReferenceC:
		return QuotedReferenceC.T(Int(c.Index))
	case term.ConstC:
		return QuotedConstC.T(T(c.Val))
	}
	panic(fmt.Sprintf("trying to quote %v of unknown type %T", c, c))
}