lisp - ACT-R 块中的变量输入输出
问题描述
给定 Unit1 标准 ACTR 纪录片代码:
(add-dm
(b ISA count-order first 1 second 2)
(c ISA count-order first 2 second 3)
(d ISA count-order first 3 second 4)
(e ISA count-order first 4 second 5)
(firstgoal ISA count-from start 0 end 5)
)
问题:查看 den firstgoal 块中的 0 和 5。是否可以声明更通用的,例如:
(firstgoal ISA count-from start *global_start_var* end *global_end_var*)
- 是否可以在块中输出特定值?说到计数器,我想要一个运行模型的代码,然后评估计数器模型计数到的数字
示例 lisp 代码在 lisp 模型中如何具有适当的值渗透
;; load the model
(load "counter.lisp")
;; set the start and end variables
(setvar *global_start_var* 0)
(setvar *global_start_end* 9)
;; run the model
(run 9999)
;; safe the result of the counter in the (local) variable result using the function get_val
(result (get_val))
解决方案
要使用 Lisp 变量设置块内容,您可以使用 add-dm-fct 函数,该函数采用块描述列表的列表:
(add-dm-fct (list (list 'firstgoal 'ISA 'count-from 'start *global_start_var* 'end *global_end_var*)))
要从块的槽中获取当前值,您需要使用宏块槽值或函数块槽值-fct。它们都采用两个参数:块的名称和槽的名称,然后返回该块中该槽的值。使用您在那里显示的块,这是:
(chunk-slot-value b first)
将返回 1。
推荐阅读
- swift - NSRegularExpression 在 CRLF 之后不匹配任何内容。为什么?
- android - 使用 Firebase 身份验证的正确方法是什么?
- javascript - 循环 JSON 对象并将唯一的 JSON 项分配给给定的变量
- python-3.x - 为什么使用 Gaussian NB 分类器查找测试数据的分数时得到 0.0 的分数?
- gcc - CMAKE 中的 net-snmp 标志
- java - 我的类扩展 OutputStream 的 GZIPOutputStream 问题
- excel - 修剪不同工作表VBA中行和列中的单元格值
- c# - 使用 Selenium 在私有模式下打开 Internet Explorer
- android - 具有动态 applicationId 的 Firebase
- r - 如何将 30 年期间的每日数据转换为多元系列的每月数据?