예제 #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
파일: island.go 프로젝트: glycerine/gologic
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))
}