radio-command/mar json grabbed

This commit is contained in:
Anton Dyudin 2014-12-05 17:18:31 -08:00
parent e3e3bee184
commit 08cda0da1f
5 changed files with 160 additions and 4 deletions

View File

@ -782,6 +782,11 @@
++ bu :: boolean not
|=(jon=json ?.(?=([%b *] jon) ~ [~ u=!p.jon]))
::
++ ci :: maybe transform
|* [poq=$+(* *) wit=fist]
|= jon=json
(biff (wit jon) poq)
::
++ cu :: transform
|* [poq=$+(* *) wit=fist]
|= jon=json

View File

@ -0,0 +1,51 @@
/- *radio
!:
::::
::
|_ [hide ~]
++ peek
|= ^
=+ :+ dat=(trip '{ping: {party:"rom", presence:"talk"}}')
=- dat2=(trip -)
'''
{ publish:
[{ serial:
"0vs.tteei.qlhhr.v09gs.s3iml.7him6.2injj.uiiu6.hg990.fha70.cqdtm",
statement:
{ now: Date.now(),
speech:
{ say: "Hello world"
}
},
audience:
{ "~zod/rume": "received",
"twitter/_urbit": "pending"
}
}]
}
'''
^= js
%- trip
'''
function come(a){
urb.send({
appl: 'radio-test',
mark: 'radio-command',
data: a
})
}
'''
:- %hymn
;html
;head
;script(src "/gen/main/lib/urb.js");
;script: {js}
;script: dat = {dat2}
==
;body:button(onclick "come(dat)"):"Ping"
==
++ poke-radio-command
|= [ost=bone ship com=command]
~& got/com
[[ost %give /nice]~ +>]
--

View File

@ -196,7 +196,7 @@
[[ost %give +.sih] (spam [p.tel q.tel new])]
==
==
==
==
::
++ send
|= mez=mess
@ -259,4 +259,15 @@
?. ?=(?(%fork %resp %txt %kyev) i.pax) !!
=+ abet:(pour:(se hid ost our.hid hiz t.pax) i.pax sih)
[-< +>.$(hiz ->)]
::
++ prep
|= old=(unit (unit axle))
^- [(list move) _+>]
:- ~
%_ +>.$
hiz
?. ?=([~ ~ *] old) hiz
%- ~(run by hiz.u.u.old)
|=(term-line [p q ~])
==
--

View File

@ -0,0 +1,89 @@
::
:::: /hook/door/radio-command/mar
::
/? 314
/- *radio
!:
|_ cod=command
::
++ grab :: convert from
|%
++ noun command :: clam from %noun
++ json
=> [jo ..command]
|= a=json ^- command
=- (need ((of -) a))
=< :~ publish/(ar thot)
review/(ar thot)
design/(ot party/so config/(mu conf) ~)
ping/(ot party/so presence/(ci (soft presence) so) ~)
==
|%
++ op :: parse keys of map
|* [fel=_rule wit=fist]
%+ cu mo
%- ci :_ (om wit)
|= a=(map cord ,_(need *wit))
^- (unit (list ,_[(wonk *fel) (need *wit)]))
(zl (turn (~(tap by a)) (head-rush fel)))
::
++ as :: array as set
:: |*(a=fist (cu sa (ar a))) :: XX types
|* a=fist
%- cu :_ (ar a)
~(gas in *(set ,_(need *a)))
::
++ lake |*(a=_,* $+(json (unit a)))
++ peach
|* a=_[rule rule]
|= tub=nail
^- (like (each ,_(wonk (-.a)) ,_(wonk (+.a))))
%. tub
;~(pose (stag %& -.a) (stag %| +.a))
::
++ head-rush
|* a=_rule
|* [b=cord c=*]
=+ nit=(rush b a)
?~ nit ~
(some [u.nit c])
::
::
++ thot
^- $+(json (unit thought))
%- ot :~
serial/(ci (slat %uv) so)
audience/audi
statement/stam
==
::
++ audi (op stati (ci (soft delivery) so)) :: audience
::
++ stati
^- $+(nail (like station))
%+ peach
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
%+ sear (soft partner)
;~((glue fas) sym (cook crip (star prn))) :: XX [a-z0-9_]+
::
++ stam
^- $+(json (unit statement))
=- (ot now/di speech/(of -) ~)
:~ own/so
say/so
exp/(cu |=(a=cord [a ~]) so)
inv/(ot ship/(su fed:ag) room/(su urs:ab) ~)
==
::
::
++ conf
^- $+(json (unit config))
%- ot :~
sources/(as (su stati))
:- %cordon
%+ cu |*(a=^ ?~(-.a a a)) :: XX do type stuff
(ot white/bu list/(as (su fed:ag)) ~)
==
--
-- --

View File

@ -3,7 +3,7 @@
::
|%
++ audience (map station delivery) :: destination/state
++ cousin (pair span ship) :: domestic flow
++ cousin (pair ship span) :: domestic flow
++ command :: effect on party
$% [%design (pair span (unit config))] :: configure/destroy
[%publish (list thought)] :: originate
@ -34,11 +34,11 @@
++ status (trel presence ,@da human) :: participant
++ speech :: party action
$% [%own p=@t] :: @ or /me
[%exp p=@t q=tank] :: program output
[%exp p=@t q=(unit tank)] :: program output
[%say p=@t] :: normal line
[%inv p=ship q=span] :: invite to
== ::
++ statement (pair @da speech) :: when this
++ statement (pair ,@da speech) :: when this
++ telegram (pair ship thought) :: who which whom what
++ thought (trel serial audience statement) :: which whom what
--