- 신선한 탐사자(fable) 단일 컨텍스트, 지시서 -round10-brief.md §2 레인 A·C 완료, B 부분, D ALL PASS - audit/handtrace-round10-reference-impl/: round7 참조 구현을 현재 계약으로 갱신·재실행 (부수: round7/ref9 _recompute 첫 인자 오류 발견·정정) - base/·인덱스 레이어는 미변경 — 결정은 사용자 배치 회신 뒤 -round10-followup.md로 Co-authored-by: qwreey <me@qwreey.moe> Claude-Session: https://claude.ai/code/session_01546hjsYNLSMZdHdPyTZaGb
17 lines
701 B
Text
17 lines
701 B
Text
--!nocheck
|
|
local q = require("./core")
|
|
local A = q.Source(1)
|
|
local B = q.State(function(self, prev, a) return a:Get() * 10 end, {A}, "B")
|
|
local C = q.State(function(self, prev, a) return a:Get() * 100 end, {A}, "C")
|
|
local D = q.State(function(self, prev, b, c) return b:Get() + c:Get() end, {B, C}, "D")
|
|
local seen, depth = {}, 0
|
|
local O = q.Observer(D, function()
|
|
table.insert(seen, D:Get())
|
|
depth += 1
|
|
if depth == 1 then A:Set(3) end -- 전파 도중 동기 재진입 Set
|
|
end, "O")
|
|
D:Get()
|
|
A:Set(2)
|
|
print("관측 순서:", table.concat(seen, ","))
|
|
print("Observer 발화:", O.fires, "| D 재계산:", D.recomputes)
|
|
print("최종 D:Get() =", D:Get(), "(A=3이므로 330이어야 함)")
|