
This is a potentially weird case and decision on what to do about it. In general, when we print out answers, we try to make sure that they look like valid datalog. In this case, a Racket value is being used a Datalog constant (which is legal and part of the #lang datalog embedding), so we can't know what syntax was used to get it in the first place... so by using a ~v we get a distinctive printing that shows it isn't datalog. On the other hand, I could change #lang datalog so that it's environment is empty and this program wouldn't be referring to '()
17 lines
196 B
Racket
17 lines
196 B
Racket
#lang datalog
|
|
|
|
type(z, tz).
|
|
|
|
listof(tz, ez).
|
|
|
|
int(ez).
|
|
|
|
casepair(z, za, tza, zb, tzb).
|
|
|
|
pair(TA, TE, null) :-
|
|
casepair(V, VA, TA, VB, TB),
|
|
type(V, TV),
|
|
listof(TV, TE).
|
|
|
|
pair(A, B, C)?
|