stuff
This commit is contained in:
@@ -1 +1 @@
|
||||
["^ ","~$add-ext-stage!",["^ ","~:row",70,"~:col",1,"~:fixed-arities",["~#set",[2]],"~:name","^0","~:ns","~$emptyhead.thought.crud","~:top-ns","^7","~:type","~:fn"],"~$data",["^ ","^1",55,"^2",1,"^3",["^4",[1]],"^5","^;","^6","^7","^8","^7","^9","^:"],"~$stages",["^ ","^1",43,"^2",1,"^3",["^4",[1]],"^5","^<","^6","^7","^8","^7","^9","^:"],"~$contract",["^ ","^1",37,"^2",1,"^3",["^4",[1]],"^5","^=","^6","^7","^8","^7","^9","^:"],"~:filename","/home/akk0/Projects/nothoughts/src/cljs/emptyhead/thought/crud.cljs","~$register-thought!",["^ ","^1",27,"^2",1,"~:varargs-min-arity",1,"^5","^?","^6","^7","^8","^7","^9","^:"],"~$make-thought",["^ ","^1",11,"^2",1,"^@",1,"^5","^A","^6","^7","^8","^7","~:arities",["^ ","~:varargs",["^ ","~:ret","~:map","~:min-arity",1,"~:arglist-str","[operator & {:keys [data ext-contract ext-stages transient] :or {data {} ext-contract {} ext-stages [[:thought operator :pre] [:thought operator] [:PRE-EXECUTE] [:EXECUTE] [:POST-EXECUTE] [:thought operator :post]] transient true}}]"]],"^9","^:"],"~$stack",["^ ","^1",60,"^2",1,"^3",["^4",[1]],"^5","^H","^6","^7","^8","^7","^9","^:"],"~$operator",["^ ","^1",49,"^2",1,"^3",["^4",[1]],"^5","^I","^6","^7","^8","^7","^9","^:"],"~$root-thought",["^ ","^1",68,"^2",1,"^5","^J","^6","^7","^8","^7"],"~$pop-stack",["^ ","^1",64,"^2",1,"^3",["^4",[1]],"^5","^K","^6","^7","^8","^7","^B",["^ ","~i1",["^ ","^D","~:vector","^G","[thought]"]],"^9","^:"]]
|
||||
["^ ","~$add-ext-stage!",["^ ","~:row",68,"~:col",1,"~:fixed-arities",["~#set",[2]],"~:name","^0","~:ns","~$emptyhead.thought.crud","~:top-ns","^7","~:type","~:fn"],"~$data",["^ ","^1",53,"^2",1,"^3",["^4",[1]],"^5","^;","^6","^7","^8","^7","^9","^:"],"~$stages",["^ ","^1",41,"^2",1,"^3",["^4",[1]],"^5","^<","^6","^7","^8","^7","^9","^:"],"~$contract",["^ ","^1",35,"^2",1,"^3",["^4",[1]],"^5","^=","^6","^7","^8","^7","^9","^:"],"~:filename","/home/akk0/Projects/nothoughts/src/cljs/emptyhead/thought/crud.cljs","~$register-thought!",["^ ","^1",25,"^2",1,"~:varargs-min-arity",1,"^5","^?","^6","^7","^8","^7","^9","^:"],"~$make-thought",["^ ","^1",11,"^2",1,"^@",1,"^5","^A","^6","^7","^8","^7","~:arities",["^ ","~:varargs",["^ ","~:ret","~:map","~:min-arity",1,"~:arglist-str","[operator & {:keys [data ext-contract ext-stages transient] :or {data {} ext-contract {} ext-stages [[:PRE-EXECUTE] [:EXECUTE] [:POST-EXECUTE]] transient true}}]"]],"^9","^:"],"~$stack",["^ ","^1",58,"^2",1,"^3",["^4",[1]],"^5","^H","^6","^7","^8","^7","^9","^:"],"~$operator",["^ ","^1",47,"^2",1,"^3",["^4",[1]],"^5","^I","^6","^7","^8","^7","^9","^:"],"~$root-thought",["^ ","^1",66,"^2",1,"^5","^J","^6","^7","^8","^7"],"~$pop-stack",["^ ","^1",62,"^2",1,"^3",["^4",[1]],"^5","^K","^6","^7","^8","^7","^B",["^ ","~i1",["^ ","^D","~:vector","^G","[thought]"]],"^9","^:"]]
|
@@ -1,7 +1,7 @@
|
||||
var shadow$provide = {};
|
||||
var CLOSURE_NO_DEPS = true;
|
||||
var CLOSURE_BASE_PATH = '/js/cljs-runtime/';
|
||||
var CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.reload_strategy":"optimized","shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":true,"shadow.cljs.devtools.client.env.proc_id":"80f60b4d-1b21-4117-a647-849d7efc6ba4","shadow.cljs.devtools.client.env.use_document_protocol":false,"goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9630,"shadow.cljs.devtools.client.env.server_token":"8e194033-adb7-4606-984e-6e6b2e02f3e3","shadow.cljs.devtools.client.env.use_document_host":true,"shadow.cljs.devtools.client.env.module_format":"goog","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"game","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"shadow.cljs.devtools.client.env.log":true,"shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","shadow.cljs.devtools.client.env.worker_client_id":2,"goog.TRANSPILE":"never"};
|
||||
var CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.reload_strategy":"optimized","shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":true,"shadow.cljs.devtools.client.env.proc_id":"9eb08624-721a-4b99-9525-fad9c7b3eae3","shadow.cljs.devtools.client.env.use_document_protocol":false,"goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9630,"shadow.cljs.devtools.client.env.server_token":"6096f7d3-3614-47d6-81ae-ec1a7c0685db","shadow.cljs.devtools.client.env.use_document_host":true,"shadow.cljs.devtools.client.env.module_format":"goog","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"game","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"shadow.cljs.devtools.client.env.log":true,"shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","shadow.cljs.devtools.client.env.worker_client_id":2,"goog.TRANSPILE":"never"};
|
||||
var COMPILED = false;
|
||||
var goog = goog || {};
|
||||
goog.global = this || self;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
(def/define! [:emptyhead :core :context]
|
||||
(fn [thought parent]
|
||||
[parent nil])
|
||||
(into [parent] (-> thought :data :proc-ret)))
|
||||
:constr-fn
|
||||
(fn [thought parent]
|
||||
{:data {:parent (memtag/uid-of parent)}}))
|
||||
|
@@ -29,8 +29,8 @@
|
||||
|
||||
(def/define! [:emptyhead :core :add-ext-stage]
|
||||
(fn [thought parent]
|
||||
(let [[down stage] (thought/pop-stack parent)
|
||||
[_ op] (thought/pop-stack down)
|
||||
(let [[parent stage] (thought/pop-stack parent)
|
||||
[_ op] (thought/pop-stack parent)
|
||||
exe (prop/just-property op)]
|
||||
(thought/add-ext-stage! exe stage)
|
||||
[parent nil])))
|
||||
|
@@ -3,7 +3,9 @@
|
||||
[emptyhead.thought.extend :as extend]
|
||||
[emptyhead.thought.eval :as teval]
|
||||
[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]
|
||||
@@ -69,7 +71,8 @@
|
||||
(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:
|
||||
@@ -89,7 +92,7 @@
|
||||
|
||||
(def sample (thought/register-thought! [:foo]))
|
||||
|
||||
;; XXX This has to have no stages otherwise it will loop on itself ww
|
||||
;; XXX This has to have no :PRE-EXECUTE stage otherwise it will loop on itself ww
|
||||
(defonce tracker (thought/register-thought! [:emptyhead :debug :track] :ext-stages [[:EXECUTE]]))
|
||||
|
||||
(defn enable-tracking []
|
||||
@@ -102,14 +105,82 @@
|
||||
(defn disable-tracking []
|
||||
(map #(extend/remove-extension! % [:PRE-EXECUTE]) (extend/get-extensions [:PRE-EXECUTE])))
|
||||
|
||||
;; FIXME something is going wrong with the context management here
|
||||
;; It would probably be good to name contexts somehow to keep easier track of them
|
||||
(defn name-idea
|
||||
[idea context name]
|
||||
(prop/register-property! idea [:emptyhead :name name (prtc/reference context)]))
|
||||
|
||||
(defn resolve-name
|
||||
[context name]
|
||||
(prop/just-property [:emptyhead :name name (prtc/reference context)]))
|
||||
|
||||
(defn deref-name
|
||||
[self name]
|
||||
(or (and (= (prtc/val-fn :operator self) [:emptyhead :core :context])
|
||||
(resolve-name self name))
|
||||
(and (prtc/val-fn :_parent self)
|
||||
(deref-name (prtc/val-fn :_parent self) name))))
|
||||
|
||||
(def/define! [:GRAB]
|
||||
(fn [thought parent]
|
||||
(let [arg-num (inc (or (get-in parent [:data :last-arg]) -1))]
|
||||
[(assoc-in parent [:data :last-arg] arg-num)
|
||||
(-> parent prtc/value :_parent prtc/value :return (#(nth % (- (count %) arg-num 1))))])))
|
||||
|
||||
(def/define! [:RETURN]
|
||||
(fn [thought parent]
|
||||
(let [[parent val] (thought/pop-stack parent)]
|
||||
[(update-in parent [:data :proc-ret] (fnil conj []) val) nil])))
|
||||
|
||||
;; FIXME this wil bind two things to the same name if you name severa things the same
|
||||
;; FIXME this needs to wrap data in an [:emptyhead :core :return] and then evaluate that on deref
|
||||
(def/define! [:emptyhead :core :assign-name]
|
||||
(fn [_ parent]
|
||||
(let [[parent name] (thought/pop-stack parent)
|
||||
[_ op] (thought/pop-stack parent)
|
||||
exe (prop/just-property op)]
|
||||
(extend/register-extension! exe (into [:_name] name))
|
||||
[parent nil])))
|
||||
|
||||
;; FIXME this is a weird use of the extension system -- figure out how names should actually work!
|
||||
;; (in light of the way extensions usually work, see e.g. [emptyhead.thought.extend/get-extensions]) comment
|
||||
;; FIXME this needs to wrap data in an [:emptyhead :core :return] and then evaluate that on deref
|
||||
(def/define! [:emptyhead :core :deref-name]
|
||||
(fn [_ parent]
|
||||
(let [[parent name] (thought/pop-stack parent)
|
||||
deref (memtag/uid-of
|
||||
(prop/just-property (magic/extension-prop (into [:_name] name))))]
|
||||
[parent deref])))
|
||||
|
||||
(def tst
|
||||
'(.BEGIN
|
||||
"hello"
|
||||
"<> -- COMMENCE PROCEDURE -- <>"
|
||||
emptyhead.io.print
|
||||
|
||||
GRAB emptyhead.io.print
|
||||
GRAB emptyhead.io.print
|
||||
|
||||
"<> -- PROCEDURE COMPLETE -- <>"
|
||||
|
||||
42 RETURN
|
||||
69 RETURN
|
||||
.END
|
||||
emptyhead.io.print
|
||||
|
||||
[:meme]
|
||||
emptyhead.core.assign-name
|
||||
|
||||
"hello"
|
||||
"goodbye"
|
||||
[:meme]
|
||||
emptyhead.core.deref-name
|
||||
emptyhead.core.execute
|
||||
emptyhead.core.execute
|
||||
emptyhead.core.pop ;; pop deref'd name
|
||||
|
||||
"\nReturn values of previous:\n"
|
||||
emptyhead.io.print
|
||||
emptyhead.core.pop
|
||||
|
||||
[:meme]
|
||||
emptyhead.core.deref-name
|
||||
emptyhead.core.execute
|
||||
))
|
||||
|
@@ -13,9 +13,7 @@
|
||||
You may want `register-thought!` instead."
|
||||
[operator & {:keys [data ext-contract ext-stages transient]
|
||||
:or {data {} ext-contract {}
|
||||
ext-stages [[:thought operator :pre] [:thought operator]
|
||||
[:PRE-EXECUTE] [:EXECUTE] [:POST-EXECUTE]
|
||||
[:thought operator :post]]
|
||||
ext-stages [[:PRE-EXECUTE] [:EXECUTE] [:POST-EXECUTE]]
|
||||
transient true}}]
|
||||
(hash-map :operator operator
|
||||
:data data
|
||||
|
@@ -38,7 +38,7 @@
|
||||
;; If it's time for `thought`'s implementation to run, do so,
|
||||
;; potentially modifying `parent`.
|
||||
[parent & returns]
|
||||
(if (= cur [:EXECUTE]) ;; NOTE the magic value is now [:EXECUTE] since otherwise nothing could be bound to the global [:emptyhead] propspace
|
||||
(if (= '() (thought/stages th)) ;; NOTE the magic value is now [:EXECUTE] since otherwise nothing could be bound to the global [:emptyhead] propspace
|
||||
(impl! th parent)
|
||||
[parent nil])
|
||||
|
||||
|
Reference in New Issue
Block a user