示例#1
0
func archo(q l.V) l.Goal {
	a, b := l.Fresh2()
	membero := l.StructMemberoConstructor4(t)
	return l.And(
		membero(Purchase{"The Foot Farm", v()}, q),
		membero(Purchase{"Heels in a Handcart", v()}, q),
		membero(Purchase{"The Shoe Palace", v()}, q),
		membero(Purchase{"Tootsies", v()}, q),
		membero(Purchase{v(), "ecru espadrilles"}, q),
		membero(Purchase{v(), "fuchsia flats"}, q),
		membero(Purchase{v(), "purple pumps"}, q),
		membero(Purchase{v(), "suede sandals"}, q),
		// 1
		membero(Purchase{"Heels in a Handcart", "fuchsia flats"}, q),
		// 3
		l.Unify(Trip{v(), Purchase{"The Foot Farm", v()}, v(), v()}, q),
		// 4
		aftero(Purchase{"The Shoe Palace", v()}, b, q),
		aftero(b, Purchase{v(), "suede sandals"}, q),
		// 2
		aftero(Purchase{v(), "purple pumps"}, Purchase{a, v()}, q),
		l.Neq(a, "Tootsies"),
	)

}
示例#2
0
文件: main.go 项目: glycerine/gologic
func main() {
	// v1, v2 := l.Fresh2()
	// g := func (a, b int) l.Goal {
	//         return l.Unify(a,b)
	// }
	// c := l.Run(v2, l.Or(l.And(l.Unify(v1,3),
	//                           l.Unify(v2,v1),
	//                           l.Unify(v1,l.Fresh()),
	// 	                  l.Unify(10,l.Fresh()),
	//                           g(1,1)),
	//                     l.Unify(v2,5),
	//                     l.Unify(v2,8)))

	// fmt.Println("# Results 1")

	// for {
	//         i := <- c
	//         if i != nil {
	//                 fmt.Println(i)
	//         } else {
	//                 break
	//         }
	// }

	q, x := l.Fresh2()
	c := l.Run(q, l.And(mult(q, x, 4), l.Unify(x, 2)))

	fmt.Println(<-c)

}
示例#3
0
func disconnected(a, b interface{}) l.Goal {
	x, y := l.Fresh2()
	return l.And(
		north_south_bridge(a, x),
		l.Neq(x, b),
		west_east_bridge(a, y),
		l.Neq(y, b))
}