Fix some primitive: return callback result, not element

List.find returns the element that matched, but SX some should return
the callback's truthy return value. This caused get-verb-info to return
"get" (the verb string) instead of the {method, url} dict.

Also added _active_vm tracking to VM for future HO primitive optimization,
and reverted get-verb-info to use some (no longer needs for-each workaround).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 01:13:52 +00:00
parent 3e6898197d
commit 0699de0144
6 changed files with 40 additions and 34 deletions

View File

@@ -86,20 +86,13 @@
:effects (io)
(fn
(el)
(let
((result nil))
(for-each
(fn
(verb)
(when
(not result)
(let
((url (dom-get-attr el (str "sx-" verb))))
(when
url
(set! result (dict "method" (upper verb) "url" url))))))
ENGINE_VERBS)
result)))
(some
(fn
(verb)
(let
((url (dom-get-attr el (str "sx-" verb))))
(if url (dict "method" (upper verb) "url" url) nil)))
ENGINE_VERBS)))
(define
build-request-headers