more cleanups & docs

This commit is contained in:
2025-08-10 17:02:47 +02:00
parent d278185ff3
commit 3ed6bafa84
10 changed files with 54 additions and 25 deletions

View File

@@ -5,7 +5,6 @@
[emptyhead.idea.property :as prop]
[emptyhead.util.magic :as magic]
[emptyhead.idea.protocol :as prtc]
[emptyhead.idea.crud :as idea]
[emptyhead.idea.memtag :as memtag]
[emptyhead.thought.define :as def]
[emptyhead.thought.crud :as thought]
@@ -71,8 +70,7 @@
(clear-context)
(run! #(eval! % context) (apply read input))
(pprint-tos context)
(prtc/reference (teval/execute! context context))
)
(prtc/reference (teval/execute! context context)))
;; XXX an annoying class of bug is eg forgetting the return value here, which yields just
;; >No protocol method Idea.value defined for type null:
@@ -82,13 +80,12 @@
(def/define! [:emptyhead :debug :track]
(fn [thought parent]
(let [ctx (:_parent (prtc/value parent))]
(print "RUNNING " (:operator (prtc/value parent)) " ON ")
(print "RUNNING " (thought/operator parent) " ON ")
(print "CONTEXT " ctx " WITH \n")
(print "STACK: ")
(print (:return ctx))
(print "\n\n")
[parent nil]
)))
[parent nil])))
(def sample (thought/register-thought! [:foo]))
@@ -115,7 +112,7 @@
(defn deref-name
[self name]
(or (and (= (prtc/val-fn :operator self) [:emptyhead :core :context])
(or (and (= (thought/operator self) [:emptyhead :core :context])
(resolve-name self name))
(and (prtc/val-fn :_parent self)
(deref-name (prtc/val-fn :_parent self) name))))
@@ -182,5 +179,4 @@
[:meme]
emptyhead.core.deref-name
emptyhead.core.execute
))
emptyhead.core.execute))