eyre: replace +slam with +slym for a speedup
:: we can't do anything about this, so consider it unsupported.
?~ sign=(channel-event-to-sign channel-event) $
?~ json-with-moves=(sign-to-json request-id u.sign) $
- $(events [(event-json-to-wall id p.u.json-with-moves) events])
+ $(events [(event-json-to-wall id +.u.json-with-moves) events])
:: send the start event to the client
::
=^ http-moves state
:: if conversion succeeds, we *can* send it. if the client is actually
:: connected, we *will* send it immediately.
::
- =/ json-with-moves=(unit (pair json (list move)))
+ =/ json-with-moves=(unit (quip move json))
(sign-to-json request-id sign)
=/ json=(unit json)
?~ json-with-moves ~
- `p.u.json-with-moves
+ `+.u.json-with-moves
=? moves ?=(^ json-with-moves)
- (weld moves q.u.json-with-moves)
+ (weld moves -.u.json-with-moves)
=* sending &(?=([%| *] state.u.channel) ?=(^ json))
::
=/ next-id next-id.u.channel
^= data
%- wall-to-octs
%+ event-json-to-wall next-id
- p:(need (sign-to-json request-id %kick ~))
+ +:(need (sign-to-json request-id %kick ~))
::
complete=%.n
==
:: +sign-to-json: render sign from request-id as json channel event
::
++ sign-to-json
+ ~% %sign-to-json ..part ~
|= [request-id=@ud =sign:agent:gall]
- ^- (unit (pair json (list move)))
+ ^- (unit (quip move json))
:: for facts, we try to convert the result to json
::
- =/ jsyn=(pair (unit mark) (unit sign:agent:gall))
+ =/ [from=(unit mark) jsyn=(unit sign:agent:gall)]
?. ?=(%fact -.sign) [~ `sign]
?: ?=(%json p.cage.sign) [~ `sign]
:: find and use tube from fact mark to json
`q.u.u.cag
?~ convert
((slog leaf+"eyre: no convert {desc}" ~) [~ ~])
- [`have `[%fact %json (slam u.convert q.cage.sign)]]
- ::
- ?~ q.jsyn ~
+ [`have `[%fact %json (slym u.convert q.q.cage.sign)]]
+ ?~ jsyn ~
%- some
- :_ ?~ p.jsyn ~
+ :- ?~ from ~
:_ ~
- :^ duct %pass /conversion-cache/[u.p.jsyn]
- [%c %warp our %home `[%sing %f da+now /[u.p.jsyn]/json]]
- =* sign u.q.jsyn
+ :^ duct %pass /conversion-cache/[u.from]
+ [%c %warp our %home `[%sing %f da+now /[u.from]/json]]
+ =* sign u.jsyn
=, enjs:format
%- pairs
^- (list [@t json])
