urbit/mar/talk/telegrams.hoon

194 lines
5.0 KiB
Plaintext
Raw Normal View History

2015-09-03 00:53:11 +03:00
::
2016-02-05 06:05:37 +03:00
:::: /hoon/telegrams/talk/mar
2015-09-03 00:53:11 +03:00
::
2016-02-18 02:00:12 +03:00
/? 310
/- talk
2016-02-18 02:50:03 +03:00
/+ talk,map-to-json
2016-11-17 04:42:58 +03:00
::
=, talk
2016-11-17 04:30:39 +03:00
=, bytes:eyre
=, format
|_ gam/(list telegram)
2015-09-03 00:53:11 +03:00
::
++ grab
|%
2015-09-03 00:53:11 +03:00
++ noun (list telegram)
++ mime |=(^mime (json (rash q.q apex:poja)))
++ json
=> [jo ..telegram]
|= a/json ^- (list telegram)
=- (need ((ar (ot ship+(su fed:ag) thought+thot ~)) a))
2015-09-03 00:53:11 +03:00
|%
2015-09-15 04:03:40 +03:00
++ of
|* a/(pole {@tas fist})
|= b/json
2015-09-15 04:03:40 +03:00
%. ((of:jo a) b)
%- slog
?+ b ~
{$o *}
%+ murn `(list {@tas fist})`a
|= {c/term d/fist} ^- (unit tank)
2015-09-15 04:03:40 +03:00
=+ (~(get by p.b) c)
?~ - ~
=+ (d u)
?~ - (some >[c u]<)
~
2015-09-15 04:03:40 +03:00
==
2015-09-03 00:53:11 +03:00
++ op :: parse keys of map
|* {fel/rule wit/fist}
%+ cu malt
%+ ci
|= a/(map cord _(need *wit))
^- (unit (list _[(wonk *fel) (need *wit)]))
(zl (turn (~(tap by a)) (head-rush fel)))
(om wit)
2015-09-03 00:53:11 +03:00
::
++ as :: array as set
|* a/fist
(cu ~(gas in *(set _(need *a))) (ar a))
2015-09-03 00:53:11 +03:00
::
2015-09-15 04:03:40 +03:00
++ ke :: callbacks
|* {gar/* sef/_|.(fist)}
|= jon/json
^- (unit _gar)
2015-09-15 04:03:40 +03:00
=- ~! gar ~! (need -) -
((sef) jon)
2015-09-03 00:53:11 +03:00
::
++ lake |*(a/_* $-(json (unit a)))
++ head-rush
|* a/rule
|* {cord *}
=+ nit=(rush +<- a)
2015-09-03 00:53:11 +03:00
?~ nit ~
(some [u.nit +>->])
2015-09-03 00:53:11 +03:00
::
++ thot
^- $-(json (unit thought))
2015-09-03 00:53:11 +03:00
%- ot :~
serial+`$-(json (unit serial))`(ci (slat %uv) so)
audience+`$-(json (unit audience))`audi
statement+`$-(json (unit statement))`stam
2015-09-03 00:53:11 +03:00
==
::
++ audi `$-(json (unit audience))`(op parn memb)
++ auri (op parn (ci (soft presence) so))
++ memb ^- $-(json (unit (pair envelope delivery)))
(ot envelope+lope delivery+(ci (soft delivery) so) ~)
++ lope (ot visible+bo sender+(mu (su parn)) ~)
2015-09-03 00:53:11 +03:00
::
++ parn
^- $-(nail (like partner))
2015-09-15 04:03:40 +03:00
%+ pick
2015-09-03 00:53:11 +03:00
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
%+ sear (soft passport)
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
::
++ stam (ot date+di bouquet+(as (ar so)) speech+spec ~)
2015-09-15 04:03:40 +03:00
++ spec
%+ ke *speech |. ~+
%- of :~
lin+(ot say+bo txt+so ~)
url+(ot txt+(su aurf:urlp) ~)
exp+(ot txt+so ~)
app+(ot txt+so src+so ~)
fat+(ot tor+tors taf+spec ~)
ext+(ot nom+so txe+blob ~)
non+ul
:: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~)
2015-09-15 04:03:40 +03:00
==
++ tors
%+ ke *torso |. ~+
%- of :~
name+(ot nom+so mon+tors ~)
text+(cu to-wain so)
tank+(ot dat+(cu (hard (list tank)) blob) ~)
2015-09-03 00:53:11 +03:00
==
2015-09-15 04:03:40 +03:00
::
++ blob (cu cue (su fel:ofis))
2015-09-03 00:53:11 +03:00
--
--
::
++ grow
|%
++ mime [/text/json (taco (crip (pojo json)))]
++ json
=> +
|^
:- %a
%+ turn gam
|= telegram
(jobe ship+(jope p) thought+(thot q) ~)
2015-09-03 00:53:11 +03:00
::
++ jove
|= {a/envelope b/delivery}
2015-09-03 00:53:11 +03:00
%- jobe :~
envelope+(jobe visible+[%b p.a] sender+?~(q.a ~ s+(parn u.q.a)) ~)
delivery+[%s b]
2015-09-03 00:53:11 +03:00
==
::
++ jope |=(a/ship (jape +:<a>)) ::[%s (crip +:(scow %p a))])
++ joke |=(a/tank (jape (of-wall (wash 0^80 a)))])
++ jode |=(a/time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1)))
2015-09-03 00:53:11 +03:00
::
++ thot
|= thought
(jobe serial+(jape <p>) audience+(audi q) statement+(stam r) ~)
2015-09-03 00:53:11 +03:00
::
2016-02-18 02:50:03 +03:00
++ audi (map-to-json parn jove)
2015-09-03 00:53:11 +03:00
++ bouq
|= a/bouquet
a+(turn (~(tap in a)) |=(b/path a+(turn b |=(c/knot s+c))))
2015-09-03 00:53:11 +03:00
::
++ parn
|= a/partner ^- cord
2015-09-03 00:53:11 +03:00
?- -.a
$& (stat p.a)
$| %- crip
2015-09-03 00:53:11 +03:00
?- -.p.a
$twitter "{(trip -.p.a)}/{(trip p.p.a)}"
2015-09-03 00:53:11 +03:00
==
==
::
++ stat
|= a/station ^- cord
2015-09-03 00:53:11 +03:00
(crip "{<p.a>}/{(trip q.a)}")
::
++ stam
|= statement
(jobe date+(jode p) bouquet+(bouq q) speech+(spec r) ~)
2015-09-03 00:53:11 +03:00
::
++ spec
|= a/speech
2015-09-03 00:53:11 +03:00
%+ joba -.a
?+ -.a ~|(stub+-.a !!)
$lin (jobe txt+[%s q.a] say+[%b p.a] ~)
$url (joba txt+(jape (earf p.a)))
$exp (joba txt+[%s p.a])
$app (jobe txt+[%s q.a] src+[%s p.a] ~)
$fat (jobe tor+(tors p.a) taf+$(a q.a) ~)
$ext (jobe nom+[%s p.a] txe+(jape (sifo (jam +.a))) ~)
$non ~
:: $inv (jobe ship+(jope p.a) party+[%s q.a] ~)
2015-09-03 00:53:11 +03:00
==
::
++ tors
|= a/torso
2015-09-03 00:53:11 +03:00
%+ joba -.a
?- -.a
$text [%s (of-wain +.a)]
$tank (jobe txt+[%a (turn +.a joke)] dat+(jape (sifo (jam +.a))) ~)
$name (jobe nom+s+p.a mon+$(a q.a) ~)
2015-09-03 00:53:11 +03:00
==
::
--
--
::
2015-09-03 02:20:11 +03:00
++ grad
|%
++ form %talk-telegrams
++ diff |=((list telegram) +<)
++ pact |=((list telegram) +<)
++ join |=({(list telegram) (list telegram)} `(unit mime)`~)
2015-09-03 02:20:11 +03:00
--
2015-09-03 00:53:11 +03:00
--