shrub/ape/talk.hoon

2088 lines
68 KiB
Plaintext
Raw Normal View History

2015-05-19 21:38:23 +03:00
:: :: ::
2015-06-08 22:48:35 +03:00
:::: /hoon/talk/app :: ::
:: :: ::
2015-06-16 22:34:40 +03:00
/? 314
/- talk, sole
2015-06-16 22:34:40 +03:00
/+ talk, sole
2015-06-19 04:47:41 +03:00
/= seed /~ !>(.)
2015-06-16 22:34:40 +03:00
/= talk-doc
/; |=(a=wain (turn a |=(b=cord [%txt "? {(trip b)}"])))
/: /===/pub/doc/talk/help /txt/
!:
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
2015-09-19 02:20:30 +03:00
++ house ,[%3 house-3] :: full state
2015-05-07 05:31:54 +03:00
++ house-any :: app history
$% [%1 house-1] :: 1: talk
2015-09-19 02:20:30 +03:00
[%2 house-2] :: 2: talk
[%3 house-3] :: 3: talk
2015-05-07 05:31:54 +03:00
== ::
++ house-1 ::
$: stories=(map span story) :: conversations
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
== ::
2015-09-02 03:46:05 +03:00
++ house-2 ::
$: stories=(map span story) :: conversations
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 span ,@ud) :: logged to clay
== ::
2015-09-19 02:20:30 +03:00
++ house-3 ::
$: stories=(map span story) :: conversations
general=(set bone) :: meta-subscribe
outbox=(pair ,@ud (map ,@ud thought)) :: urbit outbox
folks=(map ship human) :: human identities
2015-10-06 02:02:15 +03:00
shells=(map bone shell) :: interaction state
2015-09-19 02:20:30 +03:00
log=(map span ,@ud) :: logged to clay
nik=(map (set partner) char) ::
nak=(jug char (set partner)) ::
== ::
2015-05-07 05:31:54 +03:00
++ story :: wire content
$: 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
guests=(map bone river) :: message followers
viewers=(set bone) :: presence followers
owners=(set bone) :: config followers
== ::
++ shell :: console session
$: her=ship :: client identity
man=span :: mailbox
count=@ud :: messages shown
say=sole-share :: console state
active=(unit (set partner)) :: active targets
passive=(set partner) :: passive targets
guests=register :: presence mirror
harbor=(map span (pair posture cord)) :: stations mirror
system=cabal :: config mirror
== ::
++ river (pair point point) :: stream definition
++ point :: stream endpoint
$% [%ud p=@ud] :: by number
[%da p=@da] :: by date
== ::
++ move (pair bone card) :: all actions
++ lime :: diff fruit
$% [%talk-report report] ::
[%sole-effect sole-effect] ::
== ::
++ pear :: poke fruit
$% [%talk-command command] ::
== ::
++ card :: general card
$% [%diff lime] ::
[%info wire @p @tas nori] ::
[%peer wire dock path] ::
[%poke wire dock pear] ::
[%pull wire dock ~] ::
[%pass wire note] ::
[%quit ~] ::
== ::
++ weir :: parsed wire
$% [%repeat p=@ud q=@p r=span] ::
[%friend p=span q=station] ::
== ::
++ work :: interface action
2015-10-06 03:15:48 +03:00
$% [%number p=$|(@ud [@u @ud])] :: relative/absolute
2015-06-16 22:34:40 +03:00
[%help ~] :: print usage info
2015-10-07 00:08:10 +03:00
[%who p=?((set partner) char)] :: presence
2015-09-19 02:20:30 +03:00
[%what p=$|(char (set partner))] :: show bound glyph
[%bind p=char q=(unit (set partner))] ::
2015-05-07 05:31:54 +03:00
[%join p=(set partner)] ::
2015-10-03 03:07:27 +03:00
[%say p=(list speech)] ::
[%eval p=cord q=twig] ::
2015-09-19 02:20:30 +03:00
[%invite p=span q=(list partner)] :: whitelist add
[%banish p=span q=(list partner)] :: blacklist add
[%block p=span q=(list partner)] :: blacklist add
[%author p=span q=(list partner)] :: whitelist add
2015-10-08 21:01:40 +03:00
[%nick p=(unit ship) q=(unit cord)] ::
[%target p=where q=(unit work)] :: set active targets
2015-05-07 05:31:54 +03:00
:: [%destroy p=span] ::
[%create p=posture q=span r=cord] ::
[%probe p=station] ::
== ::
++ where ?((set partner) char) :: audience/shorthand
2015-05-07 05:31:54 +03:00
++ sigh :: assemble label
|= [len=@ud pre=tape yiz=cord]
^- 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
2015-05-07 05:31:54 +03:00
--
2015-05-28 06:48:25 +03:00
|_ [hid=bowl house]
2015-05-07 05:31:54 +03:00
++ ra :: per transaction
2015-10-02 03:21:26 +03:00
|_ moves=(list move)
2015-05-07 05:31:54 +03:00
++ sh :: per console
|_ $: coz=(list command) :: talk actions
she=shell
==
2015-05-07 05:31:54 +03:00
++ sh-scad :: command parser
=< work
|%
++ expr :: [cord twig]
|= 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
|= a=coin
?. ?=([%$ %dr @] a) ~
(some `@dr`+>.a)
nuck:so
::
++ ship ;~(pfix sig fed:ag) :: ship
++ shiz :: ship set
%+ cook
|=(a=(list ^ship) (~(gas in *(set ^ship)) a))
(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
(cold [our.hid man.she] tis)
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
|= [a=@p b=(unit term)]
[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)
==
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'))) dem:ag)
(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-10-03 03:07:27 +03:00
++ text (cook crip (star (shim ' ' '~'))) :: bullets separating
2015-09-19 02:20:30 +03:00
++ glyph (mask "/\\\{(<!?{(zing glyphs)}") :: station postfix
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
==
::
2015-10-07 00:08:10 +03:00
;~ plug (perk %who ~)
;~ pose
;~(pfix ace parz)
;~(pfix ace glyph)
(easy ~)
==
==
::
;~(plug (perk %bind ~) ;~(pfix ace glyph) (punt ;~(pfix ace parz)))
2015-10-02 22:22:03 +03:00
;~((glue ace) (perk %join ~) parz)
;~((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
(cook some ;~(pfix ace ship))
(easy ~)
==
;~ pose
(cook some ;~(pfix ace nick))
(easy ~)
==
==
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)
=+ (punt ;~(pfix ace message))
2015-10-06 03:15:48 +03:00
(stag %target ;~(plug ;~(pose parz glyph) -))
(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
|= cod=command
^+ +>
?- -.cod
%design
?~ 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))
==
::
++ sh-fact :: send console effect
|= fec=sole-effect
^+ +>
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
|= pax=path
^+ +>
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
%_ .
+>
2015-10-02 03:21:26 +03:00
(ra-subscribe:(ra-subscribe her.she ~) her.she [%afx 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))
?~ 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-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
|= lix=(set partner)
^+ +>
=+ act=?~(lix ~ `(sh-pare lix))
?: =(active.she act) +>.$
sh-prod(active.she act)
::
++ sh-pare :: adjust target list
|= paz=(set partner)
?: (sh-pear paz) paz
(~(put in paz) [%& our.hid man.she])
::
++ sh-pear :: hearback
|= paz=(set partner)
?~ paz |
?| $(paz l.paz)
$(paz r.paz)
(~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz)
==
::
++ sh-pass :: passive from aud
|= aud=audience
%- sh-poss
%- ~(gas in *(set partner))
(turn (~(tap by aud)) |=([a=partner *] a))
::
++ sh-poss :: passive update
|= 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
|= tay=partner
^+ +>
?. ?=(%& -.tay) +>
=+ sib=(~(get by ham.system.she) `station`p.tay)
?. |(?=(~ sib) !?=(%white p.cordon.u.sib))
+>.$
(sh-poss [tay ~ ~])
::
++ sh-rend :: print on one line
|= gam=telegram
=+ lin=~(tr-line tr man.she gam)
(sh-pass:(sh-fact %txt lin) q.q.gam)
2015-05-07 05:31:54 +03:00
::
++ sh-numb :: print msg number
|= num=@ud
^+ +>
=+ bun=(scow %ud num)
:: =+ pad=(sub 36 (lent bun))
2015-05-28 06:54:20 +03:00
:: =+ now=`@da`(dis now.hid 0xffff.ffff.ffff.ffff.0000.0000.0000.0000)
2015-05-07 05:31:54 +03:00
%+ sh-fact %txt
(runt [(sub 15 (lent bun)) '-'] "[{bun}]")
::
++ sh-repo-house-diff
|= [one=shelf two=shelf]
=| $= ret
$: old=(list (pair span (pair posture cord)))
new=(list (pair span (pair posture cord)))
cha=(list (pair span (pair posture cord)))
==
^+ 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
|= [one=atlas two=atlas]
=| $= ret
$: old=(list (pair ship status))
new=(list (pair ship status))
cha=(list (pair ship status))
==
^+ 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
|= [one=(map station config) two=(map station config)]
=| $= ret
$: old=(list (pair station config))
new=(list (pair station config))
cha=(list (pair station config))
==
^+ 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-rogue-diff
|= [one=(map partner atlas) two=(map partner atlas)]
=| $= ret
$: old=(list (pair partner atlas))
new=(list (pair partner atlas))
cha=(list (pair partner atlas))
==
^+ 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
|= [one=(set partner) two=(set partner)]
=| $= ret
$: old=(list partner)
new=(list partner)
==
^+ 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
|= [one=(set ship) two=(set ship)]
=| $= ret
$: old=(list ship)
new=(list ship)
==
^+ 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
|= a=posture ^- tape
?- a
%black "channel"
%brown "mailbox"
%white "village"
%green "journal"
==
::
++ sh-repo-config-exceptions
|= [pre=tape por=posture old=(list ship) new=(list ship)]
=+ out=?:(?=(?(%black %brown) por) "try " "cut ")
=+ inn=?:(?=(?(%black %brown) por) "ban " "add ")
=. +>.$
|- ^+ +>.^$
?~ 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
|= [pre=tape old=(list partner) new=(list partner)]
^+ +>
=. +>.$
|- ^+ +>.^$
?~ 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
|= [pre=tape laz=config loc=config]
^+ +>
=. +>.$
?: =(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
|= $: laz=(map station config)
old=(list (pair station config))
new=(list (pair station config))
cha=(list (pair station config))
==
=. +>.$
|- ^+ +>.^$
?~ 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
|= bal=cabal
^+ +>
=+ 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 span (pair posture cord))
^+ +>
=+ 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
|= txt=tape
^+ +>
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
|= saz=status
^- tape
['%' (trip p.saz)]
::
++ sh-repo-group-diff-here :: print atlas diff
|= $: pre=tape
$= cul
$: old=(list (pair ship status))
new=(list (pair ship status))
cha=(list (pair ship status))
==
==
=. +>.$
|- ^+ +>.^$
?~ 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
|= loc=atlas
^+ +>
=+ cul=(sh-repo-atlas-diff p.guests.she loc)
=. p.guests.she loc
(sh-repo-group-diff-here "" cul)
::
++ sh-repo-group-there :: update foreign
|= yid=(map partner atlas)
=+ day=(sh-repo-rogue-diff q.guests.she yid)
=+ dun=q.guests.she
=. q.guests.she yid
=. +>.$
|- ^+ +>.^$
?~ 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
|= ges=register
^+ +>
=. +> (sh-repo-group-here p.ges)
=. +> (sh-repo-group-there q.ges)
+>
::
++ sh-repo-gram
|= [num=@ud gam=telegram]
^+ +>
?: =(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
|= [num=@ud gaz=(list telegram)]
^+ +>
?~ gaz +>
$(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz))
::
++ sh-repo :: apply report
|= rad=report
^+ +>
:: ~& [%sh-repo rad]
?- -.rad
%cabal (sh-repo-cabal +.rad)
%grams (sh-repo-grams +.rad)
%group (sh-repo-group +.rad)
%house (sh-repo-house +.rad)
==
::
++ sh-sane-chat :: sanitize chatter
|= buf=(list ,@c)
^- (list sole-edit)
2015-10-03 03:07:27 +03:00
=+ [inx=0 sap=0 con=0]
|^ run
++ fix |=(cha=@ [%mor [%del inx] [%ins inx `@c`cha] ~])
++ run ^- (list sole-edit)
?~ buf ~
?: =(i.buf (turf '•'))
2015-10-06 01:56:58 +03:00
?~ con [[%del inx] run(buf t.buf)]
2015-10-03 03:07:27 +03:00
run(con 0, inx +(inx), buf t.buf)
?: =(64 con)
=+ dif=(sub inx sap)
?: (lth dif 64)
[(fix(inx sap) (turf '•')) run(con dif)]
[[%ins inx (turf '•')] run(con 0, inx +(inx))]
?: =(i.buf ' ')
run(sap inx, inx +(inx), con +(con), buf t.buf)
=+ lit=run(inx +(inx), con +(con), buf t.buf)
?: |((lth i.buf 32) (gth i.buf 126))
[(fix '?') lit]
?: &((gte i.buf 'A') (lte i.buf 'Z'))
[(fix (add 32 i.buf)) lit]
lit
--
2015-05-07 05:31:54 +03:00
::
++ sh-sane :: sanitize input
|= [inv=sole-edit buf=(list ,@c)]
^- (list sole-edit)
=+ res=(rose (tufa buf) sh-scad)
2015-10-03 03:07:27 +03:00
?: ?=(| -.res) [inv ~]
=+ wok=`(unit work)`p.res
|- ^- (list sole-edit)
?~ wok ~
?+ -.u.wok ~
%target $(wok q.u.wok)
%say |- :: XX per line
?~ p.u.wok ~
?: ?=(%lin -.i.p.u.wok)
(sh-sane-chat buf)
$(p.u.wok t.p.u.wok)
==
2015-05-07 05:31:54 +03:00
::
++ sh-slug :: edit to sanity
|= lit=(list sole-edit)
^+ +>
?~ lit +>
=^ lic say.she
2015-09-02 01:20:17 +03:00
(~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit]))
2015-05-07 05:31:54 +03:00
(sh-fact [%mor [%det lic] ~])
::
++ sh-stir :: apply edit
|= cal=sole-change
^+ +>
2015-09-02 01:20:17 +03:00
=^ inv say.she (~(transceive sole say.she) cal)
2015-05-07 05:31:54 +03:00
=+ lit=(sh-sane inv buf.say.she)
?~ lit
+>.$
(sh-slug lit)
::
++ sh-lame :: send error
|= txt=tape
(sh-fact [%txt txt])
::
++ sh-whom :: current audience
^- audience
%- ~(gas by *audience)
%+ turn (~(tap in ?~(active.she passive.she u.active.she)))
|=(a=partner [a *envelope %pending])
::
++ sh-tell :: add command
|= cod=command
%_(+> coz [cod coz])
::
2015-06-19 04:47:41 +03:00
++ sh-twig-head ^- vase :: eval data
2015-10-06 01:17:23 +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
|= job=work
^+ +>
=+ roy=(~(got by stories) man.she)
=< work
|%
++ work
?- -.job
%number (number +.job)
%join (join +.job)
2015-06-19 04:47:41 +03:00
%eval (eval +.job)
2015-10-07 00:08:10 +03:00
%who (who +.job)
2015-09-19 02:20:30 +03:00
%what (what +.job)
%bind (bind +.job)
2015-05-07 05:31:54 +03:00
%invite (invite +.job)
%banish (banish +.job)
2015-09-19 02:20:30 +03:00
%author (author +.job)
%block (block +.job)
2015-05-07 05:31:54 +03:00
%create (create +.job)
2015-10-08 21:01:40 +03:00
%nick (nick +.job)
2015-05-07 05:31:54 +03:00
%target (target +.job)
%probe (probe +.job)
2015-06-16 22:34:40 +03:00
%help (help)
2015-05-07 05:31:54 +03:00
%say (say +.job)
==
::
++ activate :: from %number
|= gam=telegram
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-10-06 01:56:58 +03:00
=+ tay=~(. tr man.she gam)
2015-10-06 22:23:26 +03:00
=. ..sh-work (sh-fact %tan tr-tang: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-06-16 22:34:40 +03:00
++ help |=(~ (sh-fact %mor talk-doc)) :: %help
2015-10-08 20:26:42 +03:00
++ glyph
2015-09-30 02:47:30 +03:00
|= idx=@
=< cha.ole
%+ reel glyphs
|= [all=tape ole=[cha=char num=@]]
=+ 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-05-07 05:31:54 +03:00
++ join :: %join
|= lix=(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) lix)
?^ - (sh-note "has glyph {<u>}")
2015-10-08 20:26:42 +03:00
=+ cha=(glyph (mug lix))
2015-09-30 02:47:30 +03:00
=: nik (~(put by nik) lix cha)
nak (~(put ju nak) cha lix)
==
(sh-note "new glyph {<cha>}")
2015-05-07 05:31:54 +03:00
=+ loc=loc.system.she
%^ sh-tell %design man.she
:- ~
=+ tal=(~(tap in lix))
%_ loc
sources
|- ^- (set partner)
?~ tal sources.loc
?: (~(has in sources.loc) i.tal)
$(tal t.tal, sources.loc (~(del in sources.loc) i.tal))
$(tal t.tal, sources.loc (~(put in sources.loc) i.tal))
==
::
2015-09-19 02:20:30 +03:00
++ what :: %what
|= qur=$|(char (set partner)) ^+ ..sh-work
?^ 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-09-30 02:47:30 +03:00
|=(a=(set partner) [%txt <a>]) :: XX ~(te-whom te man.she a)
2015-09-19 02:20:30 +03:00
::
2015-10-07 00:08:10 +03:00
++ who :: %who
|= lix=?((set partner) char) ^+ ..sh-work
=< ?~(lix (. lix) ?^(lix (. lix) (fetch-nik lix .)))
|= pan=(set partner)
=< (sh-fact %mor (murn (sort (~(tap by q.guests.she)) aor) .))
|= [pon=partner alt=atlas] ^- (unit sole-effect)
?. |(=(~ pan) (~(has in pan) pon)) ~
=- `[%tan rose/[", " `~]^- leaf/~(ta-full ta man.she pon) ~]
=< (murn (sort (~(tap by alt)) aor) .)
|= [a=ship b=presence c=human] ^- (unit tank) :: XX names
?- b
%gone ~
%hear `>a<
%talk `>a< :: XX difference
==
::
2015-09-19 02:20:30 +03:00
++ bind :: %bind
|= [cha=char pan=(unit (set partner))] ^+ ..sh-work
~& bind/[cha pan nik nak]
?~ pan $(pan [~ ?~(active.she passive.she u.active.she)])
=+ ole=(~(get by nik) u.pan)
?: =(ole [~ cha]) ..sh-work
=. nak ?~(ole nak (~(del ju nak) u.ole u.pan))
=: nak (~(put ju nak) cha u.pan)
nik (~(put by nik) u.pan cha)
==
..sh-work
::
2015-05-07 05:31:54 +03:00
++ invite :: %invite
|= [nom=span 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=span tal=(list partner)]
^+ ..sh-work
!!
::
++ author :: %author
|= [nom=span tal=(list partner)]
^+ ..sh-work
!!
::
2015-05-07 05:31:54 +03:00
++ banish :: %banish
|= [nom=span 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=span 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=span
^- (list ship)
%+ murn (~(tap by folks))
|= [p=ship q=human]
?~ hand.q ~
?. =(u.hand.q nym) ~
[~ u=p]
::
2015-10-08 23:07:08 +03:00
++ nick :: %nick
2015-10-08 21:01:40 +03:00
|= [her=(unit ship) nym=(unit cord)]
2015-10-08 20:26:42 +03:00
^+ ..sh-work
2015-10-08 23:07:08 +03:00
?: ?=([~ ~] +<)
2015-10-08 23:26:16 +03:00
%+ sh-fact %mor
%+ turn (~(tap by folks))
|= [p=ship q=human]
:- %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)
|= p=ship
[%txt "{<p>}: {<u.nym>}"]
2015-10-08 23:07:08 +03:00
%= ..sh-work
folks (~(put by folks) u.her [true=~ hand=nym])
==
2015-10-08 20:26:42 +03:00
::
2015-05-07 05:31:54 +03:00
++ target :: %target
|= [lix=?((set partner) char) woe=(unit ^work)]
=- ?~(woe end work(job u.woe, ..sh-pact end))
2015-10-07 00:08:10 +03:00
^- end=_..sh-work
?~ lix (sh-pact lix)
?^ lix (sh-pact lix)
(fetch-nik lix sh-pact)
::
++ fetch-nik
|= [cha=char sh-fun=$+((set partner) _..sh-work)]
=+ lax=(~(get ju nak) cha)
?: =(~ lax) (sh-lame "unknown {<cha>}")
?: ?=([* ~ ~] lax) (sh-fun n.lax)
|- ^- sh-fun
2015-10-02 22:22:03 +03:00
?~ grams.roy
2015-10-07 00:08:10 +03:00
(sh-lame:(what cha) "ambiguous {<cha>}")
2015-10-02 22:22:03 +03:00
=+ pan=(sa (turn :_(head (~(tap by q.q.i.grams.roy)))))
?: (~(has in lax) pan)
2015-10-07 00:08:10 +03:00
(sh-fun pan)
2015-10-02 22:22:03 +03:00
$(grams.roy t.grams.roy)
2015-05-07 05:31:54 +03:00
::
++ number :: %number
2015-10-06 03:15:48 +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)
=+ msg=(deli 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
|= [max=@ud nul=@u fin=@ud] ^- @ud
=+ 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
|= 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
|= [txt=cord exe=twig]
2015-10-06 22:23:26 +03:00
=> |.([(sell (slap (slop sh-twig-head seed) exe))]~)
=+ tan=p:(mule .)
(say [%fat tank/tan exp/txt] ~)
2015-05-07 05:31:54 +03:00
::
++ say :: publish
2015-10-03 03:07:27 +03:00
|= sep=(list speech)
2015-06-16 22:34:40 +03:00
^+ ..sh-work
2015-10-03 03:07:27 +03:00
?~ sep ..sh-work
2015-06-16 22:34:40 +03:00
=^ sir ..sh-work sh-uniq
2015-10-03 03:07:27 +03:00
%_ $
sep t.sep
2015-05-07 05:31:54 +03:00
coz :_ coz
2015-10-03 03:07:27 +03:00
[%publish [[sir sh-whom [now.hid ~ i.sep]] ~]]
2015-05-07 05:31:54 +03:00
==
--
::
++ sh-done :: apply result
=+ lit=(sh-sane [%nop ~] buf.say.she)
?^ lit
(sh-slug lit)
=+ jub=(rust (tufa buf.say.she) sh-scad)
2015-05-07 05:31:54 +03:00
?~ jub (sh-fact %bel ~)
=. +> (sh-work u.jub)
=+ 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]
?. ?=([%';' *] buf) ~
:_ ~
[%txt (weld "----------------| " (tufa buf))]
==
::
++ sh-sole :: apply edit
|= act=sole-action
^+ +>
?- -.act
%det (sh-stir +.act)
2015-10-07 21:58:17 +03:00
%clr (sh-pact ~)
2015-05-07 05:31:54 +03:00
%ret sh-done
==
::
++ sh-uniq
^- [serial _.]
[(shaf %serial eny.hid) .(eny.hid (shax eny.hid))]
--
++ ra-abed :: resolve core
^- [(list move) _+>]
:_ +>
=+ ^= 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-05-07 05:31:54 +03:00
?=([%diff %sole-effect *] q.i.moves)
==
[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)
?=([%diff %talk-report *] q.i.moves)
==
[[i.moves p.mor] q.mor]
[p.mor [[p.i.moves +>.q.i.moves] q.mor]]
=. moves p.rey
?: =(q.rey ~) +
=. q.rey (flop q.rey)
|- ^+ +>
?~ q.rey ra-axel
2015-10-02 03:21:26 +03:00
$(q.rey t.q.rey, +> (ra-back(ost.hid p.i.q.rey) q.i.q.rey))
2015-05-07 05:31:54 +03:00
::
++ ra-back
|= rad=report
^+ +>
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
|= act=sole-action
^+ +>
2015-10-02 03:21:26 +03:00
=+ shu=(~(get by shells) ost.hid)
2015-05-07 05:31:54 +03:00
?~ shu
2015-10-02 03:21:26 +03:00
~& [%ra-console-broken ost.hid]
2015-05-07 05:31:54 +03:00
+>.$
sh-abet:(~(sh-sole sh ~ u.shu) act)
::
2015-05-07 05:31:54 +03:00
++ ra-emil :: ra-emit move list
|= mol=(list move)
%_(+> moves (welp (flop mol) moves))
::
++ ra-emit :: emit a move
|= mov=move
%_(+> moves [mov moves])
::
++ ra-evil :: emit error
|= 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
|= 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 span (pair posture cord)))
%+ turn (~(tap by stories))
|=([a=span b=story] [a p.cordon.shape.b caption.shape.b])
::
++ ra-homes :: update partners
=+ gel=general
|- ^+ +>
?~ gel +>
=. +> $(gel l.gel)
=. +> $(gel r.gel)
(ra-house n.gel)
::
++ ra-init :: initialize talk
%+ ra-apply our.hid
:+ %design (main our.hid)
:- ~ :- ~
:- 'default home'
[%brown ~]
::
++ ra-apply :: apply command
|= [her=ship cod=command]
^+ +>
?- -.cod
%design
?. =(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-05-18 05:34:05 +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=span con=config]
^+ +>
=+ :- neu=(~(has by stories) man)
pur=(fall (~(get by stories) man) *story)
=. +>.$ pa-abet:(~(pa-reform pa man pur) con)
?:(neu +>.$ ra-homes)
::
++ ra-know :: story monad
|= man=span
|* fun=$+(_pa _+>+>)
^+ +>+>
=+ 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=span cuz=station rad=report]
%- (ra-know man) |= par=_pa =< pa-abet
(pa-diff-talk-report:par cuz rad)
::
++ ra-quit :: subscription quit
|= [man=span cuz=station]
%- (ra-know man) |= par=_pa =< pa-abet
(pa-quit:par %& cuz)
::
2015-05-18 05:34:05 +03:00
++ ra-retry :: subscription resend
|= [man=span cuz=station]
%- (ra-know man) |= par=_pa =< pa-abet
(pa-acquire:par [%& cuz]~)
::
2015-05-07 05:31:54 +03:00
++ ra-coup-repeat ::
|= [[num=@ud her=@p man=span] saw=(unit tang)]
(ra-repeat num [%& her man] saw)
::
++ ra-repeat :: remove from outbox
|= [num=@ud pan=partner saw=(unit tang)]
=+ 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-05-18 05:34:05 +03:00
|= [src=ship pax=path]
^+ +>
?. ?=([@ @ *] pax)
2015-10-02 03:21:26 +03:00
+>(general (~(del in general) ost.hid))
2015-05-18 05:34:05 +03:00
%- (ra-know i.t.pax) |= par=_pa =< pa-abet
(pa-notify:pa-cancel:par src %gone *human)
2015-05-07 05:31:54 +03:00
::
++ ra-human :: look up person
|= her=ship
^- [human _+>]
=^ 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
|= [her=ship pax=path]
^+ +>
=+ man=`span`?~(pax (main her) ?>(?=(~ t.pax) i.pax))
=+ ^= she ^- shell
[her man 0 *sole-share ~ [[%& our.hid man] ~ ~] [~ ~] ~ *cabal]
sh-abet:~(sh-peer sh ~ she)
::
++ ra-subscribe :: listen to
|= [her=ship pax=path]
^+ +>
2015-10-02 03:21:26 +03:00
:: ~& [%ra-subscribe ost.hid her pax]
2015-05-07 05:31:54 +03:00
?: ?=(~ pax)
2015-10-02 03:21:26 +03:00
(ra-house(general (~(put in general) ost.hid)) ost.hid)
2015-05-07 05:31:54 +03:00
?. ?=([@ @ *] pax)
(ra-evil %talk-bad-path)
=+ ^= vab ^- (set ,@tas)
=| vab=(set ,@tas)
|- ^+ vab
?: =(0 i.pax) vab
$(i.pax (rsh 3 1 i.pax), vab (~(put in vab) (end 3 1 i.pax)))
=+ 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)
2015-06-09 18:23:40 +03:00
=^ who +>.$ (ra-human her)
2015-05-07 05:31:54 +03:00
=. soy ?.((~(has in vab) %a) soy (pa-watch:soy her))
=. soy ?.((~(has in vab) %x) soy (pa-master:soy her))
2015-06-09 18:23:40 +03:00
=. soy (pa-notify:soy her %hear who)
2015-05-07 05:31:54 +03:00
=. soy ?.((~(has in vab) %f) soy (pa-listen:soy her t.t.pax))
2015-06-09 18:23:40 +03:00
pa-abet:soy
2015-05-07 05:31:54 +03:00
::
++ ra-think :: publish/review
|= [pub=? her=ship tiz=(list thought)]
^+ +>
?~ tiz +>
$(tiz t.tiz, +> (ra-consume pub her i.tiz))
::
++ ra-normal :: normalize
|= tip=thought
^- thought
?. ?=([%lin *] r.r.tip) tip
%_ 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))
|= a=@c
?: &((gte a 'A') (lte a 'Z'))
(add a 32)
?: |((lth a 32) (gth a 126))
`@`'?'
a
==
::
++ ra-consume :: consume thought
|= [pub=? her=ship tip=thought]
=. 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
|= [pub=? her=ship tay=partner tip=thought]
^+ +>
:: ~& [%ra-conduct pub her tay]
?- -.tay
%& ?: pub
=. 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)
%| !!
==
::
++ ra-record :: add to story
|= [man=span gam=telegram]
%- (ra-know man) |= par=_pa =< pa-abet
(pa-learn:par gam)
::
++ ra-transmit :: send to neighbor
|= [cuz=station tip=thought]
^+ +>
=. +>
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=span
story
==
++ pa-abet
^+ +>
+>(stories (~(put by stories) man `story`+<+))
::
++ pa-admire :: accept from
|= her=ship
^- ?
::?- -.cordon.shape
:: %& (~(has in p.cordon.shape) her)
:: %| !(~(has in p.cordon.shape) her)
::==
&
::
++ pa-watch :: watch presence
|= her=ship
?. (pa-admire her)
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [%quit ~]~)
=. viewers (~(put in viewers) ost.hid)
(pa-display ost.hid ~ ~)
2015-05-07 05:31:54 +03:00
::
++ pa-master :: hear config
|= her=ship
?. (pa-admire her)
~& [%pa-admire-not her]
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [%quit ~]~)
=. owners (~(put in owners) ost.hid)
2015-05-07 05:31:54 +03:00
:: ~& [%pa-master her man shape]
2015-10-02 03:21:26 +03:00
(pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~])
2015-05-07 05:31:54 +03:00
::
++ pa-display :: update presence
|= vew=(set bone)
=+ ^= reg
:_ remotes
|- ^- atlas
?~ locals ~
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
:: ~& [%pa-display man reg]
|- ^+ +>.^$
?~ vew +>.^$
=. +>.^$ $(vew l.vew)
=. +>.^$ $(vew r.vew)
(pa-sauce n.vew [[%diff %talk-report %group reg] ~])
::
++ pa-monitor :: update config
=+ owe=owners
|- ^+ +>
?~ owe +>
=. +> $(owe l.owe)
=. +> $(owe r.owe)
:: ~& [%pa-monitor man shape]
(pa-sauce n.owe [[%diff %talk-report %cabal shape mirrors] ~])
::
++ pa-cabal
|= [cuz=station con=config ham=(map station config)]
^+ +>
=+ old=mirrors
=. mirrors (~(put by mirrors) cuz con)
?: =(mirrors old)
+>.$
pa-monitor
::
++ pa-diff-talk-report :: subscribed update
|= [cuz=station rad=report]
^+ +>
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] !!)
%cabal (pa-cabal cuz +.rad)
%group (pa-remind [%& cuz] +.rad)
2015-10-06 01:17:23 +03:00
%grams =. q.+.rad
?. ?=(%pawn (clan our.hid)) q.+.rad
?. (gth (lent q.+.rad) 200) q.+.rad
(slag (sub (lent q.+.rad) 200) q.+.rad)
(pa-lesson q.+.rad)
2015-05-07 05:31:54 +03:00
==
::
++ pa-quit :: stop subscription
|= tay=partner
pa-monitor(sources.shape (~(del in sources.shape) tay))
::
++ pa-sauce :: send backward
|= [ost=bone cub=(list card)]
%_ +>.$
moves
(welp (flop (turn cub |=(a=card [ost a]))) moves)
==
::
++ pa-abjure :: unsubscribe move
|= tal=(list partner)
%+ pa-sauce 0
%- zing
%+ turn tal
|= tay=partner
^- (list card)
?- -.tay
%| ~& tweet-abjure/p.p.tay
!!
::
%& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]]
:_ ~
:* %pull
/friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[p.p.tay %talk]
~
==
==
::
++ pa-acquire :: subscribe to
|= tal=(list partner)
%+ pa-sauce 0
%- zing
%+ turn tal
|= tay=partner
^- (list card)
=+ num=(fall (~(get by sequence) tay) 0)
?- -.tay
%| !!
%& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]]
:_ ~
:* %peer
/friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[p.p.tay %talk]
/afx/[q.p.tay]/(scot %ud num)
==
==
::
++ pa-reform :: reconfigure, ugly
|= cof=config
=+ ^= dif ^- (pair (list partner) (list partner))
=+ old=`(list partner)`(~(tap in sources.shape) ~)
=+ new=`(list partner)`(~(tap in sources.cof) ~)
:- (skip new |=(a=partner (~(has in sources.shape) a)))
(skip old |=(a=partner (~(has in sources.cof) a)))
=. +>.$ (pa-acquire p.dif)
=. +>.$ (pa-abjure q.dif)
=. shape cof
pa-monitor
::
++ pa-cancel :: unsubscribe from
2015-10-02 03:21:26 +03:00
~& [%pa-cancel ost.hid]
2015-05-07 05:31:54 +03:00
%_ .
2015-10-02 03:21:26 +03:00
guests (~(del by guests) ost.hid)
viewers (~(del in viewers) ost.hid)
owners (~(del in owners) ost.hid)
2015-05-07 05:31:54 +03:00
==
::
++ pa-notify :: local presence
|= [her=ship saz=status]
^+ +>
=+ ^= 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-display(locals nol) viewers)
::
++ pa-remind :: remote presence
|= [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-display viewers)
::
++ pa-start :: start stream
|= riv=river
^+ +>
=- :: ~& [%pa-start riv lab]
2015-10-02 03:21:26 +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 ~] ~])
+>.$(guests (~(put by guests) ost.hid riv))
2015-05-07 05:31:54 +03:00
^= lab
=+ [end=count gaz=grams dun=| zeg=*(list telegram)]
|- ^- (trel ,? ,@ud (list telegram))
?~ gaz [dun end zeg]
?: ?- -.q.riv :: after the end
%ud (lte p.q.riv end)
%da (lte p.q.riv p.r.q.i.gaz)
==
$(end (dec end), gaz t.gaz)
?: ?- -.p.riv :: before the start
%ud (lth end p.p.riv)
%da (lth p.r.q.i.gaz p.p.riv)
==
[dun end zeg]
$(end (dec end), gaz t.gaz, zeg [i.gaz zeg])
::
++ pa-listen :: subscribe
|= [her=ship pax=path]
^+ +>
?. (pa-admire her)
~& [%pa-listen-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)
?: ?=(~ pax)
2015-06-09 01:17:47 +03:00
`[[%ud ?:((lth count 64) 0 (sub count 64))] [%da (dec (bex 128))]]
2015-05-07 05:31:54 +03:00
?: ?=([@ ~] pax)
=+ say=(slay i.pax)
?. ?=([~ %$ ?(%ud %da) @] say) ~
`[(point +>.say) [%da (dec (bex 128))]]
?. ?=([@ @ ~] pax) ~
=+ [say=(slay i.pax) den=(slay i.t.pax)]
?. ?=([~ %$ ?(%ud %da) @] say) ~
?. ?=([~ %$ ?(%ud %da) @] den) ~
`[(point +>.say) (point +>.den)]
:: ~& [%pa-listen her pax ruv]
?~ ruv
~& [%pa-listen-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 guests
|= [num=@ud gam=telegram]
^+ +>
=+ ^= moy
|- ^- (pair (list bone) (list move))
?~ guests [~ ~]
:: ~& [%pa-refresh num n.guests]
=+ lef=$(guests l.guests)
=+ rit=$(guests r.guests)
=+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)]
?: ?- -.q.q.n.guests :: after the end
%ud (lte p.q.q.n.guests num)
%da (lte p.q.q.n.guests p.r.q.gam)
==
[[p.n.guests p.old] [[p.n.guests %quit ~] q.old]]
?: ?- -.p.q.n.guests :: before the start
%ud (gth p.p.q.n.guests num)
%da (gth p.p.q.n.guests p.r.q.gam)
==
old
:- p.old
[[p.n.guests %diff %talk-report %grams num gam ~] q.old]
=. moves (welp q.moy moves)
|- ^+ +>.^$
?~ p.moy +>.^$
$(p.moy t.p.moy, guests (~(del by guests) i.p.moy))
::
++ pa-lesson :: learn multiple
|= gaz=(list telegram)
^+ +>
?~ gaz +>
$(gaz t.gaz, +> (pa-learn i.gaz))
::
++ pa-learn :: learn message
|= gam=telegram
^+ +>
?. (pa-admire p.gam)
~& %pa-admire-rejected
+>.$
=. q.q.gam
=+ ole=(~(get by q.q.gam) [%& our.hid man])
?~ ole q.q.gam
(~(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
|= gam=telegram
^+ +>
%+ %= pa-refresh
grams [gam grams]
count +(count)
known (~(put by known) p.q.gam count)
==
count
gam
::
++ pa-revise :: revise existing
|= [num=@ud gam=telegram]
=+ way=(sub count num)
=. grams (welp (scag (dec way) grams) [gam (slag way grams)])
(pa-refresh num gam)
--
--
::
++ sn :: station render core
|_ [man=span one=station]
++ sn-best :: best to show
|= two=station
^- ?
?: =(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
|= mup=?
^- tape
=+ rac=(clan p.one)
=+ raw=(scow %p p.one)
=. raw ?.(mup raw ['*' (slag 2 raw)])
?- rac
%czar (weld " " raw)
%king (weld " " raw)
%duke raw
2015-10-12 22:53:52 +03:00
%earl ;: welp
(scag 1 raw)
(scag 6 (slag 15 raw))
"^"
(scag 6 (slag 22 raw))
==
2015-05-07 05:31:54 +03:00
%pawn :(welp (scag 7 raw) "_" (scag 6 (slag 51 raw)))
==
::
++ sn-phat :: render accurately
^- tape
?: =(p.one our.hid)
?: =(q.one man)
"="
['%' (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=span one=partner]
++ ta-beat :: more relevant
|= two=partner ^- ?
?- -.one
%&
?- -.two
%| %&
%& (~(sn-best sn man p.one) p.two)
==
::
%|
?- -.two
%& %|
%| ?: =(-.p.two -.p.one)
(lth (mug +.p.one) (mug +.p.two))
(lth -.p.two -.p.one)
==
==
++ ta-best :: most relevant
2015-05-15 02:27: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
|= moy=(unit ,?)
^- 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)
::
%|
=+ ^= pre ^- tape
?- -.p.one
%twitter "@t:"
==
?~ moy
(weld pre (trip p.p.one))
=. pre ?.(=(& u.moy) pre ['*' pre])
(sigh 14 pre p.p.one)
==
--
::
++ te :: audience renderer
|_ [man=span lix=(set partner)]
++ 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-09-19 02:20:30 +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))
|= [a=partner b=partner]
(~(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
::
++ te-pref :: audience glyph
^- tape
=+ cha=(~(get by nik) lix)
?^ cha ~[u.cha ' ']
?. ?=([[& ^] ~ ~] lix) "* "
=+ sta=p.n.lix
2015-09-30 02:47:30 +03:00
=+ sot=(~(get by stories) q.sta)
?: &(=(p.sta our.hid) ?=(^ sot) ?=(%brown p.cordon.shape.u.sot))
2015-09-19 02:20:30 +03:00
": "
"* "
2015-05-07 05:31:54 +03:00
--
::
++ tr :: telegram renderer
|_ $: man=span
who=ship
sen=serial
aud=audience
wen=@da
2015-10-06 22:23:26 +03:00
bou=bouquet
2015-05-07 05:31:54 +03:00
sep=speech
==
++ 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)
2015-05-07 05:31:54 +03:00
(~(sn-curt 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-10-06 22:23:26 +03:00
++ tr-tang ^- tang
%+ welp tr-sep-tang
=+ hed=leaf/"{(scow %uv sen)} at {(scow %da wen)}"
=+ =< paz=(turn (~(tap by aud)) .)
|=([a=partner *] leaf/~(ta-full ta man a))
=+ bok=(turn (sort (~(tap in bou)) aor) smyt)
[%rose [" " ~ ~] [hed >who< [%rose [", " "to " ~] paz] bok]]~
::
++ tr-sep-tang
|- ^- tang
=< ?+(. . [@ *] [.]~) ^- ?(tank tang) :: wrap single tanks
?+ -.sep [>sep<]~
%exp leaf/"# {(trip p.sep)}"
%lin leaf/"{?:(p.sep "" "@ ")}{(trip q.sep)}"
%non ~
%app rose/[": " ~ ~]^~[leaf/"[{(trip p.sep)}]" leaf/(trip q.sep)]
%tax leaf/(rend-work-duty p.sep)
%url leaf/"/ {(earf p.sep)}"
%mor ?~(p.sep ~ (weld $(p.sep t.p.sep) $(sep i.p.sep)))
%fat (welp (tr-rend-tors p.sep) $(sep q.sep))
==
::
++ tr-rend-tors
|= a=torso ^- tang
?- -.a
%name (welp $(a q.a) leaf/"={(trip p.a)}" ~)
%tank +.a
%text (turn (flop +.a) |=(b=cord leaf/(trip b)))
==
2015-10-06 01:56:58 +03:00
::
2015-05-07 05:31:54 +03:00
++ tr-pals
^- (set partner)
%- ~(gas in *(set partner))
(turn (~(tap by aud)) |=([a=partner *] a))
::
2015-10-03 03:07:27 +03:00
++ chow
2015-06-19 04:47:41 +03:00
|= [len=@u txt=tape]
?: (gth len (lent txt)) txt
2015-10-06 22:51:20 +03:00
=. txt (scag len txt)
|-
?~ txt txt
?: =(' ' i.txt)
|-(['_' ?.(?=([%' ' *] t.txt) t.txt $(txt t.txt))])
?~ t.txt "…"
[i.txt $(txt t.txt)]
2015-06-19 04:47:41 +03:00
::
2015-05-07 05:31:54 +03:00
++ tr-text
|= oug=?
^- tape
2015-06-19 04:47:41 +03:00
?+ -.sep ~&(tr-lost/sep "")
%fat
=+ rem=$(sep q.sep)
2015-10-03 03:07:27 +03:00
?: (gth (lent rem) 62) (chow 64 rem)
2015-10-06 22:51:20 +03:00
=- "{rem}{(chow (sub 64 (lent rem)) " {-}")}"
2015-06-19 04:47:41 +03:00
?+ -.p.sep "..."
%tank ~(ram re %rose [" " `~] +.p.sep)
==
2015-05-21 03:45:24 +03:00
::
2015-10-06 22:51:20 +03:00
%exp (chow 66 '#' ' ' (trip p.sep))
%url =+ ful=(earf p.sep)
?: (gth 64 (lent ful)) ['/' ' ' ful]
:+ '/' '_'
=+ hok=r.p.p.p.sep
~! hok
=< ?~(-.hok (reel p.hok .) +:(scow %if p.hok))
|=([a=span b=tape] ?~(b (trip a) (welp b '.' (trip a))))
::
2015-05-07 05:31:54 +03:00
%lin
=+ txt=(trip q.sep)
?: p.sep
2015-09-19 02:20:30 +03:00
(weld ~(te-pref te man tr-pals) txt)
2015-05-07 05:31:54 +03:00
?: oug
(weld "@ " txt)
(weld " " txt)
2015-05-12 03:31:37 +03:00
::
%app
2015-10-03 03:07:27 +03:00
(chow 64 "[{(trip p.sep)}]: {(trip q.sep)}")
2015-08-20 04:37:09 +03:00
::
%tax
2015-10-03 03:07:27 +03:00
(chow 64 " {(rend-work-duty p.sep)}")
2015-05-07 05:31:54 +03:00
==
--
::
++ peer :: accept subscription
2015-05-28 09:51:32 +03:00
|= [pax=path]
2015-05-07 05:31:54 +03:00
^- [(list move) _+>]
~? !=(src.hid our.hid) [%peer-talk-stranger src.hid]
2015-10-02 03:21:26 +03:00
:: ~& [%talk-peer src ost.hid pax]
2015-05-07 05:31:54 +03:00
?: ?=([%sole *] pax)
2015-05-28 09:51:32 +03:00
?> =(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-05-28 09:51:32 +03:00
|= [cod=command]
2015-05-07 05:31:54 +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-05-28 09:51:32 +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-05-28 10:56:08 +03:00
|= [way=wire rad=report]
2015-09-02 03:46:05 +03:00
^- (quip move +>)
=^ mos +>.$
%+ etch-friend way |= [man=span 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-05-28 10:56:08 +03:00
|= [way=wire saw=(unit tang)]
2015-05-08 23:57:34 +03:00
%+ etch-repeat [%repeat way] |= [num=@ud src=@p man=span]
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
|= way=wire
^- weir
?+ -.way !!
%friend
?> ?=([%show @ @ @ ~] t.way)
[%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way]
::
%repeat
?> ?=([@ @ @ ~] t.way)
[%repeat (slav %ud i.t.way) (slav %p i.t.t.way) i.t.t.t.way]
==
::
++ etch-friend ::
|= [way=wire fun=$+([man=span cuz=station] [(list move) _+>])]
=+ wer=(etch way)
?>(?=(%friend -.wer) (fun p.wer q.wer))
::
++ etch-repeat ::
|= [way=wire fun=$+([num=@ud src=@p man=span] [(list move) _+>])]
=+ wer=(etch way)
?>(?=(%repeat -.wer) (fun p.wer q.wer r.wer))
::
2015-05-18 05:34:05 +03:00
++ reap-friend ::
2015-05-28 10:56:08 +03:00
|= [way=wire saw=(unit tang)]
2015-05-18 05:34:05 +03:00
^- (quip move +>)
?~ saw [~ +>]
%+ etch-friend [%friend way] |= [man=span cuz=station]
~& [%reap-friend-fail man cuz 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-05-28 10:56:08 +03:00
|= way=wire
2015-05-08 23:57:34 +03:00
%+ etch-friend [%friend way] |= [man=span 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-05-28 09:51:32 +03:00
|= [pax=path]
2015-05-07 05:31:54 +03:00
^- [(list move) _+>]
2015-05-28 09:51:32 +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 .)
:_ %_ .
log %- ~(urn by log)
|=([man=span len=@ud] count:(~(got by stories) man))
==
%+ murn (~(tap by log))
|= [man=span len=@ud]
^- (unit move)
?: (gte len count:(~(got by stories) man))
~
`(log-to-file man)
::
++ log-to-file
|= man=span
^- move
=+ ^- paf=path
=+ day=(year %*(. (yore now.hid) +.t +:*tarp))
%+ 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 !>(-)])]
::
2015-08-27 03:21:12 +03:00
++ poke-save
|= man=span
^- (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-load
|= man=span
=+ ^= grams
%- (hard (list telegram))
2015-09-02 03:46:05 +03:00
.^ %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
::
2015-09-02 03:46:05 +03:00
++ poke-log
|= man=span
^- (quip move +>)
:- [(log-to-file man) ~]
+>.$(log (~(put by log) man count:(~(got by stories) man)))
::
2015-09-15 02:07:47 +03:00
++ poke-unlog
|= man=span
^- (quip move +>)
:- ~
+>.$(log (~(del by log) man))
::
2015-05-07 05:31:54 +03:00
++ prep
2015-09-02 03:46:05 +03:00
|= [old=(unit house-any)]
2015-05-07 05:31:54 +03:00
^- (quip move +>)
?~ old
2015-10-02 03:21:26 +03:00
ra-abet:ra-init:ra
2015-09-02 03:46:05 +03:00
|-
?- -.u.old
%1 $(u.old [%2 stories general outbox folks shells ~]:u.old)
2015-09-19 02:20:30 +03:00
%2 $(u.old [%3 stories general outbox folks shells log ~ ~]:u.old)
%3 [~ +>.^$(+<+ u.old)]
2015-09-02 03:46:05 +03:00
==
2015-05-07 05:31:54 +03:00
--