:: :::: /hook/core/talk/app :: /? 314 /- *talk, *twitter, *sole /+ talk, sole :: :::: :: !: => |% :: data structures ++ house ,[%1 house-1] :: full state ++ house-any :: app history $% [%1 house-1] :: 1: talk [%0 house-0] :: 0: initial version == :: ++ 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 == :: ++ house-0 :: legacy state %+ map path :: ,[p=(list zong) q=(map ship ,?)] :: :: :: ++ zong :: legacy messages $% $: %mess p=@da q=ship :: $= r :: $% [%do p=@t] :: [%exp p=@t q=tank] :: [%say p=@t] :: == == == :: ++ 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 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 == :: ++ river (pair point point) :: stream definition ++ point :: stream endpoint $% [%ud p=@ud] :: by number [%da p=@da] :: by date == :: ++ gift :: result $% [%rush salt] :: refresh [%mean ares] :: cancel [%nice ~] :: accept == :: ++ sign :: response $% $: %e :: from %eyre $% [%thou p=httr] :: HTTP response == == :: $: %g :: application $% [%mean p=ares] :: cancel [%nice ~] :: acknowledge [%rush p=silt] :: subs data == == :: $: %t :: $% [%wake ~] :: timer wakeup == == == :: ++ salt :: output rush $% [%talk-report p=report] :: [%sole-effect p=sole-effect] :: == :: ++ silt :: input rush $% [%talk-report p=report] :: refresh [%twit-stat p=twit-stat] :: tweet receipt [%twit-feed p=(list twit-stat)] :: tweet receipt == :: ++ move ,[p=bone q=(mold note gift)] :: all actions ++ hapt ,[p=ship q=path] :: app instance ++ note :: requests $% $: %c :: $% [%info p=@p q=@tas r=nori] :: == == :: $: %g :: network $% [%mess p=hapt q=ship r=cage] :: message [%nuke p=hapt q=ship] :: cancel [%show p=hapt q=ship r=path] :: subscribe [%took p=hapt q=ship] :: acknowledge == == :: $: %t :: $% [%wait p=@da] :: == == == :: :: ++ work :: interface action $% [%ask (unit work)] :: help (about) [%exp twig] :: compute [%mor (list work)] :: sequence [%rub work-adjust] :: configure story [%say speech] :: publish in voice [%who (unit partner)] :: show presence [%wry work-construct] :: configure system == :: ++ work-adjust :: adjust story $% [%dark p=(set ship)] :: toggle blacklist [%lite p=(set ship)] :: toggle whitelist [%love p=(set partner)] :: toggle partners [%whom p=? q=(set partner)] :: active/voice [%wind p=@dr] :: rewind by date == :: ++ work-construct :: configure system $% [%make p=span] :: create story [%raze p=span] :: destroy story [%tune p=span] :: switch to story == :: :: :: ++ 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) "+") -- |_ [hid=hide house] ++ ra :: transaction core |_ [ost=bone moves=(list move)] ++ sh :: console interface |_ $: coz=(list command) :: talk actions she=shell == ++ sh-abet ^+ +> =+ zoc=(flop coz) |- ^+ +>+> ?~ zoc +>+>.$(shells (~(put by shells) ost she)) $(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 ^+ +> +>(moves :_(moves [ost %give %rush %sole-effect fec])) :: ++ sh-peep :: peer to path |= pax=path ^+ +> +>(+> (~(ra-subscribe ra ost ~) her.she pax)) :: ++ sh-peer :: subscribe shell sh-prod:(sh-peep:(sh-peep ~) [%afx man.she ~]) :: ++ sh-prod :: show prompt ^+ . %+ sh-fact %pro :+ & %talk-line ^- tape =+ ^= rew ^- (pair (pair ,@t ,@t) (set partner)) ?~ active.she [['(' ')'] passive.she] [['[' ']'] u.active.she] =+ por=~(te-prom te man.she q.rew) (weld `tape`[p.p.rew por] `tape`[q.p.rew ' ' ~]) :: ++ sh-pass :: update passive aud |= aud=audience %_ +> passive.she %- ~(gas in *(set partner)) (turn (~(tap by aud)) |=([a=partner *] a)) == :: ++ sh-rend :: print on one line |= gam=telegram (sh-pass:(sh-fact %txt ~(tr-line tr man.she gam)) q.q.gam) :: ++ sh-numb :: print msg number |= num=@ud ^+ +> (sh-fact %txt " [{(scow %ud num)}]") :: ++ 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 ^+ +> ?+ -.rad +> %grams (sh-repo-grams +.rad) == :: ++ sh-sane-chat :: sanitize chatter |= buf=(list ,@c) ^- (list sole-edit) =+ :- inx=0 ^= fix |= [inx=@ud cha=@t lit=(list sole-edit)] ^+ lit [[%mor [%del inx] [%ins inx `@c`cha] ~] lit] |- ^- (list sole-edit) ?: =(62 inx) |- ^- (list sole-edit) ?~(buf ~ [[%del 62] $(buf t.buf)]) ?~ buf ~ =+ lit=$(inx +(inx), buf t.buf) ?: |((lth i.buf 32) (gth i.buf 126)) (fix inx '?' lit) ?: &((gte i.buf 'A') (lte i.buf 'Z')) (fix inx (add 32 i.buf) lit) ?: &(=('/' i.buf) ?=([47 *] t.buf)) (fix inx '\\' lit) lit :: ++ sh-sane-rule :: sanitize by rule |* sef=_rule |= [inv=sole-edit txt=tape] ^- (list sole-edit) =+ ryv=(rose txt sef) ?.(-.ryv ~ [inv ~]) :: ++ sh-sane :: sanitize input |= [inv=sole-edit buf=(list ,@c)] ^- (list sole-edit) ?~ buf ~ ?: =(';' i.buf) ((sh-sane-rule work:cp) inv (tufa buf)) (sh-sane-chat buf) :: ++ sh-slug :: edit to sanity |= lit=(list sole-edit) ^+ +> ?~ lit +> =^ lic say.she (~(transmit cs say.she) `sole-edit`?~(t.lit i.lit [%mor lit])) (sh-fact [%mor [%det lic] ~]) :: ++ sh-stir :: apply edit |= cal=sole-change ^+ +> =^ inv say.she (~(transceive cs say.she) cal) =+ lit=(sh-sane inv buf.say.she) ?~ lit +>.$ (sh-slug lit) :: ++ sh-pork :: parse work ^- (unit work) ?~ buf.say.she ~ ?: =(';' -.buf.say.she) (rust (tufa buf.say.she) work:cp) `[%say %lin & (crip (tufa buf.say.she))] :: ++ sh-hear :: hear back |= paz=(set partner) ?~ paz | ?| $(paz l.paz) $(paz r.paz) (~(has in sources.shape:(~(got by stories) man.she)) `partner`n.paz) == :: ++ sh-whom :: current audience ^- audience =+ paz=`(set partner)`?~(active.she passive.she u.active.she) =+ zup=(~(tap in paz)) =. zup ?:((sh-hear paz) zup [[%& our.hid man.she] zup]) %- ~(gas by *audience) %+ turn zup |=(a=partner [a *envelope %pending]) :: ++ sh-work :: do work |= job=work ^+ +> ?+ -.job ~& [%talk-work job] +> :: %say =^ sir +>.$ sh-uniq %= +>.$ coz :_ coz [%publish [[sir sh-whom [lat.hid ~ +.job]] ~]] == == :: ++ sh-done :: apply result =+ lit=(sh-sane [%nop ~] buf.say.she) ?^ lit (sh-slug lit) =+ jub=sh-pork ?~ jub (sh-fact %bel ~) =. +> (sh-work u.jub) =^ cal say.she (~(transmit cs say.she) [%set ~]) (sh-fact %mor [%nex ~] [%det cal] ~) :: ++ sh-sole :: apply edit |= act=sole-action ^+ +> ?- -.act %det (sh-stir +.act) %ret sh-done == :: ++ sh-uniq ^- [serial _.] [(shaf %serial eny.hid) .(eny.hid (shax eny.hid))] -- ++ ra-abed :: resolve core ^- [(list move) _+>] [(flop moves) +>] :: ++ 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) ?=([%give %rush %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 ra-axel $(q.rey t.q.rey, +> (ra-back(ost p.i.q.rey) q.i.q.rey)) :: ++ ra-back |= rad=report ^+ +> sh-abet:(~(sh-repo sh ~ (~(got by shells) ost)) rad) :: ++ ra-sole |= act=sole-action ^+ +> sh-abet:(~(sh-sole sh ~ (~(got by shells) ost)) act) :: ++ 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-ever :: emit success (ra-emit ost %give %nice ~) :: ++ ra-evil :: emit error |= msg=cord ~& [%ra-evil msg] (ra-emit ost %give %mean ~ msg ~) :: (ra-emit ost %give %nice ~) :: ++ ra-house :: emit partners |= ost=bone %+ ra-emit ost :^ %give %rush %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 =+ sir=(sein our.hid) %+ ra-apply our.hid :+ %design (main our.hid) :- ~ :_ [%default ?:((gte our.hid 65.536) %brown %black) ~] ?:(=(sir our.hid) ~ [[%& sir (main sir)] ~ ~]) :: ++ 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) =. +>.$ (ra-config p.cod *config) ra-ever(stories (~(del by stories) p.cod)) =. +>.$ (ra-config p.cod u.q.cod) ra-ever :: %review ra-ever:(ra-think | her +.cod) %publish ra-ever:(ra-think & her +.cod) == :: ++ 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-friend :: %friend response |= [man=span tay=partner sih=sign] ^+ +> =+ pur=(~(get by stories) man) ?~ pur ~& [%ra-friend-none man] +>.$ pa-abet:(~(pa-friend pa man u.pur) tay sih) :: ++ ra-twitter :: %twitter response |= [[num=@ud man=span] sih=sign] ^+ +> ?+ sih ~|([%talk-bad-twitter sih] !!) [%g ?(%nice %mean) ~] +> [%g %mean ^] (ra-repeat num [%| %twitter man] sih) [%g %rush %twit-stat *] (ra-repeat num [%| %twitter man] [%g %nice ~]) == :: ++ ra-repeat :: %repeat response |= [num=@ud pan=partner sih=sign] =+ 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 ?+ sih !! [%g %mean *] ~&([%talk-repeat-rejected num pan sih] %rejected) [%g %nice ~] %received == (ra-think | our.hid u.oot ~) :: ++ ra-cancel :: drop a bone ^+ . =+ hep=(~(get by sup.hid) ost) ?~ hep + ?. ?=([@ @ *] q.u.hep) +(general (~(del in general) ost)) =* man i.t.q.u.hep =+ pur=(~(get by stories) man) ?~ pur +> pa-abet:(pa-notify:~(pa-cancel pa man u.pur) p.u.hep %gone *human) :: ++ 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)) sh-abet:~(sh-peer sh ~ [her man 0 *sole-share ~ ~]) :: ++ ra-subscribe :: listen to |= [her=ship pax=path] ^+ +> :: ~& [%ra-subscribe her pax] ?: ?=(~ pax) (ra-house(general (~(put in general) ost)) ost) ?. ?=([@ @ *] 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) =. soy ?.((~(has in vab) %a) soy (pa-watch:soy her)) =. soy ?.((~(has in vab) %x) soy (pa-master:soy her)) =. soy ?.((~(has in vab) %f) soy (pa-listen:soy her t.t.pax)) =^ who +>.$ (ra-human her) pa-abet:(pa-notify:soy her %hear who) :: ++ ra-think :: publish/review |= [pub=? her=ship tiz=(list thought)] ^+ +> ?~ tiz +> $(tiz t.tiz, +> (ra-consume pub her i.tiz)) :: ++ ra-consume :: consume thought |= [pub=? her=ship tip=thought] =+ 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) %| ?. pub +> ?- -.p.tay %twitter (ra-tweet p.p.tay tip) == == :: ++ ra-record :: add to story |= [man=span gam=telegram] ^+ +> =+ pur=(~(get by stories) man) ?~ pur ~& [%no-story man] +>.$ pa-abet:(~(pa-learn pa man u.pur) gam) :: ++ ra-transmit :: send to neighbor |= [cuz=station tip=thought] ^+ +> =. +> %+ ra-emit ost :* %pass /repeat/(scot %ud p.outbox)/(scot %p p.cuz)/[q.cuz] %g %mess [p.cuz /talk] our.hid [%talk-command !>(`command`[%review tip ~])] == +>(p.outbox +(p.outbox), q.outbox (~(put by q.outbox) p.outbox tip)) :: ++ ra-tweet :: send to /twit |= [man=span tip=thought] =* sta r.tip ?> ?=(%lin -.r.sta) =. q.outbox (~(put by q.outbox) p.outbox tip) %^ ra-emil(p.outbox +(p.outbox)) :* ost %pass /twitter/stat/(scot %ud p.outbox)/[man] %g %mess [our.hid /twit] our.hid [%twit-do !>(`twit-do`[man %post p.tip q.r.sta])] == :* ost %pass /twitter/stat/(scot %ud p.outbox)/[man] [%g %show [our.hid /twit] our.hid /post/(scot %uv p.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) (pa-sauce ost [[%mean ~ %talk-watch-unauthorized ~] ~]) =. viewers (~(put in viewers) ost) (pa-display ost ~ ~) :: ++ pa-master :: hear config |= her=ship ?. (pa-admire her) (pa-sauce ost [[%mean ~ %talk-master-unauthorized ~] ~]) =. owners (~(put in owners) ost) :: ~& [%pa-master her man shape] (pa-sauce ost [[%rush %talk-report %config shape] ~]) :: ++ 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 [[%rush %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 [[%rush %talk-report %config shape] ~]) :: ++ pa-friend :: subscribed update |= [tay=partner sih=sign] ^+ +> ?+ sih ~|([%talk-bad-friend sih] !!) [%g %nice ~] +>.$ :: [%g %mean *] ?~ +>.sih (pa-acquire [tay ~]) ~& [%pa-friend-mean +>.sih] pa-monitor(sources.shape (~(del in sources.shape) tay)) :: [%g %rush %twit-feed *] %- pa-lesson %+ turn p.p.sih |= twit-stat ^- telegram :^ our.hid :: XX inaccurate (shas %twit id) `audience`[[tay [& ~ tay] %received] `~] :: current party? ^- statement :+ now ~ :: XX hashtags [%lin & txt] :: [%g %rush %talk-report *] :: ~& [%pa-friend-report +>+.sih] ?> ?=(& -.tay) =. +> %+ pa-scrub ost :_ ~ :- /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] [%g %took [p.p.tay /talk] our.hid] ?+ -.p.p.sih ~|([%talk-odd-friend sih] !!) %config +>.$ %group (pa-remind tay +.p.p.sih) %grams (pa-lesson q.+.p.p.sih) == == :: ++ pa-scrub :: pass forward |= [ost=bone bub=(list (pair path note))] %_ +>.$ moves (welp (flop (turn bub |=(a=(pair path note) [ost %pass a]))) moves) == :: ++ pa-sauce :: send backward |= [ost=bone gub=(list gift)] %_ +>.$ moves (welp (flop (turn gub |=(a=gift [ost %give a]))) moves) == :: ++ pa-abjure :: unsubscribe move |= tal=(list partner) %+ pa-scrub 0 %- zing %+ turn tal |= tay=partner ?- -.tay %| ~& tweet-abjure/p.p.tay !! :: :~ :- /friend/nuke/[man]/twitter/[p.p.tay] :: [%g %nuke [our.hid /twit] our.hid] :: == :: %& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]] :~ :- /friend/nuke/[man]/(scot %p p.p.tay)/[q.p.tay] [%g %nuke [p.p.tay /talk] our.hid] == == :: ++ pa-acquire :: subscribe to |= tal=(list partner) %+ pa-scrub 0 %- zing %+ turn tal |= tay=partner ^- (list (pair path note)) =+ num=(fall (~(get by sequence) tay) 0) ?- -.tay %| ~& tweet-acquire/p.p.tay :~ :- /friend/show/[man]/twitter/[p.p.tay] [%g %show [our.hid /twit] our.hid /user/[p.p.tay]] == :: %& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]] :~ :- /friend/show/[man]/(scot %p p.p.tay)/[q.p.tay] [%g %show [p.p.tay /talk] our.hid /af/[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 :: ~& [%pa-cancel ost] %_ . guests (~(del by guests) ost) viewers (~(del in viewers) ost) owners (~(del in owners) ost) == :: ++ pa-notify :: local presence |= [her=ship saz=status] ^+ +> =+ ^= nol ?: =(%gone p.saz) (~(del by locals) her) (~(put by locals) her lat.hid saz) ?: =(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] =. +>.$ (pa-sauce ost [[%rush %talk-report %grams q.lab r.lab] ~]) ?: p.lab (pa-sauce ost [[%mean ~] ~]) +>.$(guests (~(put by guests) ost riv)) ^= 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-sauce ost [[%mean ~ %talk-listen-unauthorized ~] ~]) =+ ^= ruv ^- (unit river) ?: ?=(~ pax) `[[%ud count] [%da (dec (bex 128))]] ?: ?=([@ ~] 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-sauce ost [[%mean ~ %talk-malformed ~] ~]) (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 %give %mean ~] 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 %give %rush %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 |_ one=station ++ sn-best :: best to show |= two=station ^- ? ?: =(our.hid p.one) %| ?: =(our.hid p.two) %& (lth p.one p.two) :: ++ sn-curt :: render name in 14 |= mup=? ^- tape =+ ^= syl |= [len=@ud sez=(list cord)] ?> !=(0 len) |- ^- tape ?~ sez ~ =+ nez=(trip i.sez) =+ nel=(lent nez) ?: (gte nel len) (welp (scag (dec len) nez) ">") (welp nez $(sez t.sez)) :: ?: =(p.one our.hid) (sigh 14 ?:(mup "*%" "%") q.one) ?: =(p.one (sein our.hid)) (sigh 14 ?:(mup "*/" "/") q.one) =+ rac=(clan p.one) =+ raw=(scow %p p.one) =. raw ?.(mup raw ['*' (slag 2 raw)]) ?- rac %czar (weld " " raw) %king (weld " " raw) %duke raw %earl :(welp (scag 7 raw) "^" (scag 6 (slag 22 raw))) %pawn :(welp (scag 7 raw) "_" (scag 6 (slag 51 raw))) == :: ++ sn-phat :: render accurately ^- tape ?: =(p.one our.hid) ['%' (trip q.one)] ?: =(p.one (sein our.hid)) ['/' (trip q.one)] :(welp (scow %p p.one) "/" (trip q.one)) -- :: ++ ta :: partner core |_ one=partner ++ ta-best :: more important |= two=partner =- ?:(bet one two) ^= bet |- ^- ? ?- -.one %& ?- -.two %| %& %& (~(sn-best sn p.one) p.two) == :: %| ?- -.two %& %| %| ?: =(-.p.two -.p.one) (lth (mug +.p.one) (mug +.p.two)) (lth -.p.two -.p.one) == == ++ ta-show :: render partner |= moy=(unit ,?) ^- tape ?- -.one %& ?~ moy ~(sn-phat sn p.one) (~(sn-curt sn 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 n.lix) u.lef)) =. n.lix ?~(rit n.lix (~(ta-best ta 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 ?~ lix %& |(!=(~ l.lix) !=(~ r.lix)) :: ++ te-prom ^- tape :: render targets =. . te-deaf =+ boz=te-best ?~ boz "" =+ all=(~(tap in (~(del in lix) u.boz))) %+ weld (~(ta-show ta u.boz) ~) |- ^- tape ?~ all ~ ;: welp " " (~(ta-show ta i.all) ~) $(all t.all) == :: ++ te-whom :: render sender (~(ta-show ta (need te-best)) ~ te-maud) -- :: ++ tr :: telegram renderer |_ $: man=span who=ship sen=serial aud=audience wen=@da bou=(set flavor) sep=speech == ++ tr-line ^- tape :: one-line print =+ oug==(who our.hid) =+ txt=(tr-text oug) ?: =(~ txt) "" =+ eck=?:((~(has by aud) [%& our.hid man]) '|' '-') =+ heb=?:(oug '<' '>') =+ ^= baw ?: oug ~(te-whom te man tr-pals) (~(sn-curt sn [who (main who)]) |) [heb eck (weld baw txt)] :: ++ tr-pals ^- (set partner) %- ~(gas in *(set partner)) (turn (~(tap by aud)) |=([a=partner *] a)) :: ++ tr-text |= oug=? ^- tape ?+ -.sep "" %lin =+ txt=(trip q.sep) ?: oug ?: p.sep (weld "> " txt) (weld "@ " txt) ?: p.sep (weld "< " txt) (weld " " txt) == -- :: ++ cp :: command parser =+ vag=(vang | [&1:% &2:% '0' |3:%]) |% ++ come :: keyword command |* [a=@tas b=_rule] ;~((glue (plus ace)) (cold a (jest a)) b) :: ++ gone :: parse unit |* a=_rule ;~(pose (stag ~ a) (easy ~)) :: ++ posh :: parse each |* [a=_rule b=_rule] ;~(pose (stag %& a) (stag %| b)) :: ++ ship ;~(pfix sig fed:ag) :: ship ++ shiz :: ship set %+ cook |=(a=(list ^ship) (~(gas in *(set ^ship)) a)) (most ;~(plug com (star ace)) ship) :: ++ stat :: partner %+ posh ;~ plug ship ;~(pose ;~(pfix fas urs:ab) (easy (main our.hid))) == ;~ pose ;~(pfix pat (stag %twitter urs:ab)) == :: ++ staz :: partner set %+ cook |=(a=(list partner) (~(gas in *(set partner)) a)) (most ;~(plug com (star ace)) stat) :: ++ step :: rollback interval %+ sear |= a=coin ?. ?=([%$ %dr @] a) ~ (some `@dr`+>.a) nuck:so :: ++ text (boss 256 (star prn)) :: utf8 text ++ tome %+ stag %lin ;~ pose (stag %| ;~(pfix pat text)) (stag %& text) == :: ++ work :: all commands %+ knee *^work |. ~+ ;~ pose ;~ pfix cen ;~ pose (stag %wry (come %make urs:ab)) (stag %wry (come %raze urs:ab)) (stag %wry (come %tune urs:ab)) (stag %rub (come %dark shiz)) (stag %rub (come %lite shiz)) (stag %rub (come %whom (stag %& staz))) (stag %rub (come %wind step)) (stag %rub (come %love staz)) == == :: ;~(pfix wut (stag %ask (gone work))) ;~(pfix tis (stag %who (gone stat))) ;~(pfix cen (stag %exp wide:vag)) :: %+ cook |= [a=(set partner) b=(unit ,[%lin p=? q=@t])] ^- ^work =. b ?~(b ~ ?:(=(0 q.u.b) ~ b)) =+ c=[%rub %whom %& a] ?~(b c [%mor c [%say u.b] ~]) ;~ plug staz (gone ;~(pfix (star ace) tome)) == :: (stag %say tome) == -- :: ++ peer |= [ost=bone her=ship pax=path] ^- [(list move) _+>] ?: ?=([%sole *] pax) ?> =(our.hid her) ?< (~(has by shells) ost) ra-abet:(~(ra-console ra ost ~) her t.pax) :: ~& [%talk-peer-data ost her pax] ra-abet:(~(ra-subscribe ra ost ~) her pax) :: ++ poke-talk-command |= [ost=bone her=ship cod=command] ^- [(list move) _+>] :: ~& [%talk-poke-command her cod] ra-abet:(~(ra-apply ra ost ~) her cod) :: ++ poke-sole-action |= [ost=bone her=ship act=sole-action] ra-abet:(~(ra-sole ra ost [ost %give %nice ~]~) act) :: ++ pour |= [ost=bone pax=path sih=*] ^- [(list move) _+>] :: ~& sih=sih =+ sih=((hard sign) sih) :: ~& [%talk-pour ost pax sih] ?+ pax ~& [%talk-strange-path pax] !! :: [%twitter *] =- ra-abet:(~(ra-twitter ra ost ~) met sih) ^= met ?+ t.pax ~| [%talk-twitter-strange-path pax] !! :: [%mine @ @ ~] :: [i.t.pax i.t.t.t.pax] [%stat @ @ ~] [(slav %ud i.t.t.pax) i.t.t.t.pax] == :: [%friend *] ?> ?=([@ @ @ @ ~] t.pax) ?. =(%show i.t.pax) :: ~& [%pour-friend-nuke-nuke pax] [~ +>.$] =+ man=i.t.t.pax =+ ?: ?=(%twitter i.t.t.t.pax) tay=[%| i.t.t.t.pax i.t.t.t.t.pax] tay=[%& (slav %p i.t.t.t.pax) i.t.t.t.t.pax] ra-abet:(~(ra-friend ra ost ~) man tay sih) :: [%repeat *] ?> ?=([@ @ @ ~] t.pax) =+ [num her man]=[(slav %ud i.t.pax) (slav %p i.t.t.pax) i.t.t.t.pax] ra-abet:(~(ra-repeat ra ost ~) num [%& her man] sih) == :: ++ pull |= ost=bone ^- [(list move) _+>] :: ~& [%talk-pull `*`ost] =. shells (~(del by shells) ost) ra-abet:ra-ever:~(ra-cancel ra ost ~) :: ++ poke-bit |= [ost=bone you=ship ~] ^- [(list move) _+>] :_ +>.$ =+ paf=/(scot %p our.hid)/try/(scot %da lat.hid)/talk/backlog/jam [ost %pass /jamfile %c %info our.hid (foal paf (jam +<+.+>.$))]~ :: ++ prep |= old=(unit (unit house-any)) ^- [(list move) _+>] ?> ?=(^ old) =| moz=(list move) |- ?~ u.old =+ paf=/(scot %p our.hid)/try/(scot %da lat.hid)/talk/backlog/jam ?. ?=([%0 %0 %0] [.^(%cy paf)]) ~& %talk-prep-restore $(u.old (some ((hard house-any) (cue ((hard ,@) .^(%cx paf)))))) ra-abet:~(ra-init ra 0 moz) :- moz |- ?- -.u.u.old %1 %_(+>.^^$ +<+ u.u.old) %0 $(u.u.old [%1 (house-0-to-house-1 +.u.u.old)]) == :: ++ house-0-to-house-1 |= vat=house-0 ^- house-1 =- :* stories=- general=~ outbox=[0 ~] folks=~ shells=~ == ^- (map span story) =- %- ~(run by -) |= grams=(list telegram) ^- story :* count=(lent grams) grams=grams locals=~ remotes=~ sequence=~ shape=[.(cordon [%black ~])]:*config ^= known %- mo ^- (list ,[serial @]) =< + (roll grams |=([telegram a=@ b=(list ,[serial @])] [+(a) [a p.q] b])) guests=~ viewers=~ owners=~ == ^- (map span (list telegram)) %- mo %+ turn (~(tap by vat)) |= [a=path b=(list zong) c=(map ship ,?)] =+ ^= par ?: =(/ a) 'hub' =+ (turn a |=(d=span leaf/(trip d))) (crip ~(ram re %rose ["_" ~ ~] -)) :- par =+ aud=`audience`[[[%& our.hid par] *envelope %received] `~] =+ ^= spe |= r=_r:*zong ^- speech ?- -.r %say [%lin %& p.r] %do [%lin %| p.r] %exp [%fat [%tank q.r ~] [%exp p.r]] == %+ turn b |= d=zong ^- telegram [q.d (sham eny.hid d) aud p.d ~ (spe r.d)] --