/mar/talk/action to json works.

From json currently dig-overs.
This commit is contained in:
Fang 2017-10-20 17:42:07 +02:00
parent aff9d309b5
commit b6df30e006
2 changed files with 72 additions and 33 deletions

View File

@ -14,6 +14,8 @@
::> 3. lists and sets become arrays. maps become objects.
::> 4. stringify cells only when/in a way such that it benefits the majority of
::> foreseen usecases.
::>
::> q: should parsing be strict or forgiving? ie, accept "ship" and/or "~ship"?
::
|%
++ en-tape ::> sur to tape
@ -77,7 +79,7 @@
++ sa ::> set as array
|* {a/(set) b/$-(* json)}
^- json
[%a ~(tap in (~(run in a) b))]
[%a ~(tap in `(set json)`(~(run in a) b))]
::
++ dank ::> tank
|= a/tank
@ -106,6 +108,15 @@
~
==
::
++ cord ::> string from cord
|= a/@t
s+a
::
++ mabe ::> null or value
|* {a/(unit) b/$-(* json)}
^- json
?~(a ~ (b u.a))
::
::
++ circ ::> circle
|= a/circle
@ -122,6 +133,26 @@
^- json
s+(crip (sorc:en-tape a))
::
++ huma ::> human
|= a/human
^- json
(pairs han+(mabe han.a cord) tru+(mabe tru.a trun) ~)
::
++ trun ::> truename
|= a/truename
^- json
(pairs fir+s+fir.a mid+(mabe mid.a cord) las+s+las.a ~)
::
++ thot ::> thought
|= a/thought
^- json
%- pairs :~
uid+s+(scot %uv uid.a)
aud+(audi aud.a)
wen+(time wen.a)
sep+(spec sep.a)
==
::
++ spec ::> speech
|= a/speech
^- json
@ -148,6 +179,11 @@
$text s+(of-wain:format +.a)
$tank a+(turn +.a dank)
==
::
++ audi ::> audience
|= a/audience
^- json
(sa a circ)
--
::
++ de-json ::> json to sur
@ -206,6 +242,10 @@
^- $-(json (unit filter))
(ot cas+bo utf+bo ~)
::
++ secu ::> security
^- $-(json (unit security))
(su (perk %black %white %green %brown ~))
::
++ pres ::> presence
^- $-(json (unit presence))
(su (perk %gone %idle %hear %talk ~))
@ -249,16 +289,15 @@
==
::
++ spec ::> speech
::^- $-(json (unit speech))
(of lin+(ot pat+bo txt+so ~) ~)
::%- of :~
:: lin+(ot pat+bo txt+so ~)
:: url+(su aurf:de-purl:html)
:: exp+(ot exp+so res+(ar dank) ~)
:: ire+(ot top+seri sep+spec ~)
:: fat+(ot tac+atta sep+spec ~)
:: inv+(ot inv+bo cir+circ ~)
::==
^- $-(json (unit speech))
%- of :~
lin+(ot pat+bo txt+so ~)
url+(su aurf:de-purl:html)
exp+(ot exp+so res+(ar dank) ~)
ire+(ot top+seri sep+spec ~)
fat+(ot tac+atta sep+spec ~)
inv+(ot inv+bo cir+circ ~)
==
::
++ atta ::> attache
^- $-(json (unit attache))

View File

@ -10,53 +10,53 @@
|%
++ noun action:talk ::< from %noun
++ json ::> from %json
=, de-json:talk-json
::=, de-json:talk-json
=, dejs-soft:format
|= a/json
^- action:talk
=- (need ((of -) a))
:~ create+(ot nom+so des+so sec+pres ~)
:~ create+(ot nom+so des+so sec+secu:de-json:talk-json ~)
delete+(ot nom+so why+(mu so) ~)
depict+(ot nom+so des+so ~)
filter+(ot nom+so fit+filt ~)
permit+(ot nom+so inv+bo sis+audi ~)
source+(ot nom+so aub+bo srs+(as sorc) ~)
filter+(ot nom+so fit+filt:de-json:talk-json ~)
permit+(ot nom+so inv+bo sis+(as:de-json:talk-json (su fed:ag)) ~)
source+(ot nom+so aub+bo srs+(as:de-json:talk-json sorc:de-json:talk-json) ~)
::
convey+(ar thot)
phrase+(ot aud+audi ses+(ar spec) ~)
convey+(ar thot:de-json:talk-json)
phrase+(ot aud+audi:de-json:talk-json ses+(ar spec:de-json:talk-json) ~)
::
notify+(ot aud+audi pes+prec ~)
naming+(ot aud+audi man+huma ~)
notify+(ot aud+audi pes+pres ~):de-json:talk-json
naming+(ot aud+audi man+huma ~):de-json:talk-json
::
glyph+(ot gyf+so aud+audi bin+bo ~)
nick+(ot who+ship nic+so ~)
glyph+(ot gyf+so aud+audi:de-json:talk-json bin+bo ~)
nick+(ot who+(su fed:ag) nic+so ~)
==
--
::
++ grow ::> convert to
|%
++ json ::> to %json
=, en-json:talk-json
::=, en-json:talk-json
=, enjs:format
%+ frond -.act
::> only %convey has just a single piece of data.
?: ?=($convey -.act) a+(turn tos.act thot)
?: ?=($convey -.act) a+(turn tos.act thot:en-json:talk-json)
%- pairs
?- -.act
$create ~[nom+s+nom.act des+s+des.act sec+s+sec.act]
$delete ~[nom+s+nom.act why+?~(why.sec ~ s+why.sec)]
$delete ~[nom+s+nom.act why+(mabe:en-json:talk-json why.act cord:en-json:talk-json)]
$depict ~[nom+s+nom.act des+s+des.act]
$filter ~[nom+s+nom.act fit+(filt fit.act)]
$permit ~[nom+s+nom.act inv+b+inv.act sis+(sa sis.act ship)]
$source ~[nom+s+nom.act sub+b+sub.act srs+(sa srs.act sorc)]
$filter ~[nom+s+nom.act fit+(filt:en-json:talk-json fit.act)]
$permit ~[nom+s+nom.act inv+b+inv.act sis+(sa:en-json:talk-json sis.act ship)]
$source ~[nom+s+nom.act sub+b+sub.act srs+(sa:en-json:talk-json srs.act sorc:en-json:talk-json)]
::
$phrase ~[aud+(sa aud.act circ) ses+a+(turn ses.act spec)]
$phrase ~[aud+(audi:en-json:talk-json aud.act) ses+a+(turn ses.act spec:en-json:talk-json)]
::
$notify ~[aud+(sa cis.act circ) pes+(prec pes.act)]
$naming ~[aud+(sa cis.act circ) man+(huma man.act)]
$notify ~[aud+(audi:en-json:talk-json aud.act) pes+s+pes.act]
$naming ~[aud+(audi:en-json:talk-json aud.act) man+(huma:en-json:talk-json man.act)]
::
$glyph ~[gyf+s+gyf.act aud+(sa circ) bin+b+bin.act]
$nick ~[who+s+(ship who.act) nic+s+nic.act]
$glyph ~[gyf+s+gyf.act aud+(sa:en-json:talk-json aud.act circ:en-json:talk-json) bin+b+bin.act]
$nick ~[who+(ship who.act) nic+s+nic.act]
==
--
--