Building Database Access
; retrievals = things to get from database
; restrictions = restrictions on the query
; Main function: ask
(defn ask [sentence]
...
(s)
...
(let [ans (querydb (cons 'and restrictions)
(cons 'list retrievals))]
(if postprocess
(eval (subst ans '$$ postprocess))
ans )) ) )
; make a database access call
(defn retrieve [field]
(addretrieval (list 'getdb 'tuple (kwote field)) ))
; add a restriction to the query
(defn restrict [field value]
(addrestrict
(list '= (list 'getdb 'tuple (kwote field))
(kwote value)) ) )