; Metalinguistic Abstraction with Hal ; Implementing a declarative/logical programming language. ;;; EXAMPLE in imperative form: ;(define (merge x y) ; (cond ; ((null? x) y) ; ((null? y) x) ; (else ; (let ((a (car x)) (b (car y))) ; (if (< a b) ; (cons a ; (merge (cdr x) y)) ; (cons b ; (merge x (cdr y)))))))) ; 8A:(18m25s) ; QUESTION, BREAK ; 8A:(21m20s) "Making a collection of facts" ;; Ben Bitdiddle (underpaid computer wizard) ;(job (Bitdiddle Ben) (computer wizard)) ;(salary (Bitdiddle Ben) 40000) ;(supervisor (Bitdiddle Ben) ; (Warbucks Oliver)) ;(address (Bitdiddle Ben) ; (Slunerville (Ridge Road) 10)) ;; Alyssa P. Hacker ;(address (Hacker Alyssa P) ; (Cambridge (Mass Ave) 78) ;(job (Hacker Alyssa P) ; (computer programmer)) ;(salary (Hacker Alyssa P) 35000) ;(supervisor (Hacker Alyssa P) ; (Bitdiddle Ben)) ;; Lem E. Tweakit ;(address (Tweakit Lem E) ; (Boston (Bay State Road) 22)) ;(job (Tweakit Len E) ; (computer technician)) ;(salary (Tweakit Len E) 15000) ;(supervisor (Tweakit Lem E) ; (Bitdiddle Ben)) ;; Louis Reasoner ;(address (Reasoner Louis) ; (Slunerville (Pine Tree Road) ; 80)) ;(job (Reasoner Louis) ; (computer programmer trainee)) ;(salary (Reasoner Louis) 20000) ;(supervisor (Reasoner Louis) ; (Hacker Alyssa P)) ;; Oliver Warbucks ;(job (Warbucks Oliver) ; (administration big wheel)) ;(salary (Warbucks Oliver) 100000) ;(address (Warbucks Oliver) ; (Swellesley (The Manor))) ; "Now, fine... What are the primitives? ; What are the Means of Combination? ; And what are the Means of Abstraction?" ;(job ?x (computer ?type)) ;; MATCHES ;(job (Bitdiddle Ben) (computer wizard)) ;(job (Hacker Alyssa P) ; (computer programmer)) ;(job (Tweakit Lem E) ; (computer technician)) ;; DOESN'T MATCH ;(job (Reasoner Louis) ; (computer programmer trainee)) ;(job ?x (computer . ?type)) ;; WOULD (because of the Lisp reader) ALSO MATCH: ;(job (Reasoner Louis) ; (computer programmer trainee)) ; ONE PRIMITIVE: QUERY ; MEANS OF COMBINATION: ; LISP-VALUE ; AND ; NOT ; OR ; MEANS OF ABSTRACTION: RULE ; 8A:(34m50s) ;;; EXAMPLE in logical form: ;(rule (merge-to-form () ?y ?y)) ;(rule (merge-to-form ?y () ?y)) ;(rule ; (merge-to-form ; (?a . ?x) (?b . ?y) (?b . ?z)) ; (and (merge-to-form (?a . ?x) ?y ?z) ; (lisp-value > ?a ?b))) ;(rule ; (merge-to-form ; (?a . ?x) (?b . ?y) (?a . ?z)) ; (and (merge-to-form ?x (?b . ?y) ?z) ; (lisp-value > ?b ?a))) ; QUESTION 8A:(40m) (END)