;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ACT-R 4.0 model for table 3.1
;;;
;;; to run the model call
;;; (reset)
;;; (goal-focus goal)
;;; (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 "Table 3.1 demo" 2)
(:table)
(:table-end)
(:button "Run model" "(progn
(reset)
(goal-focus goal)
(run))")
(: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)")
(:new-para)
"TIME:"
(:new-para)
"- It usually takes less than 1 minute to run the model"
(:new-para)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; This section contains the LISP functions to simulate
;;; the experiment, and display the results
(defun ordered (num1 num2)
(< (chunk-slot-value-fct num1 'value)
(chunk-slot-value-fct num2 'value)))
;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;
(clearall)
(sgp :v t :cst t :crt t :era t :rt 0.0)
(chunk-type find-product arg1 arg2 answer)
(chunk-type repeated-addition count amount total target answer)
(chunk-type sum addend1 addend2 sum)
(chunk-type integer value)
(add-dm
(goal isa find-product arg1 three arg2 four)
(sum1 isa sum addend1 four addend2 four sum eight)
(sum2 isa sum addend1 eight addend2 four sum twelve)
(one isa integer value 1)
(two isa integer value 2)
(three isa integer value 3)
(four isa integer value 4)
(eight isa integer value 8)
(twelve isa integer value 12))
(goal-focus goal)
(p reverse-args
=goal>
isa find-product
arg1 =num1
arg2 =num2
answer nil
!eval! (ordered =num1 =num2)
==>
=goal>
arg1 =num2
arg2 =num1
)
(p subgoal-addition
=goal>
isa find-product
arg1 =num1
arg2 =num2
answer nil
!eval! (not (ordered =num1 =num2))
=num>
isa integer
value =val
==>
=newgoal>
isa repeated-addition
count 1
amount =num1
total =num1
target =val
answer =answer
=goal>
answer =answer
!push! =newgoal
)
(p add-once
=goal>
isa repeated-addition
count =c
amount =a
total =t
target =x
!eval! (< =c =x)
=sum>
isa sum
addend1 =t
addend2 =a
sum =y
==>
=goal>
total =y
count (!eval! (1+ =c))
)
(p pop-addition
=goal>
isa repeated-addition
count =c
target =c
total =t
==>
=goal>
answer =t
!pop!
)
(p multiplication-solved
=goal>
isa find-product
answer =a
!eval! (numberp =a)
==>
!output! ("The answer is ~s" =a)
!pop!
)
(p retrieve-output
=goal>
isa find-product
answer =a
!eval! (not (numberp =a))
=a>
isa integer
value =value
==>
=goal>
answer =value
)
(p add-once-reverse
=goal>
isa repeated-addition
count =c
amount =a
total =t
target =x
!eval! (< =c =x)
=sum>
isa sum
addend1 =t
addend2 =a
sum =y
==>
=goal>
total =y
count (!eval! (1+ =c))
)
(parameters ADD-ONCE-REVERSE :A 0.2)