urbit/app/talk.hoon

2355 lines
77 KiB
Plaintext
Raw Normal View History

2015-12-12 07:05:38 +03:00
:: :: ::
2015-06-08 22:48:35 +03:00
:::: /hoon/talk/app :: ::
:: :: ::
2016-02-18 01:57:46 +03:00
/? 310
/- talk, sole
2016-03-09 07:32:45 +03:00
/+ talk, sole, time-to-id, twitter
2015-11-17 06:29:27 +03:00
/= seed /~ !>(.)
2015-10-27 00:18:01 +03:00
::
2015-05-07 05:31:54 +03:00
::::
::
2015-09-02 01:20:17 +03:00
[. talk sole]
2015-05-07 05:31:54 +03:00
=> |% :: data structures
++ house {$5 house-5} :: full state
2015-05-07 05:31:54 +03:00
++ house-any :: app history
2015-12-14 10:58:14 +03:00
$% {$3 house-3} :: 3: talk
{$4 house-4} :: 4: talk
{$5 house-5} :: 5: talk
2015-09-02 03:46:05 +03:00
== ::
2015-09-19 02:20:30 +03:00
++ house-3 ::
%+ cork house-4 |= house-4 :: modern house with
+<(stories (~(run by stories) story-3)) :: old stories
++ house-4 ::
%+ cork house-5 |= house-5 :: modern house with
+<(shells (~(run by shells) shell-4)) :: no settings
++ house-5 ::
$: stories/(map knot story) :: conversations
2015-12-20 23:50:45 +03:00
general/(set bone) :: meta-subscribe
outbox/(pair @ud (map @ud thought)) :: urbit outbox
folks/(map ship human) :: human identities
shells/(map bone shell) :: interaction state
log/(map knot @ud) :: logged to clay
2015-12-20 23:50:45 +03:00
nik/(map (set partner) char) :: bound station glyphs
nak/(jug char (set partner)) :: station glyph lookup
2015-09-19 02:20:30 +03:00
== ::
++ story-3 (cork story |=(story +<(|10 &11.+<))) :: missing glyphers
2015-05-07 05:31:54 +03:00
++ story :: wire content
2015-12-20 23:50:45 +03:00
$: count/@ud :: (lent grams)
grams/(list telegram) :: all history
locals/(map ship (pair @da status)) :: local presence
remotes/(map partner atlas) :: remote presence
mirrors/(map station config) :: remote config
sequence/(map partner @ud) :: partners heard
shape/config :: configuration
known/(map serial @ud) :: messages heard
gramsers/(map bone river) :: message followers
groupers/(set bone) :: presence followers
cabalers/(set bone) :: config followers
glyphers/(set bone) :: glyph followers
2015-05-07 05:31:54 +03:00
== ::
++ shell :: console session
2015-12-20 23:50:45 +03:00
$: her/ship :: client identity
man/knot :: mailbox
2015-12-20 23:50:45 +03:00
count/@ud :: messages shown
say/sole-share :: console state
active/(unit (set partner)) :: active targets
passive/(set partner) :: passive targets
owners/register :: presence mirror
harbor/(map knot (pair posture cord)) :: stations mirror
2015-12-20 23:50:45 +03:00
system/cabal :: config mirror
settings/(set knot) :: frontend settings
2015-05-07 05:31:54 +03:00
== ::
++ shell-4 (cork shell |=(shell +<(|8 &9.+<))) :: missing settings
2015-05-07 05:31:54 +03:00
++ river (pair point point) :: stream definition
++ point :: stream endpoint
2015-12-20 23:50:45 +03:00
$% {$ud p/@ud} :: by number
{$da p/@da} :: by date
2015-05-07 05:31:54 +03:00
== ::
++ move (pair bone card) :: all actions
++ lime :: diff fruit
2015-12-14 10:58:14 +03:00
$% {$talk-report report} ::
{$sole-effect sole-effect} ::
2015-05-07 05:31:54 +03:00
== ::
++ pear :: poke fruit
2015-12-14 10:58:14 +03:00
$% {$talk-command command} ::
{$write-comment spur ship cord} ::
{$write-fora-post spur ship cord cord} ::
2015-05-07 05:31:54 +03:00
== ::
++ card :: general card
2015-12-14 10:58:14 +03:00
$% {$diff lime} ::
{$info wire @p @tas nori} ::
{$peer wire dock path} ::
{$poke wire dock pear} ::
2015-12-12 00:02:51 +03:00
{$pull wire dock $~} ::
{$quit $~} ::
2015-05-07 05:31:54 +03:00
== ::
++ weir :: parsed wire
$% {$repeat p/@ud q/@p r/knot} ::
{$friend p/knot q/station} ::
2015-05-07 05:31:54 +03:00
== ::
++ work :: interface action
2015-12-20 23:50:45 +03:00
$% {$number p/$@(@ud {@u @ud})} :: relative/absolute
2015-12-12 00:02:51 +03:00
{$help $~} :: print usage info
2015-12-20 23:50:45 +03:00
{$who p/where} :: presence
{$what p/$@(char (set partner))} :: show bound glyph
{$bind p/char q/(unit where)} ::
{$join p/where} ::
{$leave p/where} ::
{$say p/(list speech)} ::
{$eval p/cord q/twig} ::
{$invite p/knot q/(list partner)} :: whitelist add
{$banish p/knot q/(list partner)} :: blacklist add
{$block p/knot q/(list partner)} :: blacklist add
{$author p/knot q/(list partner)} :: whitelist add
2015-12-20 23:50:45 +03:00
{$nick p/(unit ship) q/(unit cord)} ::
{$set p/knot} ::
{$unset p/knot} ::
2015-12-20 23:50:45 +03:00
{$target p/where q/(unit work)} :: set active targets
:: {$destroy p/knot} ::
{$create p/posture q/knot r/cord} ::
2015-12-20 23:50:45 +03:00
{$probe p/station} ::
2015-05-07 05:31:54 +03:00
== ::
++ where (set partner) :: non-empty audience
2015-05-07 05:31:54 +03:00
++ sigh :: assemble label
2015-12-20 23:50:45 +03:00
|= {len/@ud pre/tape yiz/cord}
2015-05-07 05:31:54 +03:00
^- tape
=+ nez=(trip yiz)
=+ lez=(lent nez)
?> (gth len (lent pre))
=. len (sub len (lent pre))
?. (gth lez len)
=. nez (welp pre nez)
?. (lth lez len) nez
(runt [(sub len lez) '-'] nez)
:(welp pre (scag (dec len) nez) "+")
2015-09-30 02:47:30 +03:00
++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool
++ peer-type :: stream requests
=< apex
|%
++ apex ?($a-group $f-grams $v-glyph $x-cabal) :: options
++ encode |=(a/apex ^-(char (end 3 1 a))) :: by first char
++ decode :: discriminate
|= a/char ^- apex
?+ a ~|(bad-subscription-designator+a !!)
$a %a-group
$f %f-grams
$v %v-glyph
$x %x-cabal
==
--
2015-05-07 05:31:54 +03:00
--
2015-12-20 23:50:45 +03:00
|_ {hid/bowl house}
2015-05-07 05:31:54 +03:00
++ ra :: per transaction
2015-12-20 23:50:45 +03:00
|_ moves/(list move)
2015-05-07 05:31:54 +03:00
++ sh :: per console
2015-12-20 23:50:45 +03:00
|_ $: coz/(list command) :: talk actions
she/shell
==
2015-05-07 05:31:54 +03:00
++ sh-scad :: command parser
=< work
|%
++ expr :: [cord twig]
2015-12-20 23:50:45 +03:00
|= tub/nail %. tub
%+ stag (crip q.tub)
wide:(vang & [&1:% &2:% (scot %da now.hid) |3:%])
::
2015-05-07 05:31:54 +03:00
++ dare :: @dr
%+ sear
2015-12-20 23:50:45 +03:00
|= a/coin
?. ?=({$$ $dr @} a) ~
2015-05-07 05:31:54 +03:00
(some `@dr`+>.a)
nuck:so
::
++ ship ;~(pfix sig fed:ag) :: ship
++ shiz :: ship set
%+ cook
2015-12-20 23:50:45 +03:00
|=(a/(list ^ship) (~(gas in *(set ^ship)) a))
2015-05-07 05:31:54 +03:00
(most ;~(plug com (star ace)) ship)
::
++ pasp :: passport
;~ pfix pat
;~ pose
2015-06-19 04:47:41 +03:00
(stag %twitter ;~(pfix (jest 't') col urs:ab))
2015-05-07 05:31:54 +03:00
==
==
::
++ stan :: station
;~ pose
2015-11-03 23:16:10 +03:00
(cold [our.hid man.she] col)
2015-09-19 02:20:30 +03:00
;~(pfix cen (stag our.hid sym))
;~(pfix fas (stag (sein our.hid) sym))
2015-05-07 05:31:54 +03:00
::
%+ cook
2015-12-20 23:50:45 +03:00
|= {a/@p b/(unit term)}
2015-05-07 05:31:54 +03:00
[a ?^(b u.b (main a))]
;~ plug
ship
2015-10-02 03:21:26 +03:00
(punt ;~(pfix fas urs:ab))
2015-05-07 05:31:54 +03:00
==
==
::
++ parn :: partner
;~ pose
(stag %& stan)
(stag %| pasp)
==
++ partners-flat :: collapse mixed list
2015-12-20 23:50:45 +03:00
|= a/(list (each partner (set partner)))
^- (set partner)
?~ a ~
?- -.i.a
$& (~(put in $(a t.a)) p.i.a)
$| (~(uni in $(a t.a)) p.i.a)
==
::
++ para :: partners alias
%+ cook partners-flat
%+ most ;~(plug com (star ace))
(pick parn (sear sh-glyf glyph))
::
2015-10-02 22:22:03 +03:00
++ parz :: non-empty partners
%+ cook ~(gas in *(set partner))
2015-05-07 05:31:54 +03:00
(most ;~(plug com (star ace)) parn)
::
++ nump :: number reference
;~ pose
2015-10-06 03:15:48 +03:00
;~(pfix hep dem:ag)
;~ plug
(cook lent (plus (just '0')))
;~(pose dem:ag (easy 0))
==
2015-10-06 03:15:48 +03:00
(stag 0 dem:ag)
2015-05-07 05:31:54 +03:00
==
::
++ pore :: posture
;~ pose
(cold %black (jest %channel))
(cold %white (jest %village))
(cold %green (jest %journal))
(cold %brown (jest %mailbox))
==
::
++ message
;~ pose
;~(plug (cold %eval hax) expr)
2015-10-03 03:07:27 +03:00
::
%+ stag %say
%+ most (jest '•')
;~ pose
(stag %url aurf:urlp)
:(stag %lin | ;~(pfix pat text))
2015-10-06 00:00:02 +03:00
:(stag %lin & ;~(less sem hax text))
2015-10-03 03:07:27 +03:00
==
==
::
2015-10-08 21:01:40 +03:00
++ nick (cook crip (stun [1 14] low)) :: nickname
2015-11-06 03:02:54 +03:00
++ text (cook crip (plus (shim ' ' '~'))) :: bullets separating
2015-09-19 02:20:30 +03:00
++ glyph (mask "/\\\{(<!?{(zing glyphs)}") :: station postfix
2015-11-06 05:53:59 +03:00
++ setting
%- perk :~
%noob
==
2015-05-07 05:31:54 +03:00
++ work
%+ knee *^work |. ~+
=- ;~(pose ;~(pfix sem -) message)
2015-05-07 05:31:54 +03:00
;~ pose
2015-06-16 22:34:40 +03:00
;~ (glue ace) (perk %create ~)
pore
;~(pfix cen sym)
qut
2015-05-07 05:31:54 +03:00
==
::
;~(plug (perk %who ~) ;~(pose para (easy ~)))
;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace para)))
;~((glue ace) (perk %join ~) para)
;~((glue ace) (perk %leave ~) para)
2015-10-02 22:22:03 +03:00
;~((glue ace) (perk %what ~) ;~(pose parz glyph))
2015-10-08 20:26:42 +03:00
::
2015-10-08 21:01:40 +03:00
;~ plug (perk %nick ~)
;~ pose
;~ plug
(cook some ;~(pfix ace ship))
(cold (some '') ;~(pfix ace sig))
==
;~ plug
;~ pose
(cook some ;~(pfix ace ship))
(easy ~)
==
;~ pose
(cook some ;~(pfix ace nick))
(easy ~)
==
==
2015-10-08 21:01:40 +03:00
==
==
2015-11-06 05:53:59 +03:00
::
;~(plug (perk %set ~) ;~(pose ;~(pfix ace setting) (easy %$)))
;~(plug (perk %unset ~) ;~(pfix ace setting))
2015-09-19 02:20:30 +03:00
::
2015-06-16 22:34:40 +03:00
;~(plug (perk %help ~) (easy ~))
2015-05-07 05:31:54 +03:00
(stag %number nump)
(stag %target ;~(plug para (punt ;~(pfix ace message))))
2015-10-06 03:15:48 +03:00
(stag %number (cook lent (star sem)))
2015-05-07 05:31:54 +03:00
==
--
++ sh-abet
^+ +>
=+ zoc=(flop coz)
|- ^+ +>+>
2015-10-02 03:21:26 +03:00
?~ zoc +>+>.$(shells (~(put by shells) ost.hid she))
2015-05-07 05:31:54 +03:00
$(zoc t.zoc, +>.$ (sh-deal i.zoc))
::
++ sh-deal :: apply from shell
2015-12-20 23:50:45 +03:00
|= cod/command
2015-05-07 05:31:54 +03:00
^+ +>
?- -.cod
$design
2015-05-07 05:31:54 +03:00
?~ q.cod
=. +>+>.$ (ra-config p.cod *config)
+>.$(stories (~(del by stories) p.cod))
+>(+> (ra-config p.cod u.q.cod))
::
$review +>(+> (ra-think | her.she +.cod))
$publish +>(+> (ra-think & her.she +.cod))
2015-05-07 05:31:54 +03:00
==
::
++ sh-fact :: send console effect
2015-12-20 23:50:45 +03:00
|= fec/sole-effect
2015-05-07 05:31:54 +03:00
^+ +>
2015-10-02 03:21:26 +03:00
+>(moves :_(moves [ost.hid %diff %sole-effect fec]))
2015-05-07 05:31:54 +03:00
::
++ sh-peep :: peer to path
2015-12-20 23:50:45 +03:00
|= pax/path
2015-05-07 05:31:54 +03:00
^+ +>
2015-10-02 03:21:26 +03:00
+>(+> (ra-subscribe her.she pax))
2015-05-07 05:31:54 +03:00
::
++ sh-peer :: subscribe shell
=< sh-prod
%_ .
+>
=/ typ
=+ (ly ~[%a-group %f-grams %x-cabal])
(rap 3 (turn - encode:peer-type))
(ra-subscribe:(ra-subscribe her.she ~) her.she [typ man.she ~])
2015-05-07 05:31:54 +03:00
==
::
++ sh-prod :: show prompt
^+ .
%+ sh-fact %pro
:+ & %talk-line
^- tape
=+ ^= rew ^- (pair (pair @t @t) (set partner))
2015-05-07 05:31:54 +03:00
?~ active.she
2015-05-19 21:38:23 +03:00
[['(' ')'] passive.she]
[['[' ']'] u.active.she]
2015-10-07 00:18:54 +03:00
=+ cha=(~(get by nik) q.rew)
?^ cha ~[u.cha ' ']
2015-10-28 03:56:27 +03:00
:: ~& [rew nik nak]
2015-05-07 05:31:54 +03:00
=+ por=~(te-prom te man.she q.rew)
(weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~])
::
++ sh-pact :: update active aud
2015-12-20 23:50:45 +03:00
|= lix/(set partner)
2015-05-07 05:31:54 +03:00
^+ +>
=+ act=?~(lix ~ `(sh-pare lix))
?: =(active.she act) +>.$
sh-prod(active.she act)
::
++ sh-pare :: adjust target list
2015-12-20 23:50:45 +03:00
|= paz/(set partner)
2015-05-07 05:31:54 +03:00
?: (sh-pear paz) paz
(~(put in paz) [%& our.hid man.she])
::
++ sh-pear :: hearback
2015-12-20 23:50:45 +03:00
|= paz/(set partner)
2015-05-07 05:31:54 +03:00
?~ paz |
?| $(paz l.paz)
$(paz r.paz)
(~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz)
==
::
++ sh-pass :: passive from aud
2015-12-20 23:50:45 +03:00
|= aud/audience
2015-05-07 05:31:54 +03:00
%- sh-poss
%- ~(gas in *(set partner))
2015-12-20 23:50:45 +03:00
(turn (~(tap by aud)) |=({a/partner *} a))
2015-05-07 05:31:54 +03:00
::
++ sh-poss :: passive update
2015-12-20 23:50:45 +03:00
|= lix/(set partner)
2015-10-02 22:22:03 +03:00
?^ buf.say.she
+>.$
2015-05-07 05:31:54 +03:00
=+ sap=(sh-pare lix)
?: =(sap passive.she)
+>.$
sh-prod(passive.she sap)
::
++ sh-pest :: report listen
2015-12-20 23:50:45 +03:00
|= tay/partner
2015-05-07 05:31:54 +03:00
^+ +>
?. ?=($& -.tay) +>
2015-05-07 05:31:54 +03:00
=+ sib=(~(get by ham.system.she) `station`p.tay)
?. |(?=($~ sib) !?=($white p.cordon.u.sib))
2015-05-07 05:31:54 +03:00
+>.$
(sh-poss [tay ~ ~])
::
++ sh-rend :: print on one line
2015-12-20 23:50:45 +03:00
|= gam/telegram
=+ lin=~(tr-line tr man.she (~(has in settings.she) %noob) gam)
(sh-pass:(sh-fact %txt lin) q.q.gam)
2015-05-07 05:31:54 +03:00
::
++ sh-numb :: print msg number
2015-12-20 23:50:45 +03:00
|= num/@ud
2015-05-07 05:31:54 +03:00
^+ +>
=+ bun=(scow %ud num)
%+ sh-fact %txt
(runt [(sub 13 (lent bun)) '-'] "[{bun}]")
2015-05-07 05:31:54 +03:00
::
++ sh-glyf :: decode glyph
2015-12-20 23:50:45 +03:00
|= cha/char ^- (unit (set partner))
=+ lax=(~(get ju nak) cha)
?: =(~ lax) ~
?: ?=({* $~ $~} lax) `n.lax
=+ grams=grams:(~(got by stories) man.she)
|- ^- (unit (set partner))
?~ grams ~
=+ pan=(silt (turn (~(tap by q.q.i.grams)) head))
?: (~(has in lax) pan) `pan
$(grams t.grams)
::
2015-05-07 05:31:54 +03:00
++ sh-repo-house-diff
2015-12-20 23:50:45 +03:00
|= {one/shelf two/shelf}
2015-05-07 05:31:54 +03:00
=| $= ret
$: old/(list (pair knot (pair posture cord)))
new/(list (pair knot (pair posture cord)))
cha/(list (pair knot (pair posture cord)))
2015-05-07 05:31:54 +03:00
==
^+ ret
=. ret
=+ eno=(~(tap by one))
|- ^+ ret
?~ eno ret
=. ret $(eno t.eno)
=+ unt=(~(get by two) p.i.eno)
?~ unt
ret(old [i.eno old.ret])
?: =(q.i.eno u.unt) ret
ret(cha [[p.i.eno u.unt] cha.ret])
=. ret
=+ owt=(~(tap by two))
|- ^+ ret
?~ owt ret
=. ret $(owt t.owt)
?: (~(has by one) p.i.owt)
ret
ret(new [i.owt new.ret])
ret
::
++ sh-repo-atlas-diff
2015-12-20 23:50:45 +03:00
|= {one/atlas two/atlas}
2015-05-07 05:31:54 +03:00
=| $= ret
2015-12-20 23:50:45 +03:00
$: old/(list (pair ship status))
new/(list (pair ship status))
cha/(list (pair ship status))
2015-05-07 05:31:54 +03:00
==
^+ ret
=. ret
=+ eno=(~(tap by one))
|- ^+ ret
?~ eno ret
=. ret $(eno t.eno)
=+ unt=(~(get by two) p.i.eno)
?~ unt
ret(old [i.eno old.ret])
?: =(q.i.eno u.unt) ret
ret(cha [[p.i.eno u.unt] cha.ret])
=. ret
=+ owt=(~(tap by two))
|- ^+ ret
?~ owt ret
=. ret $(owt t.owt)
?: (~(has by one) p.i.owt)
ret
ret(new [i.owt new.ret])
ret
::
++ sh-repo-cabal-diff
2015-12-20 23:50:45 +03:00
|= {one/(map station config) two/(map station config)}
2015-05-07 05:31:54 +03:00
=| $= ret
2015-12-20 23:50:45 +03:00
$: old/(list (pair station config))
new/(list (pair station config))
cha/(list (pair station config))
2015-05-07 05:31:54 +03:00
==
^+ ret
2015-12-29 01:01:44 +03:00
=. ret
2015-05-07 05:31:54 +03:00
=+ eno=(~(tap by one))
|- ^+ ret
?~ eno ret
=. ret $(eno t.eno)
=+ unt=(~(get by two) p.i.eno)
?~ unt
ret(old [i.eno old.ret])
?: =(q.i.eno u.unt) ret
ret(cha [[p.i.eno u.unt] cha.ret])
=. ret
=+ owt=(~(tap by two))
|- ^+ ret
?~ owt ret
=. ret $(owt t.owt)
?: (~(has by one) p.i.owt)
ret
ret(new [i.owt new.ret])
ret
::
++ sh-repo-rogue-diff
2015-12-20 23:50:45 +03:00
|= {one/(map partner atlas) two/(map partner atlas)}
2015-05-07 05:31:54 +03:00
=| $= ret
2015-12-20 23:50:45 +03:00
$: old/(list (pair partner atlas))
new/(list (pair partner atlas))
cha/(list (pair partner atlas))
2015-05-07 05:31:54 +03:00
==
^+ ret
=. ret
=+ eno=(~(tap by one))
|- ^+ ret
?~ eno ret
=. ret $(eno t.eno)
=+ unt=(~(get by two) p.i.eno)
?~ unt
ret(old [i.eno old.ret])
?: =(q.i.eno u.unt) ret
ret(cha [[p.i.eno u.unt] cha.ret])
=. ret
=+ owt=(~(tap by two))
|- ^+ ret
?~ owt ret
=. ret $(owt t.owt)
?: (~(has by one) p.i.owt)
ret
ret(new [i.owt new.ret])
ret
::
++ sh-repo-whom-diff
2015-12-20 23:50:45 +03:00
|= {one/(set partner) two/(set partner)}
2015-05-07 05:31:54 +03:00
=| $= ret
2015-12-20 23:50:45 +03:00
$: old/(list partner)
new/(list partner)
2015-05-07 05:31:54 +03:00
==
^+ ret
=. ret
=+ eno=(~(tap by one))
|- ^+ ret
?~ eno ret
=. ret $(eno t.eno)
?: (~(has in two) i.eno)
ret
ret(old [i.eno old.ret])
=. ret
=+ owt=(~(tap by two))
|- ^+ ret
?~ owt ret
=. ret $(owt t.owt)
?: (~(has in one) i.owt)
ret
ret(new [i.owt new.ret])
ret
::
++ sh-repo-ship-diff
2015-12-20 23:50:45 +03:00
|= {one/(set ship) two/(set ship)}
2015-05-07 05:31:54 +03:00
=| $= ret
2015-12-20 23:50:45 +03:00
$: old/(list ship)
new/(list ship)
2015-05-07 05:31:54 +03:00
==
^+ ret
=. ret
=+ eno=(~(tap by one))
|- ^+ ret
?~ eno ret
=. ret $(eno t.eno)
?: (~(has in two) i.eno)
ret
ret(old [i.eno old.ret])
=. ret
=+ owt=(~(tap by two))
|- ^+ ret
?~ owt ret
=. ret $(owt t.owt)
?: (~(has in one) i.owt)
ret
ret(new [i.owt new.ret])
ret
::
++ sh-puss
2015-12-20 23:50:45 +03:00
|= a/posture ^- tape
2015-05-07 05:31:54 +03:00
?- a
$black "channel"
$brown "mailbox"
$white "village"
$green "journal"
2015-05-07 05:31:54 +03:00
==
::
++ sh-repo-config-exceptions
2015-12-20 23:50:45 +03:00
|= {pre/tape por/posture old/(list ship) new/(list ship)}
=+ out=?:(?=(?($black $brown) por) "try " "cut ")
=+ inn=?:(?=(?($black $brown) por) "ban " "add ")
2015-05-07 05:31:54 +03:00
=. +>.$
|- ^+ +>.^$
?~ old +>.^$
=. +>.^$ $(old t.old)
(sh-note :(weld pre out " " (scow %p i.old)))
=. +>.$
|- ^+ +>.^$
?~ new +>.^$
=. +>.^$ $(new t.new)
(sh-note :(weld pre out " " (scow %p i.new)))
+>.$
::
++ sh-repo-config-sources
2015-12-20 23:50:45 +03:00
|= {pre/tape old/(list partner) new/(list partner)}
2015-05-07 05:31:54 +03:00
^+ +>
=. +>.$
|- ^+ +>.^$
?~ old +>.^$
=. +>.^$ $(old t.old)
(sh-note (weld pre "off {~(ta-full ta man.she i.old)}"))
=. +>.$
|- ^+ +>.^$
?~ new +>.^$
=. +>.^$ $(new t.new)
(sh-note (weld pre "hey {~(ta-full ta man.she i.new)}"))
+>.$
::
++ sh-repo-config-show
2015-12-20 23:50:45 +03:00
|= {pre/tape laz/config loc/config}
2015-05-07 05:31:54 +03:00
^+ +>
=. +>.$
?: =(caption.loc caption.laz) +>.$
(sh-note :(weld pre "cap " (trip caption.loc)))
=. +>.$
%+ sh-repo-config-sources
(weld (trip man.she) ": ")
(sh-repo-whom-diff sources.laz sources.loc)
?: !=(p.cordon.loc p.cordon.laz)
=. +>.$ (sh-note :(weld pre "but " (sh-puss p.cordon.loc)))
%^ sh-repo-config-exceptions
(weld (trip man.she) ": ")
p.cordon.loc
[~ (~(tap in q.cordon.loc))]
%^ sh-repo-config-exceptions
(weld (trip man.she) ": ")
p.cordon.loc
(sh-repo-ship-diff q.cordon.laz q.cordon.loc)
::
++ sh-repo-cabal-changes
2015-12-20 23:50:45 +03:00
|= $: laz/(map station config)
old/(list (pair station config))
new/(list (pair station config))
cha/(list (pair station config))
2015-05-07 05:31:54 +03:00
==
=. +>.$
|- ^+ +>.^$
?~ new +>.^$
=. +>.^$ $(new t.new)
=. +>.^$ (sh-pest [%& p.i.new])
%+ sh-repo-config-show
(weld ~(sn-phat sn man.she p.i.new) ": ")
[*config q.i.new]
=. +>.$
|- ^+ +>.^$
?~ cha +>.^$
=. +>.^$ $(cha t.cha)
%+ sh-repo-config-show
(weld ~(sn-phat sn man.she p.i.cha) ": ")
[(~(got by laz) `station`p.i.cha) q.i.cha]
+>.$
::
++ sh-repo-cabal
2015-12-20 23:50:45 +03:00
|= bal/cabal
2015-05-07 05:31:54 +03:00
^+ +>
=+ laz=system.she
=. system.she bal
=. +>.$
%+ sh-repo-cabal-changes ham.laz
(sh-repo-cabal-diff ham.laz ham.bal)
(sh-repo-config-show "" loc.laz loc.bal)
::
++ sh-repo-house
|= awl/(map knot (pair posture cord))
2015-05-07 05:31:54 +03:00
^+ +>
=+ dif=(sh-repo-house-diff harbor.she awl)
=. harbor.she awl
=. +>.$
|- ^+ +>.^$
?~ old.dif +>.^$
=. +>.^$ $(old.dif t.old.dif)
(sh-note "cut {(sh-puss p.q.i.old.dif)} %{(trip p.i.old.dif)}")
=. +>.$
|- ^+ +>.^$
?~ new.dif +>.^$
=. +>.^$ $(new.dif t.new.dif)
=+ :* nam=(trip p.i.new.dif)
por=(sh-puss p.q.i.new.dif)
des=(trip q.q.i.new.dif)
==
(sh-note "new {por} %{nam}: {des}")
=. +>.$
|- ^+ +>.^$
?~ cha.dif +>.^$
=. +>.^$ $(cha.dif t.cha.dif)
=+ :* nam=(trip p.i.cha.dif)
por=(sh-puss p.q.i.cha.dif)
des=(trip q.q.i.cha.dif)
==
(sh-note "mod %{nam}: {por}, {des}")
+>.$
::
++ sh-note :: shell message
2015-12-20 23:50:45 +03:00
|= txt/tape
2015-05-07 05:31:54 +03:00
^+ +>
2015-10-03 03:07:27 +03:00
(sh-fact %txt (runt [14 '-'] `tape`['|' ' ' (scag 64 txt)]))
2015-05-07 05:31:54 +03:00
::
++ sh-spaz :: print status
2015-12-20 23:50:45 +03:00
|= saz/status
2015-05-07 05:31:54 +03:00
^- tape
['%' (trip p.saz)]
::
++ sh-repo-group-diff-here :: print atlas diff
2015-12-20 23:50:45 +03:00
|= $: pre/tape
2015-05-07 05:31:54 +03:00
$= cul
2015-12-20 23:50:45 +03:00
$: old/(list (pair ship status))
new/(list (pair ship status))
cha/(list (pair ship status))
2015-05-07 05:31:54 +03:00
==
==
=. +>.$
|- ^+ +>.^$
?~ old.cul +>.^$
=. +>.^$ $(old.cul t.old.cul)
(sh-note (weld pre "bye {(scow %p p.i.old.cul)}"))
=. +>.$
|- ^+ +>.^$
?~ new.cul +>.^$
=. +>.^$ $(new.cul t.new.cul)
%- sh-note
(weld pre "met {(scow %p p.i.new.cul)} {(sh-spaz q.i.new.cul)}")
=. +>.$
|- ^+ +>.^$
?~ cha.cul +>.^$
%- sh-note
(weld pre "set {(scow %p p.i.cha.cul)} {(sh-spaz q.i.cha.cul)}")
+>.$
::
++ sh-repo-group-here :: update local
2015-12-20 23:50:45 +03:00
|= loc/atlas
2015-05-07 05:31:54 +03:00
^+ +>
=+ cul=(sh-repo-atlas-diff p.owners.she loc)
=. p.owners.she loc
2015-05-07 05:31:54 +03:00
(sh-repo-group-diff-here "" cul)
::
++ sh-repo-group-there :: update foreign
2015-12-20 23:50:45 +03:00
|= yid/(map partner atlas)
=+ day=(sh-repo-rogue-diff q.owners.she yid)
=+ dun=q.owners.she
=. q.owners.she yid
2015-05-07 05:31:54 +03:00
=. +>.$
|- ^+ +>.^$
?~ old.day +>.^$
=. +>.^$ $(old.day t.old.day)
(sh-note (weld "not " (~(ta-show ta man.she p.i.old.day) ~)))
=. +>.$
|- ^+ +>.^$
?~ new.day +>.^$
=. +>.^$ $(new.day t.new.day)
=. +>.^$
(sh-note (weld "new " (~(ta-show ta man.she p.i.new.day) ~)))
(sh-repo-group-diff-here "--" ~ (~(tap by q.i.new.day)) ~)
=. +>.$
|- ^+ +>.^$
?~ cha.day +>.^$
=. +>.^$ $(cha.day t.cha.day)
=. +>.^$
(sh-note (weld "for " (~(ta-show ta man.she p.i.cha.day) ~)))
=+ yez=(~(got by dun) p.i.cha.day)
%+ sh-repo-group-diff-here "--"
(sh-repo-atlas-diff yez q.i.cha.day)
+>.$
::
++ sh-repo-group
2015-12-20 23:50:45 +03:00
|= ges/register
2015-05-07 05:31:54 +03:00
^+ +>
=. +> (sh-repo-group-here p.ges)
=. +> (sh-repo-group-there q.ges)
+>
::
++ sh-repo-gram
2015-12-20 23:50:45 +03:00
|= {num/@ud gam/telegram}
2015-05-07 05:31:54 +03:00
^+ +>
?: =(num count.she)
=. +> ?:(=(0 (mod num 5)) (sh-numb num) +>)
(sh-rend(count.she +(num)) gam)
?: (gth num count.she)
=. +> (sh-numb num)
(sh-rend(count.she +(num)) gam)
+>
::
++ sh-repo-grams :: apply telegrams
2015-12-20 23:50:45 +03:00
|= {num/@ud gaz/(list telegram)}
2015-05-07 05:31:54 +03:00
^+ +>
?~ gaz +>
$(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz))
::
++ sh-repo-glyph :: apply binding
2015-12-20 23:50:45 +03:00
|= nac/(jug char (set partner))
^+ +>
%_ sh-prod
nak nac
nik %- ~(gas by *(map (set partner) char))
2015-12-12 00:02:51 +03:00
=- (zing `(list (list {(set partner) char}))`-)
%+ turn (~(tap by nac))
2015-12-20 23:50:45 +03:00
|= {a/char b/(set (set partner))}
(turn (~(tap by b)) |=(c/(set partner) [c a]))
==
::
2015-05-07 05:31:54 +03:00
++ sh-repo :: apply report
2015-12-20 23:50:45 +03:00
|= rad/report
2015-05-07 05:31:54 +03:00
^+ +>
:: ~& [%sh-repo rad]
?- -.rad
$cabal (sh-repo-cabal +.rad)
$grams (sh-repo-grams +.rad)
$glyph (sh-repo-glyph +.rad) :: XX ever happens?
$group (sh-repo-group +.rad)
$house (sh-repo-house +.rad)
2015-05-07 05:31:54 +03:00
==
::
++ sh-sane-chat :: sanitize chatter
2015-12-20 23:50:45 +03:00
|= buf/(list @c)
2015-05-07 05:31:54 +03:00
^- (list sole-edit)
?~ buf ~
=+ isa==(i.buf (turf '@'))
=+ [[pre=*@c cur=i.buf buf=t.buf] inx=0 brk=0 len=0 new=|]
=* txt -<
|^ ^- (list sole-edit)
?: =(cur (turf '•'))
?: =(pre (turf '•'))
[[%del inx] ?~(buf ~ $(txt +.txt))]
?: new
[(fix ' ') $(cur `@c`' ')]
newline
?: =(cur `@`' ')
=. brk ?:(=(pre `@`' ') brk inx)
?. =(64 len) advance
:- (fix(inx brk) (turf '•'))
?: isa
[[%ins +(brk) (turf '@')] newline(new &)]
newline(new &)
?: =(64 len)
=+ dif=(sub inx brk)
?: (lth dif 64)
:- (fix(inx brk) (turf '•'))
?: isa
[[%ins +(brk) (turf '@')] $(len dif, new &)]
$(len dif, new &)
[[%ins inx (turf '•')] $(len 0, inx +(inx), new &)]
?: |((lth cur 32) (gth cur 126))
[(fix '?') advance]
?: &((gte cur 'A') (lte cur 'Z'))
[(fix (add 32 cur)) advance]
advance
::
++ advance ?~(buf ~ $(len +(len), inx +(inx), txt +.txt))
++ newline ?~(buf ~ $(len 0, inx +(inx), txt +.txt))
2015-12-20 23:50:45 +03:00
++ fix |=(cha/@ [%mor [%del inx] [%ins inx `@c`cha] ~])
2015-10-03 03:07:27 +03:00
--
2015-05-07 05:31:54 +03:00
::
++ sh-sane :: sanitize input
2015-12-20 23:50:45 +03:00
|= {inv/sole-edit buf/(list @c)}
2016-05-06 03:37:15 +03:00
^- {lit/(list sole-edit) err/(unit @u)}
=+ res=(rose (tufa buf) sh-scad)
2016-05-06 03:37:15 +03:00
?: ?=($| -.res) [[inv]~ `p.res]
:_ ~
?~ p.res ~
=+ wok=u.p.res
2015-10-03 03:07:27 +03:00
|- ^- (list sole-edit)
2016-05-06 03:37:15 +03:00
?+ -.wok ~
$target ?~(q.wok ~ $(wok u.q.wok))
$say |- :: XX per line
2016-05-06 03:37:15 +03:00
?~ p.wok ~
?: ?=($lin -.i.p.wok)
2015-10-03 03:07:27 +03:00
(sh-sane-chat buf)
2016-05-06 03:37:15 +03:00
$(p.wok t.p.wok)
==
2015-05-07 05:31:54 +03:00
::
++ sh-slug :: edit to sanity
2016-05-06 03:37:15 +03:00
|= {lit/(list sole-edit) err/(unit @u)}
2015-05-07 05:31:54 +03:00
^+ +>
?~ lit +>
=^ lic say.she
2015-09-02 01:20:17 +03:00
(~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit]))
2016-05-06 03:37:15 +03:00
(sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)])
2015-05-07 05:31:54 +03:00
::
++ sh-stir :: apply edit
2015-12-20 23:50:45 +03:00
|= cal/sole-change
2015-05-07 05:31:54 +03:00
^+ +>
2015-09-02 01:20:17 +03:00
=^ inv say.she (~(transceive sole say.she) cal)
2016-05-06 03:37:15 +03:00
=+ fix=(sh-sane inv buf.say.she)
?~ lit.fix
2015-05-07 05:31:54 +03:00
+>.$
?~ err.fix
(sh-slug fix) :: just capital correction
?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she)))
+>.$ :: allow interior edits, deletes
2016-05-06 03:37:15 +03:00
(sh-slug fix)
2015-05-07 05:31:54 +03:00
::
++ sh-lame :: send error
2015-12-20 23:50:45 +03:00
|= txt/tape
2015-05-07 05:31:54 +03:00
(sh-fact [%txt txt])
::
++ sh-whom :: current audience
^- audience
%- ~(gas by *audience)
%+ turn (~(tap in ?~(active.she passive.she u.active.she)))
2015-12-20 23:50:45 +03:00
|=(a/partner [a *envelope %pending])
2015-05-07 05:31:54 +03:00
::
++ sh-tell :: add command
2015-12-20 23:50:45 +03:00
|= cod/command
2015-05-07 05:31:54 +03:00
%_(+> coz [cod coz])
::
2015-06-19 04:47:41 +03:00
++ sh-twig-head ^- vase :: eval data
2015-12-20 23:50:45 +03:00
!>(`{our/@p now/@da eny/@uvI}`[our.hid now.hid (shas %eny eny.hid)])
2015-06-19 04:47:41 +03:00
::
2015-05-07 05:31:54 +03:00
++ sh-work :: do work
2015-12-20 23:50:45 +03:00
|= job/work
2015-05-07 05:31:54 +03:00
^+ +>
=+ roy=(~(got by stories) man.she)
=< work
|%
++ work
?- -.job
$number (number +.job)
$leave (leave +.job)
$join (join +.job)
$eval (eval +.job)
$who (who +.job)
$what (what +.job)
$bind (bind +.job)
$invite (invite +.job)
$banish (banish +.job)
$author (author +.job)
$block (block +.job)
$create (create +.job)
$nick (nick +.job)
$set (wo-set +.job)
$unset (unset +.job)
$target (target +.job)
$probe (probe +.job)
$help help
$say (say +.job)
2015-05-07 05:31:54 +03:00
==
::
++ activate :: from %number
2015-12-20 23:50:45 +03:00
|= gam/telegram
2015-06-16 22:34:40 +03:00
^+ ..sh-work
=+ tay=~(. tr man.she (~(has in settings.she) %noob) gam)
2015-11-17 06:29:27 +03:00
=. ..sh-work (sh-fact tr-fact:tay)
2015-10-06 01:56:58 +03:00
sh-prod(active.she `tr-pals:tay)
2015-05-07 05:31:54 +03:00
::
2015-11-17 06:29:27 +03:00
++ help
2016-07-07 06:09:44 +03:00
(sh-fact %txt "see http://urbit.org/docs/using/messaging/")
2015-11-17 06:29:27 +03:00
::
2015-10-08 20:26:42 +03:00
++ glyph
2015-12-20 23:50:45 +03:00
|= idx/@
=< cha
2015-09-30 02:47:30 +03:00
%+ reel glyphs
2015-12-20 23:50:45 +03:00
|= {all/tape ole/{cha/char num/@}}
2015-09-30 02:47:30 +03:00
=+ new=(snag (mod idx (lent all)) all)
=+ num=~(wyt in (~(get ju nak) new))
?~ cha.ole [new num]
?: (lth num.ole num)
ole
[new num]
::
2015-10-31 01:37:13 +03:00
++ set-glyph
2015-12-20 23:50:45 +03:00
|= {cha/char lix/(set partner)}
2015-10-31 01:37:13 +03:00
=: nik (~(put by nik) lix cha)
nak (~(put ju nak) cha lix)
==
%_ ..sh-work
..pa
%- (ra-know man.she)
|=(_pa pa-abet:(pa-report glyphers %glyph nak))
==
::
2015-05-07 05:31:54 +03:00
++ join :: %join
2015-12-20 23:50:45 +03:00
|= pan/(set partner)
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-09-30 02:47:30 +03:00
=. ..sh-work
=+ (~(get by nik) pan)
2015-09-30 02:47:30 +03:00
?^ - (sh-note "has glyph {<u>}")
=+ cha=(glyph (mug pan))
(sh-note:(set-glyph cha pan) "new glyph {<cha>}")
2015-05-07 05:31:54 +03:00
=+ loc=loc.system.she
%^ sh-tell %design man.she
`loc(sources (~(uni in sources.loc) pan))
2015-11-06 01:52:07 +03:00
::
++ leave :: %leave
2015-12-20 23:50:45 +03:00
|= pan/(set partner)
2015-11-06 01:52:07 +03:00
^+ ..sh-work
=+ loc=loc.system.she
%^ sh-tell %design man.she
`loc(sources (~(dif in sources.loc) pan))
2015-05-07 05:31:54 +03:00
::
2015-09-19 02:20:30 +03:00
++ what :: %what
2015-12-20 23:50:45 +03:00
|= qur/$@(char (set partner)) ^+ ..sh-work
2015-09-19 02:20:30 +03:00
?^ qur
=+ cha=(~(get by nik) qur)
(sh-fact %txt ?~(cha "none" [u.cha]~))
=+ pan=(~(tap in (~(get ju nak) qur)))
?: =(~ pan) (sh-fact %txt "~")
=< (sh-fact %mor (turn pan .))
2015-12-20 23:50:45 +03:00
|=(a/(set partner) [%txt <a>]) :: XX ~(te-whom te man.she a)
2015-09-19 02:20:30 +03:00
::
++ who :: %who
|= pan/(set partner) ^+ ..sh-work
=+ foo=`(list (pair partner atlas))`(~(tap by q.owners.she))
=+ bar=`(list (pair partner atlas))`(sort foo aor)
=< (sh-fact %mor (murn (sort (~(tap by q.owners.she) ~) aor) .))
2015-12-20 23:50:45 +03:00
|= {pon/partner alt/atlas} ^- (unit sole-effect)
2015-10-07 00:08:10 +03:00
?. |(=(~ pan) (~(has in pan) pon)) ~
2015-12-21 00:16:39 +03:00
=- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man.she pon) ~]
2015-10-07 00:08:10 +03:00
=< (murn (sort (~(tap by alt)) aor) .)
2015-12-20 23:50:45 +03:00
|= {a/ship b/presence c/human} ^- (unit tank) :: XX names
2015-10-07 00:08:10 +03:00
?- b
$gone ~
$hear `>a<
$talk `>a< :: XX difference
2015-10-07 00:08:10 +03:00
==
::
2015-09-19 02:20:30 +03:00
++ bind :: %bind
2015-12-20 23:50:45 +03:00
|= {cha/char pan/(unit (set partner))} ^+ ..sh-work
2015-09-19 02:20:30 +03:00
?~ pan $(pan [~ ?~(active.she passive.she u.active.she)])
=+ ole=(~(get by nik) u.pan)
?: =(ole [~ cha]) ..sh-work
2015-10-31 01:37:13 +03:00
(sh-note:(set-glyph cha u.pan) "bound {<cha>} {<u.pan>}")
2015-09-19 02:20:30 +03:00
::
2015-05-07 05:31:54 +03:00
++ invite :: %invite
|= {nom/knot tal/(list partner)}
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-05-07 05:31:54 +03:00
!!
::
2015-09-19 02:20:30 +03:00
++ block :: %block
|= {nom/knot tal/(list partner)}
2015-09-19 02:20:30 +03:00
^+ ..sh-work
!!
::
++ author :: %author
|= {nom/knot tal/(list partner)}
2015-09-19 02:20:30 +03:00
^+ ..sh-work
!!
::
2015-05-07 05:31:54 +03:00
++ banish :: %banish
|= {nom/knot tal/(list partner)}
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-05-07 05:31:54 +03:00
!!
::
++ create :: %create
|= {por/posture nom/knot txt/cord}
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-05-07 05:31:54 +03:00
?: (~(has in stories) nom)
(sh-lame "{(trip nom)}: already exists")
2015-06-16 22:34:40 +03:00
=. ..sh-work
2015-05-07 05:31:54 +03:00
%^ sh-tell %design nom
:- ~
:+ *(set partner)
2015-10-03 03:07:27 +03:00
(end 3 64 txt)
2015-05-07 05:31:54 +03:00
[por ~]
(join [[%& our.hid nom] ~ ~])
::
2015-10-08 23:55:06 +03:00
++ reverse-folks
|= nym/knot
2015-10-08 23:55:06 +03:00
^- (list ship)
%+ murn (~(tap by folks))
2015-12-20 23:50:45 +03:00
|= {p/ship q/human}
2015-10-08 23:55:06 +03:00
?~ hand.q ~
?. =(u.hand.q nym) ~
[~ u=p]
::
2015-10-08 23:07:08 +03:00
++ nick :: %nick
2015-12-20 23:50:45 +03:00
|= {her/(unit ship) nym/(unit cord)}
2015-10-08 20:26:42 +03:00
^+ ..sh-work
?: ?=({$~ $~} +<)
2015-10-08 23:26:16 +03:00
%+ sh-fact %mor
%+ turn (~(tap by folks))
2015-12-20 23:50:45 +03:00
|= {p/ship q/human}
2015-10-08 23:26:16 +03:00
:- %txt
?~ hand.q
"{<p>}:"
"{<p>}: {<u.hand.q>}"
2015-10-08 23:07:08 +03:00
?~ nym
2015-10-08 23:26:16 +03:00
?> ?=(^ her)
=+ asc=(~(get by folks) u.her)
%+ sh-fact %txt
?~ asc "{<u.her>} unbound"
?~ hand.u.asc "{<u.her>}:"
"{<u.her>}: {<u.hand.u.asc>}"
2015-10-08 23:07:08 +03:00
?~ her
2015-10-08 23:55:06 +03:00
%+ sh-fact %mor
%+ turn (reverse-folks u.nym)
2015-12-20 23:50:45 +03:00
|= p/ship
2015-10-08 23:55:06 +03:00
[%txt "{<p>}: {<u.nym>}"]
2015-10-08 23:07:08 +03:00
%= ..sh-work
folks ?~ u.nym
(~(del by folks) u.her)
(~(put by folks) u.her [true=~ hand=nym])
2015-10-08 23:07:08 +03:00
==
2015-10-08 20:26:42 +03:00
::
2015-11-06 05:53:59 +03:00
++ wo-set :: %set
|= seg/knot
2015-11-06 05:53:59 +03:00
^+ ..sh-work
?~ seg
%+ sh-fact %mor
%+ turn (~(tap in settings.she))
|= s/knot
[%txt (trip s)]
%= ..sh-work
settings.she (~(put in settings.she) seg)
==
2015-11-06 05:53:59 +03:00
::
++ unset :: %unset
|= neg/knot
2015-11-06 05:53:59 +03:00
^+ ..sh-work
%= ..sh-work
settings.she (~(del in settings.she) neg)
2015-10-08 23:07:08 +03:00
==
2015-10-07 00:08:10 +03:00
::
2015-05-07 05:31:54 +03:00
++ target :: %target
2015-12-20 23:50:45 +03:00
|= {pan/(set partner) woe/(unit ^work)}
^+ ..sh-work
=. ..sh-pact (sh-pact pan)
?~(woe ..sh-work work(job u.woe))
2015-05-07 05:31:54 +03:00
::
++ number :: %number
2015-12-20 23:50:45 +03:00
|= num/$@(@ud {p/@u q/@ud})
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-05-07 05:31:54 +03:00
=+ roy=(~(got by stories) man.she)
2015-10-06 03:15:48 +03:00
|-
?@ num
?: (gte num count.roy)
(sh-lame "{(scow %s (new:si | +(num)))}: no such telegram")
2015-10-06 22:23:26 +03:00
=. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}")
2015-10-06 03:15:48 +03:00
(activate (snag num grams.roy))
?. (gth q.num count.roy)
?~ count.roy
(sh-lame "0: no messages")
=+ msg=(deli (dec count.roy) num)
2015-10-06 22:23:26 +03:00
=. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}")
2015-10-06 03:15:48 +03:00
(activate (snag (sub count.roy +(msg)) grams.roy))
(sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram")
::
++ deli :: find number
2015-12-20 23:50:45 +03:00
|= {max/@ud nul/@u fin/@ud} ^- @ud
2015-10-06 03:15:48 +03:00
=+ dog=|-(?:(=(0 fin) 1 (mul 10 $(fin (div fin 10)))))
=. dog (mul dog (pow 10 nul))
2015-10-10 01:28:55 +03:00
=- ?:((lte - max) - (sub - dog))
2015-10-06 03:15:48 +03:00
(add fin (sub max (mod max dog)))
2015-05-07 05:31:54 +03:00
::
++ probe :: inquire
2015-12-20 23:50:45 +03:00
|= cuz/station
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-05-07 05:31:54 +03:00
~& [%probe cuz]
2015-06-16 22:34:40 +03:00
..sh-work
2015-05-07 05:31:54 +03:00
::
2015-06-19 04:47:41 +03:00
++ eval :: run
2015-12-20 23:50:45 +03:00
|= {txt/cord exe/twig}
2015-10-06 22:23:26 +03:00
=> |.([(sell (slap (slop sh-twig-head seed) exe))]~)
=+ tan=p:(mule .)
2015-12-21 00:16:39 +03:00
(say [%fat tank+tan exp+txt] ~)
2015-05-07 05:31:54 +03:00
::
++ say :: publish
2015-12-20 23:50:45 +03:00
|= sep/(list speech)
2015-06-16 22:34:40 +03:00
^+ ..sh-work
=- ..sh-work(coz ?~(tot coz :_(coz [%publish tot])))
|- ^- tot/(list thought)
?~ sep ~
2015-06-16 22:34:40 +03:00
=^ sir ..sh-work sh-uniq
[[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)]
2015-05-07 05:31:54 +03:00
--
::
++ sh-done :: apply result
2016-05-06 03:37:15 +03:00
=+ fix=(sh-sane [%nop ~] buf.say.she)
?^ lit.fix
(sh-slug fix)
=+ jub=(rust (tufa buf.say.she) sh-scad)
2015-05-07 05:31:54 +03:00
?~ jub (sh-fact %bel ~)
%. u.jub
=< sh-work
2015-05-07 05:31:54 +03:00
=+ buf=buf.say.she
2015-09-02 01:20:17 +03:00
=^ cal say.she (~(transmit sole say.she) [%set ~])
2015-05-07 05:31:54 +03:00
%- sh-fact
:* %mor
[%nex ~]
[%det cal]
2015-12-12 00:02:51 +03:00
?. ?=({$';' *} buf) ~
2015-05-07 05:31:54 +03:00
:_ ~
2015-12-29 01:01:44 +03:00
[%txt (runt [14 '-'] `tape`['|' ' ' (tufa `(list @)`buf)])]
2015-05-07 05:31:54 +03:00
==
::
++ sh-sole :: apply edit
2015-12-20 23:50:45 +03:00
|= act/sole-action
2015-05-07 05:31:54 +03:00
^+ +>
?- -.act
$det (sh-stir +.act)
$clr (sh-pact ~)
$ret sh-done
2015-05-07 05:31:54 +03:00
==
::
++ sh-uniq
2015-12-15 01:21:10 +03:00
^- {serial _.}
2015-05-07 05:31:54 +03:00
[(shaf %serial eny.hid) .(eny.hid (shax eny.hid))]
--
++ ra-abed :: resolve core
^+ [*(list move) +>]
2015-05-07 05:31:54 +03:00
:_ +>
=+ ^= yop
|- ^- (pair (list move) (list sole-effect))
?~ moves [~ ~]
=+ mor=$(moves t.moves)
2015-10-02 03:21:26 +03:00
?: ?& =(ost.hid p.i.moves)
2015-12-12 00:02:51 +03:00
?=({$diff $sole-effect *} q.i.moves)
2015-05-07 05:31:54 +03:00
==
[p.mor [+>.q.i.moves q.mor]]
[[i.moves p.mor] q.mor]
=+ :* moz=(flop p.yop)
^= foc ^- (unit sole-effect)
?~ q.yop ~
?~(t.q.yop `i.q.yop `[%mor (flop `(list sole-effect)`q.yop)])
==
2015-10-02 03:21:26 +03:00
?~(foc moz [[ost.hid %diff %sole-effect u.foc] moz])
2015-05-07 05:31:54 +03:00
::
++ ra-abet :: complete core
ra-abed:ra-axel
::
++ ra-axel :: rebound reports
^+ .
=+ ^= rey
|- ^- (pair (list move) (list (pair bone report)))
?~ moves
[~ ~]
=+ mor=$(moves t.moves)
?. ?& (~(has by shells) `bone`p.i.moves)
2015-12-12 00:02:51 +03:00
?=({$diff $talk-report *} q.i.moves)
2015-05-07 05:31:54 +03:00
==
[[i.moves p.mor] q.mor]
[p.mor [[p.i.moves +>.q.i.moves] q.mor]]
=. moves p.rey
2015-10-27 00:18:01 +03:00
=. q.rey (flop q.rey)
?: =(q.rey ~) +
2015-05-07 05:31:54 +03:00
|- ^+ +>
?~ q.rey ra-axel
=+ bak=(ra-back(ost.hid p.i.q.rey) q.i.q.rey)
$(q.rey t.q.rey, +> bak(ost.hid ost.hid))
2015-05-07 05:31:54 +03:00
::
++ ra-back
2015-12-20 23:50:45 +03:00
|= rad/report
2015-05-07 05:31:54 +03:00
^+ +>
2015-10-02 03:21:26 +03:00
sh-abet:(~(sh-repo sh ~ (~(got by shells) ost.hid)) rad)
2015-05-07 05:31:54 +03:00
::
++ ra-sole
2015-12-20 23:50:45 +03:00
|= act/sole-action
2015-05-07 05:31:54 +03:00
^+ +>
2015-10-02 03:21:26 +03:00
=+ shu=(~(get by shells) ost.hid)
2015-05-07 05:31:54 +03:00
?~ shu
~| :+ %ra-console-broken ost.hid
2015-10-29 02:10:23 +03:00
?:((~(has by sup.hid) ost.hid) %lost %unknown)
!!
sh-abet:(~(sh-sole sh ~ u.shu) act)
::
2015-05-07 05:31:54 +03:00
++ ra-emil :: ra-emit move list
2015-12-20 23:50:45 +03:00
|= mol/(list move)
2015-05-07 05:31:54 +03:00
%_(+> moves (welp (flop mol) moves))
::
++ ra-emit :: emit a move
2015-12-20 23:50:45 +03:00
|= mov/move
2015-05-07 05:31:54 +03:00
%_(+> moves [mov moves])
::
++ ra-evil :: emit error
2015-12-20 23:50:45 +03:00
|= msg/cord
2015-05-18 05:34:05 +03:00
~| [%ra-evil msg]
!!
2015-05-07 05:31:54 +03:00
::
++ ra-house :: emit partners
2015-12-20 23:50:45 +03:00
|= ost/bone
2015-10-02 03:21:26 +03:00
%+ ra-emit ost.hid
2015-05-07 05:31:54 +03:00
:+ %diff %talk-report
:- %house
%- ~(gas in *(map knot (pair posture cord)))
2015-05-07 05:31:54 +03:00
%+ turn (~(tap by stories))
|=({a/knot b/story} [a p.cordon.shape.b caption.shape.b])
2015-05-07 05:31:54 +03:00
::
++ ra-homes :: update partners
=+ gel=general
|- ^+ +>
?~ gel +>
=. +> $(gel l.gel)
=. +> $(gel r.gel)
(ra-house n.gel)
::
++ ra-init :: initialize talk
%+ roll
^- (list {posture knot cord})
:~ [%brown (main our.hid) 'default home']
[%green ~.public 'visible activity']
==
|: [[typ=*posture man=*knot des=*cord] ..ra-init] ^+ ..ra-init
2015-05-07 05:31:54 +03:00
%+ ra-apply our.hid
:+ %design man
2015-05-07 05:31:54 +03:00
:- ~ :- ~
[des [typ ~]]
2015-05-07 05:31:54 +03:00
::
++ ra-apply :: apply command
2015-12-20 23:50:45 +03:00
|= {her/ship cod/command}
2015-05-07 05:31:54 +03:00
^+ +>
?- -.cod
2015-12-12 00:02:51 +03:00
$design
2015-05-07 05:31:54 +03:00
?. =(her our.hid)
(ra-evil %talk-no-owner)
?~ q.cod
?. (~(has by stories) p.cod)
(ra-evil %talk-no-story)
2015-05-18 05:34:05 +03:00
(ra-config(stories (~(del by stories) p.cod)) p.cod *config)
(ra-config p.cod u.q.cod)
2015-05-07 05:31:54 +03:00
::
2015-12-12 00:02:51 +03:00
$review (ra-think | her +.cod)
$publish (ra-think & her +.cod)
2015-05-07 05:31:54 +03:00
==
::
++ ra-config :: configure story
|= {man/knot con/config}
2015-05-07 05:31:54 +03:00
^+ +>
=+ :- neu=(~(has by stories) man)
pur=(fall (~(get by stories) man) *story)
=. +>.$ pa-abet:(~(pa-reform pa man pur) con)
?:(neu +>.$ ra-homes)
::
++ ra-base-hart .^(hart %e /(scot %p our.hid)/host/(scot %da now.hid))
++ ra-fora-post
|= {pax/path sup/spur hed/@t txt/@t}
=. ..ra-emit
%+ ra-emit ost.hid
:* %poke
/fora-post
[our.hid %hood]
[%write-fora-post sup src.hid hed txt]
==
=+ man=%posts
?: (~(has by stories) man)
(ra-consume-fora-post man pax sup hed txt)
=; new (ra-consume-fora-post:new man pax sup hed txt)
=. ..ra-apply
%+ ra-apply our.hid
:+ %design man
:- ~ :- ~
:- 'towards a community'
[%brown ~]
%^ ra-consume & our.hid
:^ (shaf %init eny.hid)
(my [[%& our.hid (main our.hid)] *envelope %pending] ~)
now.hid
[~ %app %tree 'receiving forum posts, ;join %posts for details']
::
++ ra-consume-fora-post
|= {man/knot pax/path sup/spur hed/@t txt/@t} ^+ +>
=+ nam=?~(sup "" (trip i.sup)) :: file name
=+ fra=(crip (time-to-id now.hid)) :: url fragment
%^ ra-consume &
src.hid
:* (shaf %comt eny.hid)
(my [[%& our.hid man] *envelope %pending] ~)
now.hid
(sy /fora-post eyre+pax ~)
:- %mor :~
[%fat text+(lore txt) [%url [ra-base-hart `pax ~] `fra]]
[%app %tree (crip "forum post: '{(trip hed)}'")]
==
==
::
++ ra-comment
|= {pax/path sup/spur txt/@t}
=. ..ra-emit
%+ ra-emit ost.hid
:* %poke
/comment
[our.hid %hood]
[%write-comment sup src.hid txt]
==
2016-02-27 02:50:14 +03:00
=+ man=%comments
?: (~(has by stories) man)
(ra-consume-comment man pax sup txt)
=; new (ra-consume-comment:new man pax sup txt)
=. ..ra-apply
%+ ra-apply our.hid
:+ %design man
:- ~ :- ~
:- 'letters to the editor'
[%brown ~]
%^ ra-consume & our.hid
:^ (shaf %init eny.hid)
(my [[%& our.hid (main our.hid)] *envelope %pending] ~)
now.hid
[~ %app %tree 'receiving comments, ;join %comments for details']
::
++ ra-consume-comment
|= {man/knot pax/path sup/spur txt/@t} ^+ +>
=+ nam=?~(sup "" (trip i.sup)) :: file name
2016-02-26 05:40:19 +03:00
=+ fra=(crip (time-to-id now.hid)) :: url fragment
2016-02-27 02:50:14 +03:00
%^ ra-consume &
src.hid
:* (shaf %comt eny.hid)
(my [[%& our.hid man] *envelope %pending] ~)
now.hid
(sy /comment eyre+pax ~)
:- %mor :~
[%fat text+(lore txt) [%url [ra-base-hart `pax ~] `fra]]
[%app %tree (crip "comment on /{nam}")]
==
2016-02-26 04:56:17 +03:00
==
::
2015-05-07 05:31:54 +03:00
++ ra-know :: story monad
|= man/knot
2016-02-04 10:12:23 +03:00
|* fun/$-(_pa _+>)
2015-05-07 05:31:54 +03:00
^+ +>+>
=+ pur=(~(get by stories) man)
?~ pur
~& [%ra-know-not man] :: XX should crash
+>+>.$
(fun ~(. pa man u.pur))
::
++ ra-diff-talk-report :: subscription update
|= {man/knot cuz/station rad/report}
2015-12-20 23:50:45 +03:00
%- (ra-know man) |= par/_pa =< pa-abet
2015-05-07 05:31:54 +03:00
(pa-diff-talk-report:par cuz rad)
::
++ ra-quit :: subscription quit
|= {man/knot cuz/station}
2015-12-20 23:50:45 +03:00
%- (ra-know man) |= par/_pa =< pa-abet
2015-05-07 05:31:54 +03:00
(pa-quit:par %& cuz)
::
2015-05-18 05:34:05 +03:00
++ ra-retry :: subscription resend
|= {man/knot cuz/station}
2015-12-20 23:50:45 +03:00
%- (ra-know man) |= par/_pa =< pa-abet
2015-05-18 05:34:05 +03:00
(pa-acquire:par [%& cuz]~)
::
2015-05-07 05:31:54 +03:00
++ ra-coup-repeat ::
|= {{num/@ud her/@p man/knot} saw/(unit tang)}
2015-05-07 05:31:54 +03:00
(ra-repeat num [%& her man] saw)
::
++ ra-repeat :: remove from outbox
2015-12-20 23:50:45 +03:00
|= {num/@ud pan/partner saw/(unit tang)}
2015-05-07 05:31:54 +03:00
=+ oot=(~(get by q.outbox) num)
?~ oot ~|([%ra-repeat-none num] !!)
=. q.outbox (~(del by q.outbox) num)
=. q.u.oot
=+ olg=(~(got by q.u.oot) pan)
%+ ~(put by q.u.oot) pan
:- -.olg
?~ saw %received
~> %slog.[0 u.saw]
%rejected
(ra-think | our.hid u.oot ~)
::
++ ra-cancel :: drop a bone
2015-12-20 23:50:45 +03:00
|= {src/ship pax/path}
2015-05-18 05:34:05 +03:00
^+ +>
2015-12-12 00:02:51 +03:00
?. ?=({@ @ *} pax)
2015-10-02 03:21:26 +03:00
+>(general (~(del in general) ost.hid))
2015-12-20 23:50:45 +03:00
%- (ra-know i.t.pax) |= par/_pa =< pa-abet
2015-05-18 05:34:05 +03:00
(pa-notify:pa-cancel:par src %gone *human)
2015-05-07 05:31:54 +03:00
::
++ ra-human :: look up person
2015-12-20 23:50:45 +03:00
|= her/ship
2015-12-15 01:21:10 +03:00
^- {human _+>}
2015-05-07 05:31:54 +03:00
=^ who folks
=+ who=(~(get by folks) her)
?^ who [u.who folks]
=+ who=`human`[~ `(scot %p her)] :: XX do right
[who (~(put by folks) her who)]
[who +>.$]
::
++ ra-console :: console subscribe
2015-12-20 23:50:45 +03:00
|= {her/ship pax/path}
2015-05-07 05:31:54 +03:00
^+ +>
=+ man=`knot`?~(pax (main her) ?>(?=($~ t.pax) i.pax))
2015-05-07 05:31:54 +03:00
=+ ^= she ^- shell
[her man 0 *sole-share ~ [[%& our.hid man] ~ ~] [~ ~] ~ *cabal ~]
2015-05-07 05:31:54 +03:00
sh-abet:~(sh-peer sh ~ she)
::
++ ra-subscribe :: listen to
2015-12-20 23:50:45 +03:00
|= {her/ship pax/path}
2015-05-07 05:31:54 +03:00
^+ +>
2015-10-02 03:21:26 +03:00
:: ~& [%ra-subscribe ost.hid her pax]
?: ?=($~ pax)
2015-10-02 03:21:26 +03:00
(ra-house(general (~(put in general) ost.hid)) ost.hid)
2015-12-12 00:02:51 +03:00
?. ?=({@ @ *} pax)
2015-05-07 05:31:54 +03:00
(ra-evil %talk-bad-path)
=+ vab=(~(gas in *(set peer-type)) (turn (rip 3 i.pax) decode:peer-type))
2015-05-07 05:31:54 +03:00
=+ pur=(~(get by stories) i.t.pax)
?~ pur
~& [%bad-subscribe-story-c i.t.pax]
(ra-evil %talk-no-story)
=+ soy=~(. pa i.t.pax u.pur)
?. (pa-visible:soy her)
(ra-evil %talk-no-story)
2015-06-09 18:23:40 +03:00
=^ who +>.$ (ra-human her)
=. soy ?.((~(has in vab) %a-group) soy (pa-watch-group:soy her))
=. soy ?.((~(has in vab) %v-glyph) soy (pa-watch-glyph:soy her))
=. soy ?.((~(has in vab) %x-cabal) soy (pa-watch-cabal:soy her))
=. soy ?.((~(has in vab) %f-grams) soy (pa-watch-grams:soy her t.t.pax))
2015-06-09 18:23:40 +03:00
=. soy (pa-notify:soy her %hear who)
pa-abet:soy
2015-05-07 05:31:54 +03:00
::
2015-12-21 00:16:39 +03:00
++ ra-think :: publish+review
2015-12-20 23:50:45 +03:00
|= {pub/? her/ship tiz/(list thought)}
2015-05-07 05:31:54 +03:00
^+ +>
?~ tiz +>
$(tiz t.tiz, +> (ra-consume pub her i.tiz))
::
++ ra-normal :: normalize
2015-12-20 23:50:45 +03:00
|= tip/thought
2015-05-07 05:31:54 +03:00
^- thought
2015-12-12 00:02:51 +03:00
?. ?=({$lin *} r.r.tip) tip
2015-05-07 05:31:54 +03:00
%_ tip
q.r.r
%- crip
2015-10-03 03:07:27 +03:00
%+ scag 64
2015-05-07 05:31:54 +03:00
%- tufa
%+ turn (tuba (trip q.r.r.tip))
2015-12-20 23:50:45 +03:00
|= a/@c
2015-05-07 05:31:54 +03:00
?: &((gte a 'A') (lte a 'Z'))
(add a 32)
?: |((lth a 32) (gth a 126))
`@`'?'
a
==
::
++ ra-consume :: consume thought
2015-12-20 23:50:45 +03:00
|= {pub/? her/ship tip/thought}
2015-05-07 05:31:54 +03:00
=. tip (ra-normal tip)
=+ aud=(~(tap by q.tip) ~)
|- ^+ +>.^$
?~ aud +>.^$
$(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip))
::
++ ra-conduct :: thought to partner
2015-12-20 23:50:45 +03:00
|= {pub/? her/ship tay/partner tip/thought}
2015-05-07 05:31:54 +03:00
^+ +>
:: ~& [%ra-conduct pub her tay]
?- -.tay
$& ?: pub
2015-05-07 05:31:54 +03:00
=. her our.hid :: XX security!
?: =(her p.p.tay)
(ra-record q.p.tay p.p.tay tip)
(ra-transmit p.tay tip)
?. =(our.hid p.p.tay)
+>
(ra-record q.p.tay her tip)
$| !!
2015-05-07 05:31:54 +03:00
==
::
++ ra-record :: add to story
|= {man/knot gam/telegram}
2015-12-20 23:50:45 +03:00
%- (ra-know man) |= par/_pa =< pa-abet
2015-05-07 05:31:54 +03:00
(pa-learn:par gam)
::
++ ra-transmit :: send to neighbor
2015-12-20 23:50:45 +03:00
|= {cuz/station tip/thought}
2015-05-07 05:31:54 +03:00
^+ +>
=. +>
2015-10-02 03:21:26 +03:00
%+ ra-emit ost.hid
2015-05-07 05:31:54 +03:00
:* %poke
/repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz]
[p.cuz %talk]
[%talk-command `command`[%review tip ~]]
==
+>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip))
::
++ pa :: story core
|_ $: man/knot
2015-05-07 05:31:54 +03:00
story
==
++ pa-abet
^+ +>
+>(stories (~(put by stories) man `story`+<+))
::
++ pa-admire :: accept from
2015-12-20 23:50:45 +03:00
|= her/ship
2015-05-07 05:31:54 +03:00
^- ?
::?- -.cordon.shape
:: %& (~(has in p.cordon.shape) her)
:: %| !(~(has in p.cordon.shape) her)
::==
&
::
++ pa-visible :: display to
2015-12-20 23:50:45 +03:00
|= her/ship
^- ?
?- p.cordon.shape
2015-12-12 00:02:51 +03:00
$black &
$green &
$brown (team our.hid her)
2015-12-12 00:02:51 +03:00
$white (~(has in q.cordon.shape) her)
==
::
++ pa-report :: update
2015-12-20 23:50:45 +03:00
|= {wac/(set bone) caw/report}
:: ~& [%pa-report man -.caw]
^+ +>
?~ wac +>
=. +> $(wac l.wac)
=. +> $(wac r.wac)
:: ~& [%pa-report-cabal man shape]
(pa-sauce n.wac [%diff %talk-report caw]~)
::
++ pa-watch-group :: subscribe presence
2015-12-20 23:50:45 +03:00
|= her/ship
?. (pa-admire her)
(pa-sauce ost.hid [%quit ~]~)
=. groupers (~(put in groupers) ost.hid)
(pa-report-group ost.hid ~ ~)
::
++ pa-watch-cabal :: subscribe config
2015-12-20 23:50:45 +03:00
|= her/ship
2015-05-07 05:31:54 +03:00
?. (pa-admire her)
~& [%pa-admire-not her]
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [%quit ~]~)
=. cabalers (~(put in cabalers) ost.hid)
:: ~& [%pa-watch-cabal her man shape]
(pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~])
2015-05-07 05:31:54 +03:00
::
++ pa-watch-glyph :: subscribe config
2015-12-20 23:50:45 +03:00
|= her/ship
2015-05-07 05:31:54 +03:00
?. (pa-admire her)
~& [%pa-admire-not her]
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [%quit ~]~)
=. glyphers (~(put in glyphers) ost.hid)
(pa-report [ost.hid ~ ~] %glyph nak)
2015-05-07 05:31:54 +03:00
::
++ pa-report-group :: update presence
2015-12-20 23:50:45 +03:00
|= vew/(set bone)
%^ pa-report vew %group
:_ remotes
|- ^- atlas
?~ locals ~
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
2015-05-07 05:31:54 +03:00
::
++ pa-report-cabal :: update config
(pa-report cabalers %cabal shape mirrors)
2015-05-07 05:31:54 +03:00
::
++ pa-cabal
2015-12-20 23:50:45 +03:00
|= {cuz/station con/config ham/(map station config)}
2015-05-07 05:31:54 +03:00
^+ +>
=+ old=mirrors
=. mirrors (~(put by mirrors) cuz con)
?: =(mirrors old)
+>.$
pa-report-cabal
2015-05-07 05:31:54 +03:00
::
++ pa-diff-talk-report :: subscribed update
2015-12-20 23:50:45 +03:00
|= {cuz/station rad/report}
2015-05-07 05:31:54 +03:00
^+ +>
2015-05-18 05:34:05 +03:00
?. (~(has in sources.shape) [%& cuz])
~& [%pa-diff-unexpected cuz rad]
+>
2015-05-07 05:31:54 +03:00
?+ -.rad ~|([%talk-odd-friend rad] !!)
2015-12-12 00:02:51 +03:00
$cabal (pa-cabal cuz +.rad)
$group (pa-remind [%& cuz] +.rad)
$grams (pa-lesson q.+.rad)
2015-05-07 05:31:54 +03:00
==
::
++ pa-quit :: stop subscription
2015-12-20 23:50:45 +03:00
|= tay/partner
pa-report-cabal(sources.shape (~(del in sources.shape) tay))
2015-05-07 05:31:54 +03:00
::
++ pa-sauce :: send backward
2015-12-20 23:50:45 +03:00
|= {ost/bone cub/(list card)}
2015-05-07 05:31:54 +03:00
%_ +>.$
moves
2015-12-20 23:50:45 +03:00
(welp (flop (turn cub |=(a/card [ost a]))) moves)
2015-05-07 05:31:54 +03:00
==
::
++ pa-abjure :: unsubscribe move
2015-12-20 23:50:45 +03:00
|= tal/(list partner)
2015-05-07 05:31:54 +03:00
%+ pa-sauce 0
%- zing
%+ turn tal
2015-12-20 23:50:45 +03:00
|= tay/partner
2015-05-07 05:31:54 +03:00
^- (list card)
?- -.tay
2015-12-21 00:16:39 +03:00
$| ~& tweet-abjure+p.p.tay
2015-05-07 05:31:54 +03:00
!!
::
$& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]]
2015-05-07 05:31:54 +03:00
:_ ~
:* %pull
/friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[p.p.tay %talk]
~
==
==
::
++ pa-acquire :: subscribe to
2015-12-20 23:50:45 +03:00
|= tal/(list partner)
2015-05-07 05:31:54 +03:00
%+ pa-sauce 0
%- zing
%+ turn tal
2015-12-20 23:50:45 +03:00
|= tay/partner
2015-05-07 05:31:54 +03:00
^- (list card)
=+ num=(~(get by sequence) tay)
=+ old=(sub now.hid ~d1) :: XX full backlog
=+ ini=?^(num (scot %ud u.num) (scot %da old))
=/ typ
=+ (ly ~[%a-group %f-grams %x-cabal])
(rap 3 (turn - encode:peer-type))
2015-05-07 05:31:54 +03:00
?- -.tay
$| !!
$& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]]
2015-05-07 05:31:54 +03:00
:_ ~
:* %peer
/friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[p.p.tay %talk]
/[typ]/[q.p.tay]/[ini]
2015-05-07 05:31:54 +03:00
==
==
::
++ pa-reform :: reconfigure, ugly
2015-12-20 23:50:45 +03:00
|= cof/config
2015-05-07 05:31:54 +03:00
=+ ^= dif ^- (pair (list partner) (list partner))
=+ old=`(list partner)`(~(tap in sources.shape) ~)
=+ new=`(list partner)`(~(tap in sources.cof) ~)
2015-12-20 23:50:45 +03:00
:- (skip new |=(a/partner (~(has in sources.shape) a)))
(skip old |=(a/partner (~(has in sources.cof) a)))
2015-05-07 05:31:54 +03:00
=. +>.$ (pa-acquire p.dif)
=. +>.$ (pa-abjure q.dif)
=. shape cof
pa-report-cabal
2015-05-07 05:31:54 +03:00
::
++ pa-cancel :: unsubscribe from
2015-11-17 06:29:27 +03:00
:: ~& [%pa-cancel ost.hid]
2015-05-07 05:31:54 +03:00
%_ .
gramsers (~(del by gramsers) ost.hid)
groupers (~(del in groupers) ost.hid)
glyphers (~(del in glyphers) ost.hid)
cabalers (~(del in cabalers) ost.hid)
2015-05-07 05:31:54 +03:00
==
::
++ pa-notify :: local presence
2015-12-20 23:50:45 +03:00
|= {her/ship saz/status}
2015-05-07 05:31:54 +03:00
^+ +>
=+ ^= nol
?: =(%gone p.saz)
(~(del by locals) her)
2015-05-28 06:54:20 +03:00
(~(put by locals) her now.hid saz)
2015-05-07 05:31:54 +03:00
?: =(nol locals) +>.$
(pa-report-group(locals nol) groupers)
2015-05-07 05:31:54 +03:00
::
++ pa-remind :: remote presence
2015-12-20 23:50:45 +03:00
|= {tay/partner loc/atlas rem/(map partner atlas)}
=+ ^= buk
=+ mer=(turn (~(tap by rem) ~) |=({* a/atlas} a))
|- ^- atlas
?~ mer loc
=. loc $(mer t.mer)
=+ dur=`(list (pair ship status))`(~(tap by i.mer) ~)
|- ^- atlas
?~ dur loc
=. loc $(dur t.dur)
=+ fuy=(~(get by loc) p.i.dur)
?~ fuy (~(put by loc) p.i.dur q.i.dur)
?: =(`presence`p.q.i.dur `presence`p.u.fuy)
loc
?- p.u.fuy
$gone (~(del by loc) p.i.dur q.i.dur)
$talk loc
$hear (~(put by loc) p.i.dur q.i.dur)
==
=+ gub=(~(get by remotes) tay)
:: ~& [%pa-remind tay gub buk]
?. |(?=($~ gub) !=(buk u.gub))
+>.$
=. remotes (~(put by remotes) tay buk)
(pa-report-group groupers)
2015-05-07 05:31:54 +03:00
::
++ pa-start :: start stream
2015-12-20 23:50:45 +03:00
|= riv/river
2015-05-07 05:31:54 +03:00
^+ +>
=- :: ~& [%pa-start riv lab]
2015-10-29 02:10:23 +03:00
=. +>.$
(pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~])
2015-05-07 05:31:54 +03:00
?: p.lab
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [[%quit ~] ~])
+>.$(gramsers (~(put by gramsers) ost.hid riv))
2015-05-07 05:31:54 +03:00
^= lab
=+ [end=count gaz=grams dun=| zeg=*(list telegram)]
2015-12-12 00:02:51 +03:00
|- ^- (trel ? @ud (list telegram))
2015-05-07 05:31:54 +03:00
?~ gaz [dun end zeg]
?: ?- -.q.riv :: after the end
2015-12-12 00:02:51 +03:00
$ud (lte p.q.riv end)
$da (lte p.q.riv p.r.q.i.gaz)
2015-05-07 05:31:54 +03:00
==
$(end (dec end), gaz t.gaz)
?: ?- -.p.riv :: before the start
2015-12-12 00:02:51 +03:00
$ud (lth end p.p.riv)
$da (lth p.r.q.i.gaz p.p.riv)
2015-05-07 05:31:54 +03:00
==
[dun end zeg]
$(end (dec end), gaz t.gaz, zeg [i.gaz zeg])
::
++ pa-watch-grams :: subscribe messages
2015-12-20 23:50:45 +03:00
|= {her/ship pax/path}
2015-05-07 05:31:54 +03:00
^+ +>
?. (pa-admire her)
~& [%pa-watch-grams-admire ~]
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [%quit ~]~)
2015-05-07 05:31:54 +03:00
=+ ^= ruv ^- (unit river)
2015-10-29 02:10:23 +03:00
%+ biff
2015-12-20 23:50:45 +03:00
(zl:jo (turn pax ;~(biff slay |=(a/coin `(unit dime)`?~(-.a a ~)))))
|= paf/(list dime)
2015-10-29 02:10:23 +03:00
?~ paf
$(paf [%ud (sub (max 64 count) 64)]~)
?~ t.paf
$(t.paf [%da (dec (bex 128))]~)
2015-12-12 00:02:51 +03:00
?. ?=({{?($ud $da) @} {?($ud $da) @} $~} paf)
2015-10-29 02:10:23 +03:00
~
2015-12-12 00:02:51 +03:00
`[[?+(- . $ud .)]:i.paf [?+(- . $ud .)]:i.t.paf] :: XX types
:: ~& [%pa-watch-grams her pax ruv]
2015-05-07 05:31:54 +03:00
?~ ruv
~& [%pa-watch-grams-malformed pax]
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [%quit ~]~)
2015-05-07 05:31:54 +03:00
(pa-start u.ruv)
::
++ pa-refresh :: update to listeners
2015-12-20 23:50:45 +03:00
|= {num/@ud gam/telegram}
2015-05-07 05:31:54 +03:00
^+ +>
=+ ^= moy
|- ^- (pair (list bone) (list move))
?~ gramsers [~ ~]
:: ~& [%pa-refresh num n.gramsers]
=+ lef=$(gramsers l.gramsers)
=+ rit=$(gramsers r.gramsers)
2015-05-07 05:31:54 +03:00
=+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)]
?: ?- -.q.q.n.gramsers :: after the end
2015-12-12 00:02:51 +03:00
$ud (lte p.q.q.n.gramsers num)
$da (lte p.q.q.n.gramsers p.r.q.gam)
2015-05-07 05:31:54 +03:00
==
[[p.n.gramsers p.old] [[p.n.gramsers %quit ~] q.old]]
?: ?- -.p.q.n.gramsers :: before the start
2015-12-12 00:02:51 +03:00
$ud (gth p.p.q.n.gramsers num)
$da (gth p.p.q.n.gramsers p.r.q.gam)
2015-05-07 05:31:54 +03:00
==
old
:- p.old
[[p.n.gramsers %diff %talk-report %grams num gam ~] q.old]
2015-05-07 05:31:54 +03:00
=. moves (welp q.moy moves)
|- ^+ +>.^$
?~ p.moy +>.^$
$(p.moy t.p.moy, gramsers (~(del by gramsers) i.p.moy))
2015-05-07 05:31:54 +03:00
::
++ pa-lesson :: learn multiple
2015-12-20 23:50:45 +03:00
|= gaz/(list telegram)
2015-05-07 05:31:54 +03:00
^+ +>
?~ gaz +>
$(gaz t.gaz, +> (pa-learn i.gaz))
::
++ pa-learn :: learn message
2015-12-20 23:50:45 +03:00
|= gam/telegram
2015-05-07 05:31:54 +03:00
^+ +>
?. (pa-admire p.gam)
~& %pa-admire-rejected
+>.$
=. q.q.gam
=+ ole=(~(get by q.q.gam) [%& our.hid man])
?^ ole (~(put by q.q.gam) [%& our.hid man] -.u.ole %received)
2016-09-20 21:22:42 +03:00
:: for fedearted stations, pretend station src/foo is also our/foo
:: XX pass src through explicitly instead of relying on implicit
:: value in hid from the subscription to src/foo
=+ ole=(~(get by q.q.gam) [%& src.hid man])
2015-05-07 05:31:54 +03:00
?~ ole q.q.gam
=. q.q.gam (~(del by q.q.gam) [%& src.hid man])
2015-05-07 05:31:54 +03:00
(~(put by q.q.gam) [%& our.hid man] -.u.ole %received)
=+ old=(~(get by known) p.q.gam)
?~ old
(pa-append gam)
(pa-revise u.old gam)
::
++ pa-append :: append new
2015-12-20 23:50:45 +03:00
|= gam/telegram
2015-05-07 05:31:54 +03:00
^+ +>
%+ %= pa-refresh
grams [gam grams]
count +(count)
known (~(put by known) p.q.gam count)
==
count
gam
::
++ pa-revise :: revise existing
2015-12-20 23:50:45 +03:00
|= {num/@ud gam/telegram}
2015-05-07 05:31:54 +03:00
=+ way=(sub count num)
2016-05-31 23:48:33 +03:00
?: =(gam (snag (dec way) grams))
+>.$ :: no change
2015-05-07 05:31:54 +03:00
=. grams (welp (scag (dec way) grams) [gam (slag way grams)])
(pa-refresh num gam)
--
--
::
++ sn :: station render core
|_ {man/knot one/station}
2015-05-07 05:31:54 +03:00
++ sn-best :: best to show
2015-12-20 23:50:45 +03:00
|= two/station
2015-05-07 05:31:54 +03:00
^- ?
?: =(our.hid p.one)
?: =(our.hid p.two)
?< =(q.one q.two)
?: =((main p.one) q.one) %&
?: =((main p.two) q.two) %|
(lth q.one q.two)
%&
?: =(our.hid p.two)
%|
?: =(p.one p.two)
(lth q.one q.two)
(lth p.one q.one)
::
++ sn-curt :: render name in 14
2015-12-20 23:50:45 +03:00
|= mup/?
2015-05-07 05:31:54 +03:00
^- tape
=+ rac=(clan p.one)
=+ raw=(scow %p p.one)
=. raw ?.(mup raw ['*' (slag 2 raw)])
?- rac
2015-12-12 00:02:51 +03:00
$czar (weld " " raw)
$king (weld " " raw)
$duke raw
$earl ;: welp
2015-10-12 22:53:52 +03:00
(scag 1 raw)
(scag 6 (slag 15 raw))
"^"
(scag 6 (slag 22 raw))
==
2015-12-12 00:02:51 +03:00
$pawn :(welp (scag 7 raw) "_" (scag 6 (slag 51 raw)))
2015-05-07 05:31:54 +03:00
==
::
++ sn-nick
|. ^- tape
=+ nym=(~(get by folks) p.one)
?~ nym
(sn-curt |)
?~ hand.u.nym
(sn-curt |)
=+ raw=(trip u.hand.u.nym)
=+ len=(sub 14 (lent raw))
(weld (reap len ' ') raw)
::
2015-05-07 05:31:54 +03:00
++ sn-phat :: render accurately
^- tape
?: =(p.one our.hid)
?: =(q.one man)
2015-11-02 23:04:07 +03:00
":"
2015-05-07 05:31:54 +03:00
['%' (trip q.one)]
?: =(p.one (sein our.hid))
['/' (trip q.one)]
=+ wun=(scow %p p.one)
?: =(q.one (main p.one))
wun
:(welp wun "/" (trip q.one))
--
::
++ ta :: partner core
|_ {man/knot one/partner}
2015-05-07 05:31:54 +03:00
++ ta-beat :: more relevant
2015-12-20 23:50:45 +03:00
|= two/partner ^- ?
2015-05-07 05:31:54 +03:00
?- -.one
$&
2015-05-07 05:31:54 +03:00
?- -.two
$| %&
$& (~(sn-best sn man p.one) p.two)
2015-05-07 05:31:54 +03:00
==
::
$|
2015-05-07 05:31:54 +03:00
?- -.two
$& %|
$| ?: =(-.p.two -.p.one)
2015-05-07 05:31:54 +03:00
(lth (mug +.p.one) (mug +.p.two))
(lth -.p.two -.p.one)
==
==
++ ta-best :: most relevant
2015-12-20 23:50:45 +03:00
|=(two/partner ?:((ta-beat two) two one))
2015-05-07 05:31:54 +03:00
::
++ ta-full (ta-show ~) :: render full width
++ ta-show :: render partner
2015-12-20 23:50:45 +03:00
|= moy/(unit ?)
2015-05-07 05:31:54 +03:00
^- tape
?- -.one
$&
2015-10-06 22:23:26 +03:00
?~ moy
=+ cha=(~(get by nik) one ~ ~)
=- ?~(cha - "'{u.cha ~}' {-}")
2015-05-07 05:31:54 +03:00
~(sn-phat sn man p.one)
(~(sn-curt sn man p.one) u.moy)
::
$|
2015-05-07 05:31:54 +03:00
=+ ^= pre ^- tape
?- -.p.one
2015-12-12 00:02:51 +03:00
$twitter "@t:"
2015-05-07 05:31:54 +03:00
==
?~ moy
(weld pre (trip p.p.one))
=. pre ?.(=(& u.moy) pre ['*' pre])
(sigh 14 pre p.p.one)
==
--
::
++ te :: audience renderer
|_ {man/knot lix/(set partner)}
2015-05-07 05:31:54 +03:00
++ te-best ^- (unit partner)
?~ lix ~
:- ~
|- ^- partner
=+ lef=`(unit partner)`te-best(lix l.lix)
=+ rit=`(unit partner)`te-best(lix r.lix)
=. n.lix ?~(lef n.lix (~(ta-best ta man n.lix) u.lef))
=. n.lix ?~(rit n.lix (~(ta-best ta man n.lix) u.rit))
n.lix
::
++ te-deaf ^+ . :: except for self
.(lix (~(del in lix) `partner`[%& our.hid man]))
::
++ te-maud ^- ? :: multiple audience
=. . te-deaf
2015-12-14 10:58:14 +03:00
!?=($@($~ {* $~ $~}) lix)
2015-05-07 05:31:54 +03:00
::
++ te-prom ^- tape :: render targets
=. . te-deaf
=+ ^= all
%+ sort `(list partner)`(~(tap in lix))
2015-12-20 23:50:45 +03:00
|= {a/partner b/partner}
2015-05-07 05:31:54 +03:00
(~(ta-beat ta man a) b)
=+ fir=&
|- ^- tape
?~ all ~
;: welp
?:(fir "" " ")
(~(ta-show ta man i.all) ~)
$(all t.all, fir |)
==
::
++ te-whom :: render sender
(~(ta-show ta man (need te-best)) ~ te-maud)
2015-09-19 02:20:30 +03:00
::
2015-11-02 23:04:07 +03:00
++ ta-dire :: direct message
2015-12-20 23:50:45 +03:00
|= pan/partner ^- ?
2015-12-12 00:02:51 +03:00
?& ?=($& -.pan)
2015-11-02 23:04:07 +03:00
=(p.p.pan our.hid)
::
=+ sot=(~(get by stories) q.p.pan)
&(?=(^ sot) ?=($brown p.cordon.shape.u.sot))
2015-11-02 23:04:07 +03:00
==
::
2015-09-19 02:20:30 +03:00
++ te-pref :: audience glyph
^- tape
=+ cha=(~(get by nik) lix)
?^ cha ~[u.cha ' ']
2015-11-02 23:04:07 +03:00
?. (lien (~(tap by lix)) ta-dire)
"* "
2015-12-12 00:02:51 +03:00
?: ?=({{$& ^} $~ $~} lix)
2015-09-19 02:20:30 +03:00
": "
2015-11-02 23:04:07 +03:00
"; "
2015-05-07 05:31:54 +03:00
--
::
++ tr :: telegram renderer
|_ $: man/knot
2015-12-20 23:50:45 +03:00
nob/?
who/ship
sen/serial
aud/audience
wen/@da
bou/bouquet
sep/speech
2015-05-07 05:31:54 +03:00
==
2015-11-17 06:29:27 +03:00
++ tr-fact ^- sole-effect :: activate effect
~[%mor [%tan tr-meta] tr-body]
::
2015-05-07 05:31:54 +03:00
++ tr-line ^- tape :: one-line print
2015-10-06 01:56:58 +03:00
=+ txt=(tr-text =(who our.hid))
2015-05-07 05:31:54 +03:00
?: =(~ txt) ""
=+ ^= baw
2015-05-29 22:45:05 +03:00
:: ?: oug
:: ~(te-whom te man tr-pals)
?. nob
(~(sn-curt sn man [who (main who)]) |)
(~(sn-nick sn man [who (main who)]))
2015-10-03 03:07:27 +03:00
(weld baw txt)
2015-05-07 05:31:54 +03:00
::
2015-11-17 06:29:27 +03:00
++ tr-meta ^- tang
2015-10-22 20:34:18 +03:00
=. wen (sub wen (mod wen (div wen ~s0..0001))) :: round
2015-12-21 00:16:39 +03:00
=+ hed=leaf+"{(scow %uv sen)} at {(scow %da wen)}"
2015-10-06 22:23:26 +03:00
=+ =< paz=(turn (~(tap by aud)) .)
2015-12-21 00:16:39 +03:00
|=({a/partner *} leaf+~(ta-full ta man a))
2015-10-06 22:23:26 +03:00
=+ bok=(turn (sort (~(tap in bou)) aor) smyt)
[%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~
::
2015-11-17 06:29:27 +03:00
++ tr-body
|- ^- sole-effect
2015-12-21 00:16:39 +03:00
?+ -.sep tan+[>sep<]~
$exp tan+~[leaf+"# {(trip p.sep)}"]
$lin tan+~[leaf+"{?:(p.sep "" "@ ")}{(trip q.sep)}"]
$non tan+~
$app tan+~[rose+[": " ~ ~]^~[leaf+"[{(trip p.sep)}]" leaf+(trip q.sep)]]
$url url+(crip (earf p.sep))
$mor mor+(turn p.sep |=(speech ^$(sep +<)))
2016-02-26 04:55:19 +03:00
$fat [%mor $(sep q.sep) tan+(tr-rend-tors p.sep) ~]
2016-03-25 01:42:39 +03:00
$api
:- %tan
:_ ~
:+ %rose
[": " ~ ~]
:~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]"
leaf+(trip body.sep)
2016-04-01 03:39:48 +03:00
leaf+(earf url.sep)
2016-03-25 01:42:39 +03:00
==
2015-10-06 22:23:26 +03:00
==
::
++ tr-rend-tors
2015-12-20 23:50:45 +03:00
|= a/torso ^- tang
2015-10-06 22:23:26 +03:00
?- -.a
2015-12-21 00:16:39 +03:00
$name (welp $(a q.a) leaf+"={(trip p.a)}" ~)
2015-12-12 00:02:51 +03:00
$tank +.a
2015-12-21 00:16:39 +03:00
$text (turn (flop +.a) |=(b/cord leaf+(trip b)))
2015-10-06 22:23:26 +03:00
==
2015-10-06 01:56:58 +03:00
::
2015-05-07 05:31:54 +03:00
++ tr-pals
^- (set partner)
%- ~(gas in *(set partner))
2015-12-20 23:50:45 +03:00
(turn (~(tap by aud)) |=({a/partner *} a))
2015-05-07 05:31:54 +03:00
::
2016-02-26 04:55:19 +03:00
++ tr-chow
|= {len/@u txt/tape} ^- tape
2015-06-19 04:47:41 +03:00
?: (gth len (lent txt)) txt
2015-10-06 22:51:20 +03:00
=. txt (scag len txt)
|-
?~ txt txt
?: =(' ' i.txt)
2015-12-12 00:02:51 +03:00
|-(['_' ?.(?=({$' ' *} t.txt) t.txt $(txt t.txt))])
2015-10-06 22:51:20 +03:00
?~ t.txt "…"
[i.txt $(txt t.txt)]
2015-06-19 04:47:41 +03:00
::
2016-02-26 04:55:19 +03:00
++ tr-both
|= {a/tape b/tape} ^- tape
?: (gth (lent a) 62) (tr-chow 64 a)
%+ weld a
(tr-chow (sub 64 (lent a)) " {b}")
::
2015-05-07 05:31:54 +03:00
++ tr-text
2015-12-20 23:50:45 +03:00
|= oug/?
2015-05-07 05:31:54 +03:00
^- tape
2015-12-21 00:16:39 +03:00
?+ -.sep ~&(tr-lost+sep "")
2016-02-26 04:55:19 +03:00
$mor
?~ p.sep ~&(%tr-mor-empty "")
|- ^- tape
?~ t.p.sep ^$(sep i.p.sep)
(tr-both ^$(sep i.p.sep) $(p.sep t.p.sep))
::
2015-12-12 00:02:51 +03:00
$fat
2016-02-26 04:55:19 +03:00
%+ tr-both $(sep q.sep)
2015-06-19 04:47:41 +03:00
?+ -.p.sep "..."
2015-12-12 00:02:51 +03:00
$tank ~(ram re %rose [" " `~] +.p.sep)
2015-06-19 04:47:41 +03:00
==
2015-05-21 03:45:24 +03:00
::
2016-02-26 04:55:19 +03:00
$exp (tr-chow 66 '#' ' ' (trip p.sep))
2015-12-12 00:02:51 +03:00
$url =+ ful=(earf p.sep)
2015-10-06 22:51:20 +03:00
?: (gth 64 (lent ful)) ['/' ' ' ful]
:+ '/' '_'
=+ hok=r.p.p.p.sep
~! hok
=- (swag [a=(sub (max 64 (lent -)) 64) b=64] -)
2015-10-28 03:32:02 +03:00
^- tape
2015-12-29 01:01:44 +03:00
=< ?:(?=($& -.hok) (reel p.hok .) +:(scow %if p.hok))
|=({a/knot b/tape} ?~(b (trip a) (welp b '.' (trip a))))
2015-10-06 22:51:20 +03:00
::
2015-12-12 00:02:51 +03:00
$lin
2015-05-07 05:31:54 +03:00
=+ txt=(trip q.sep)
?: p.sep
2015-11-02 23:04:07 +03:00
=+ pal=tr-pals
=. pal ?: =(who our.hid) pal
(~(del in pal) [%& who (main who)])
(weld ~(te-pref te man pal) txt)
2015-05-07 05:31:54 +03:00
(weld " " txt)
2015-05-12 03:31:37 +03:00
::
2015-12-12 00:02:51 +03:00
$app
2016-02-26 04:55:19 +03:00
(tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}")
2016-03-25 01:42:39 +03:00
::
$api
(tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}")
2015-05-07 05:31:54 +03:00
==
--
::
++ peer :: accept subscription
2015-12-20 23:50:45 +03:00
|= pax/path
2015-12-12 00:02:51 +03:00
^+ [*(list move) +>]
~? !=(src.hid our.hid) [%peer-talk-stranger src.hid]
:: ~& [%talk-peer src.hid ost.hid pax]
2015-12-12 00:02:51 +03:00
?: ?=({$sole *} pax)
?> (team our.hid src.hid)
2015-06-24 23:42:50 +03:00
~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax]
2015-10-02 03:21:26 +03:00
ra-abet:(ra-console:ra src.hid t.pax)
2015-05-28 09:51:32 +03:00
:: ~& [%talk-peer-data ost.hid src.hid pax]
2015-10-02 03:21:26 +03:00
ra-abet:(ra-subscribe:ra src.hid pax)
2015-05-07 05:31:54 +03:00
::
++ poke-talk-command :: accept command
2015-12-20 23:50:45 +03:00
|= cod/command
2015-12-12 00:02:51 +03:00
^+ [*(list move) +>]
2015-06-05 07:14:07 +03:00
:: ~& [%talk-poke-command src.hid cod]
2015-09-02 03:46:05 +03:00
=^ mos +>.$
2015-10-02 03:21:26 +03:00
ra-abet:(ra-apply:ra src.hid cod)
2015-09-02 03:46:05 +03:00
=^ mow +>.$ log-all-to-file
[(welp mos mow) +>.$]
2015-05-07 05:31:54 +03:00
::
++ poke-sole-action :: accept console
2015-12-20 23:50:45 +03:00
|= act/sole-action
2015-10-02 03:21:26 +03:00
ra-abet:(ra-sole:ra act)
2015-05-07 05:31:54 +03:00
::
++ diff-talk-report ::
2015-12-20 23:50:45 +03:00
|= {way/wire rad/report}
2015-09-02 03:46:05 +03:00
^- (quip move +>)
=^ mos +>.$
%+ etch-friend way |= {man/knot cuz/station}
2015-10-02 03:21:26 +03:00
ra-abet:(ra-diff-talk-report:ra man cuz rad)
2015-09-02 03:46:05 +03:00
=^ mow +>.$ log-all-to-file
[(welp mos mow) +>.$]
2015-05-07 05:31:54 +03:00
::
++ coup-repeat ::
2015-12-20 23:50:45 +03:00
|= {way/wire saw/(unit tang)}
%+ etch-repeat [%repeat way] |= {num/@ud src/@p man/knot}
2015-10-02 03:21:26 +03:00
ra-abet:(ra-coup-repeat:ra [num src man] saw)
2015-05-07 05:31:54 +03:00
::
++ etch :: parse wire
2015-12-20 23:50:45 +03:00
|= way/wire
2015-05-07 05:31:54 +03:00
^- weir
?+ -.way !!
2015-12-12 00:02:51 +03:00
$friend
?> ?=({$show @ @ @ $~} t.way)
2015-05-07 05:31:54 +03:00
[%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way]
::
2015-12-12 00:02:51 +03:00
$repeat
?> ?=({@ @ @ $~} t.way)
2015-05-07 05:31:54 +03:00
[%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way]
==
::
++ etch-friend ::
2016-02-04 10:12:23 +03:00
|= {way/wire fun/$-({man/knot cuz/station} {(list move) _.})}
2015-05-07 05:31:54 +03:00
=+ wer=(etch way)
?>(?=($friend -.wer) (fun p.wer q.wer))
2015-05-07 05:31:54 +03:00
::
++ etch-repeat ::
2016-02-04 10:12:23 +03:00
|= {way/wire fun/$-({num/@ud src/@p man/knot} {(list move) _.})}
2015-05-07 05:31:54 +03:00
=+ wer=(etch way)
?>(?=($repeat -.wer) (fun p.wer q.wer r.wer))
2015-05-07 05:31:54 +03:00
::
2015-05-18 05:34:05 +03:00
++ reap-friend ::
2015-12-20 23:50:45 +03:00
|= {way/wire saw/(unit tang)}
2015-05-18 05:34:05 +03:00
^- (quip move +>)
?~ saw [~ +>]
%+ etch-friend [%friend way] |= {man/knot cuz/station}
=. u.saw [>%reap-friend-fail man cuz< u.saw]
%- (slog (flop u.saw))
2015-10-02 03:21:26 +03:00
ra-abet:(ra-quit:ra man cuz)
2015-05-18 05:34:05 +03:00
::
2015-05-07 05:31:54 +03:00
++ quit-friend ::
2015-12-20 23:50:45 +03:00
|= way/wire
%+ etch-friend [%friend way] |= {man/knot cuz/station}
2015-10-02 03:21:26 +03:00
ra-abet:(ra-retry:ra man cuz)
2015-05-07 05:31:54 +03:00
::
++ pull ::
2015-12-20 23:50:45 +03:00
|= pax/path
2015-12-12 00:02:51 +03:00
^+ [*(list move) +>]
2015-11-17 06:29:27 +03:00
:: ~& [%talk-pull src.hid ost.hid pax]
2015-10-02 03:21:26 +03:00
=^ moz +>.$ ra-abet:(ra-cancel:ra src.hid pax)
2015-05-28 09:51:32 +03:00
[moz +>.$(shells (~(del by shells) ost.hid))]
2015-05-07 05:31:54 +03:00
::
2015-09-02 03:46:05 +03:00
++ log-all-to-file
^- (quip move .)
2015-10-27 00:18:01 +03:00
?: & [~ .] :: XXX!!!!
2015-09-02 03:46:05 +03:00
:_ %_ .
log %- ~(urn by log)
|=({man/knot len/@ud} count:(~(got by stories) man))
2015-09-02 03:46:05 +03:00
==
%+ murn (~(tap by log))
|= {man/knot len/@ud}
2015-09-02 03:46:05 +03:00
^- (unit move)
?: (gte len count:(~(got by stories) man))
~
`(log-to-file man)
::
++ log-to-file
|= man/knot
2015-09-02 03:46:05 +03:00
^- move
2015-12-20 23:50:45 +03:00
=+ ^- paf/path
=+ day=(year %*(. (yore now.hid) +.t +:*tarp))
2015-12-21 00:16:39 +03:00
%+ tope [our.hid %home da+now.hid]
/talk-telegrams/(scot %da day)/[man]/talk
2015-09-02 03:46:05 +03:00
=+ grams:(~(got by stories) man)
[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]
::
++ poke-talk-comment
|= {pax/path sup/spur txt/@t} ^- (quip move +>)
ra-abet:(ra-comment:ra pax sup txt)
::
++ poke-talk-fora-post
|= {pax/path sup/spur hed/@t txt/@t} ^- (quip move +>)
ra-abet:(ra-fora-post:ra pax sup hed txt)
::
++ poke-talk-save
|= man/knot
2015-08-27 03:21:12 +03:00
^- (quip move +>)
2015-09-16 01:13:43 +03:00
=+ paf=/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams
=+ grams:(~(got by stories) man)
[[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]~ +>.$]
2015-08-27 03:21:12 +03:00
::
++ poke-talk-load
|= man/knot
2015-08-27 03:21:12 +03:00
=+ ^= grams
2016-01-26 03:47:58 +03:00
.^ (list telegram)
%cx
/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams
2015-09-02 03:46:05 +03:00
==
2015-08-27 03:21:12 +03:00
=+ toy=(~(got by stories) man)
[~ +>.$(stories (~(put by stories) man toy(grams grams, count (lent grams))))]
2015-05-07 05:31:54 +03:00
::
++ poke-talk-log
|= man/knot
2015-10-27 00:18:01 +03:00
~& %poke-log
2015-09-02 03:46:05 +03:00
^- (quip move +>)
:- [(log-to-file man) ~]
+>.$(log (~(put by log) man count:(~(got by stories) man)))
::
++ poke-talk-unlog
|= man/knot
2015-09-15 02:07:47 +03:00
^- (quip move +>)
:- ~
+>.$(log (~(del by log) man))
::
2015-05-07 05:31:54 +03:00
++ prep
2015-12-20 23:50:45 +03:00
|= old/(unit house-any)
^- (quip move ..prep)
2015-05-07 05:31:54 +03:00
?~ old
2015-10-02 03:21:26 +03:00
ra-abet:ra-init:ra
2015-09-02 03:46:05 +03:00
|-
?- -.u.old
2015-12-12 00:02:51 +03:00
$5 [~ ..prep(+<+ u.old)]
$4 =< ^$(-.u.old %5, shells.u.old (~(run by shells.u.old) .))
|=(shell-4 `shell`+<(system [system settings=*(set knot)]))
2015-12-12 00:02:51 +03:00
$3 =< ^$(-.u.old %4, stories.u.old (~(run by stories.u.old) .))
|=(story-3 `story`+<(cabalers [cabalers glyphers=*(set bone)]))
2015-09-02 03:46:05 +03:00
==
2015-05-07 05:31:54 +03:00
--