;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ACT-R 4.0 model for demonstrating an analogy feature 
;;; to run the model, load the model and call
;;; (run)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; This section contains the interface for the WWW using the
;;; ACT-R on the Web application by Elmar Schwarz


(defvar *WWW-interface*)

(setf  *WWW-interface* 
      '((:heading "Analogy Example Table 4.6" 2)
        (:new-para)
        
        (:button "Run model" "(progn 
                              (reset)
                              (run)
                              (format *standard-output* \"~%New production:~%~%\")
                              
                              (dolist (x (no-output (pp)))
                                  (unless (equal x 'study-dependency)
                                      (pp-fct (list x)))))")
        (:button "Production Rules" "(let ((prods (no-output (pp))))
                                       (dolist (x prods)
                                         (pp-fct (list x))
                                         (spp-fct (list x))
                                         (format *standard-output* \"~%\")))")
        (:button "Chunk types" "(chunk-type)")
        (:button "Chunks" "(dm)")
        ))

;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;

(clearall)

(sgp :v t)

(wmetype factor arg prod1 prod2)
(wmetype multiplication-fact arg1 arg2 product)

(addwm
 (twenty-four
  isa chunk)
 (six
  isa chunk)
 (four 
  isa chunk)
 (one 
  isa chunk)
 (example4
  isa dependency
  goal goal9
  modified goal10
  constraints six*four
  differents (six one))
 (goal9
  isa factor
  arg twenty-four
  prod1 nil
  prod2 nil)
 (goal10
  isa factor
  arg twenty-four
  prod1 six
  prod2 four)
 (six*four
  isa multiplication-fact
  arg1 six
  arg2 four
  product twenty-four))

(goal-focus example4)

(p study-dependency
   =goal>
      isa dependency
==>
   !pop!
)