Merge branch 'master' of github.com:urbit/urbit

Conflicts:
	urb/urbit.pill
This commit is contained in:
C. Guy Yarvin 2014-07-03 13:06:52 -07:00
commit f9f5f7c29d
9 changed files with 439 additions and 429 deletions

View File

@ -1620,12 +1620,12 @@
%ge :: gall request
?> ?=([@ ~] t.t.q.q.bon)
=+ app=`term`(need ((sand %tas) i.t.t.q.q.bon))
:_(fox [hen %pass ~ %g %roth p.bon app r.bon]~)
:_(fox [hen %pass ~ %g %rote p.bon app r.bon]~)
::
%gh :: gall response
?> ?=([@ ~] t.t.q.q.bon)
=+ app=`term`(need ((sand %tas) i.t.t.q.q.bon))
:_(fox [hen %pass ~ %g %rote p.bon app r.bon]~)
:_(fox [hen %pass ~ %g %roth p.bon app r.bon]~)
::
%pi :: ping
$(bon [%wine p.bon " sent a ping at {(scow %da now)}"])

View File

@ -44,6 +44,7 @@
$% [%crud p=@tas q=(list tank)] ::
[%text p=tape] ::
== ::
++ hasp ,[p=ship q=term] :: see %gall
++ move ,[p=duct q=(mold newt ghat)] :: local move
++ newt ::
$% $: %a :: to %ames
@ -67,6 +68,12 @@
$% [%band p=ship q=(list rout)] ::
[%that p=@ud q=love] ::
[%them p=(unit hiss)] ::
== == ::
$: %g :: to %gall
$% [%init p=ship] ::
[%mess p=hasp q=ship r=cage] ::
[%nuke p=hasp q=ship] ::
[%show p=hasp q=ship r=path] ::
== == == ::
++ rave :: see %clay
$% [& p=mood] :: single request
@ -81,6 +88,8 @@
[%init p=@p] :: by %ames
[%note p=@tD q=tank] :: by %clay
[%pipe p=(unit ,[p=tutu q=(list)])] :: by %batz
[%rush p=logo q=*] ::
[%rust p=logo q=*] ::
[%send p=lane q=@] :: by %ames
[%thou p=httr] :: by %eyre
[%waft p=sock q=*] :: by %ames
@ -267,6 +276,12 @@
%init [[[hen %give sin] ~] +<.^^$]
%note [[[hen %give sin] ~] +<.^^$]
%pipe !!
%rush ?. (fear tea) :: legit
[~ +<.^^$]
abet:lash:(lean tea hen sin)
%rust ?. (fear tea) :: legit
[~ +<.^^$]
abet:lash:(lean tea hen sin)
%send [[[hen %give sin] ~] +<.^^$]
%thou ?. (fear tea) :: legit
[~ +<.^^$]
@ -401,7 +416,6 @@
?~ ryg
+>.$
abet:abet:(pong:(ox:(past p.u.ryg) q.u.ryg) [%line lin])
::
++ gill :: gill:fi:be
|= lin=@t :: input line
^+ +>
@ -929,6 +943,17 @@
~& [%batz-xy (,@tas -.q.gud)]
!!
(gram ~ %pass ~ u.hug)
%xz =+ tea=(bist %ma /chat/hi/hey)
(gram ~ %pass tea %g %mess p.gud q.gud r.gud !>(s.gud))
%zz =+ tea=(bist %ma q.gud)
?. ?=([@ ~] p.gud)
~& [%batz-zzz p.gud]
!!
=+ hug=((soft newt) [i.p.gud r.gud])
?~ hug
~& [%batz-zz (,@tas -.r.gud)]
!!
(gram ~ %pass tea u.hug)
==
==
::
@ -953,6 +978,7 @@
%eg (gulf (bist %ma lap) p.gal)
%es :: ~& %es-loss
(gull (bist %ma lap) p.gal q.gal ~)
%gr +>
%hp +>
%ht (gram ~ %pass (bist [%ma lap]) %e [%band who ~])
%lq (gump | p.gal gyp ted lap)
@ -971,6 +997,7 @@
%eg (gulp (bist %ma lap) p.gal)
%es :: ~& %es-moor
(gull (bist %ma lap) p.gal q.gal [~ r.gal])
%gr +>
%hp +>
%ht (gram ~ %pass [%b (bist [%ma lap])] %e [%band who p.gal])
%lq (gump & p.gal [gyp ted lap])
@ -1037,6 +1064,10 @@
gul goh
+>.$ (glib lap [%eg +.sik])
==
::
%gr
?> ?=(?(%rush %rust) -.sik)
+>.$(+>.$ (glib lap [%gr +.sik]))
::
%hp
?> ?=(%thou -.sik)

View File

@ -1,4 +1,4 @@
!: :: %ford, new execution control
:: :: %ford, new execution control
!? 164
::::
|= pit=vase
@ -190,14 +190,11 @@
++ camp :: request a file
|= [ren=care bem=beam]
^+ +>
=+ tik=(scot %ud p.kig)
=: p.kig +(p.kig)
q.kig (~(put by q.kig) p.kig bem)
==
%= $
%= +>
kig [+(p.kig) (~(put by q.kig) p.kig bem)]
mow :_ mow
:- hen
:^ %pass [(scot %p our) (scot %ud num) (scot %ud tik) ~]
:^ %pass [(scot %p our) (scot %ud num) (scot %ud p.kig) ~]
%c
[%warp [our p.bem] q.bem [~ %& %x r.bem s.bem]]
==
@ -403,20 +400,14 @@
^- (bolt (unit vase))
?: ?=(?(%gate %core %hoon %hook) for)
(fine cof ~ sam)
~& [%lake for bek]
%+ cope (make cof %boil %gate bek /ref/[for]/sys)
|= [cof=cafe cay=cage]
~& %lake-a
%+ cope (lane cof p.q.cay [%cnzy %$])
|= [cof=cafe ref=type]
~& %lake-b
?: (~(nest ut ref) | p.sam)
~& %lake-c
(fine cof ~ sam)
~& %lake-d
%+ cope (maul cof q.cay sam)
|= [cof=cafe pro=vase]
~& %lake-e
(fine cof ~ pro)
::
++ lave :: validate
@ -425,7 +416,6 @@
=+ ^= own ^- ship
=+ von=(ska %cy (tope [[p.sax %main lok] /core/ref/[for]/sys]))
?~(von q.sax p.sax)
~& [%lave for sax som]
((lake for [own %main lok]) cof [%noun som])
::
++ lair :: metaload

View File

@ -99,6 +99,7 @@
lat=@da :: last change
orm=(unit ,@da) :: build date
sup=(map bone (pair ship path)) :: subscribers
pus=(jug path bone) :: srebircsbus
peq=(map bone ,@uvI) :: peekers
ped=(set (pair ship desk)) :: active depends
zam=scar :: opaque ducts
@ -198,7 +199,7 @@
%show [law p.q.hic %show q.q.hic r.q.hic]
%nuke [law p.q.hic %nuke q.q.hic]
==
abet:work:(quem:(boar:(goat hap) hen law) kon)
((goad hen law) p.hap q.hap kon)
::
++ take :: accept response
|= [pax=path hen=duct hin=(hypo sign)] ::
@ -305,7 +306,7 @@
:~ :- hen
:+ %pass
~[%x -.roc (scot %p you) app (scot %p our) (scot %ud num)]
`note`[%a [%want [you our] [%q %gq app ~] [num roc]]]
`note`[%a [%want [you our] [%q %ge app ~] [num roc]]]
==
%= ..^^$
pol.all
@ -317,10 +318,10 @@
++ gasp :: %x take
|= [hen=duct pax=path sih=sign]
^- [(list move) _..^$]
?. ?=(%f -.sih) ?>(?=(%a -.sih) [~ ..^$])
:_ ..^$
:_ ~
:- hen
?> ?=(%f -.sih)
?- -.p.+.sih
%|
[%give %crud %gasp-crud p.p.+.sih]
@ -341,14 +342,15 @@
=+ :* our=`ship`(slav %p i.t.pax)
app=`term`i.t.t.pax
you=`ship`(slav %p i.t.t.t.pax)
num=(scot %ud i.t.t.t.t.pax)
num=(slav %ud i.t.t.t.t.pax)
==
:_ ..^$ :_ ~ :- hen
:+ %pass [%r pax]
^- note
=+ rod=|=(ron=roon `note`[%a %want [you our] /q/gr/[app] num ron])
:_ ..^$
=+ rod=|=(ron=roon `note`[%a %want [our you] /q/gh/[app] num ron])
?+ -.pax !!
%m ?+ -.sih !!
%m :_ ~ :- hen
:+ %pass [%r pax]
^- note
?+ -.sih !!
%f
?- -.p.+.sih
%& [%g %mess [our app] you `cage`q.p.p.+.sih]
@ -364,7 +366,11 @@
==
==
%s ?+ -.sih !!
%a ~
%g
:_ ~ :- hen
:+ %pass [%r pax]
^- note
?- -.+.sih
%dumb !!
%rasp !!
@ -396,7 +402,6 @@
++ gawk :: %r call/request
|= [hen=duct saq=sack app=term num=@ud rok=rook]
^- [p=(list move) q=_..^$]
~& [%gawk hen saq num -.rok]
:_ ..^$ :_ ~
^- move :- hen
:+ %pass
@ -565,7 +570,7 @@
|= kas=silk
^- silk
:+ %mute kas
:~ [[%$ 12]~ (cave !>([[our app] sup.sat [act.sat eny now]]))]
:~ [[%$ 12]~ (cave !>([[our app] sup.sat pus.sat [act.sat eny now]]))]
==
++ core |=(vax=vase (cove %core vax)) :: core as silk
++ cove :: cage as silk
@ -733,6 +738,7 @@
%- %= give
peq.sat (~(put by peq.sat) ost ash)
sup.sat (~(put by sup.sat) ost kee)
pus.sat (~(put ju pus.sat) +.kee ost)
==
(best %rust u.gyd)
::
@ -742,7 +748,10 @@
=^ gud +>.$ (mack q.hin)
?^ gud
(give [%dumb ~])
+>.$(sup.sat (~(put by sup.sat) ost [you t.t.t.pax]))
%= +>.$
sup.sat (~(put by sup.sat) ost [you t.t.t.pax])
pus.sat (~(put ju pus.sat) t.t.t.pax ost)
==
::
%poke
=^ gud +>.$ (mack q.hin)
@ -762,7 +771,11 @@
%pull
=^ gud +>.$ (mack q.hin)
?^ gud +>.$
+>.$(sup.sat (~(del by sup.sat) ost))
=+ pax=+:(fall (~(get by sup.sat) ost) *[ship path])
%= +>.$
sup.sat (~(del by sup.sat) ost)
pus.sat (~(del ju pus.sat) pax ost)
==
==
::
%u :: user request
@ -795,7 +808,6 @@
=+ pex=(~(tap by peq.sat) ~)
|- ^+ +>.^$
?~ pex +>.^$
:: ~& [%morn-peek p.i.pex (need (~(get by sup.sat) p.i.pex))]
%= $
pex t.pex
+>.^$ %- quem(hen (need (~(get by r.zam.sat) p.i.pex)))

View File

@ -700,14 +700,15 @@
?: (b i.a) &
$(a t.a)
::
++ murn :: maybe transform
++ murn !: :: maybe transform
|* [a=(list) b=$+(* (unit))]
%+ reel a
|* [c=* acc=(list)]
=+ i=(b c)
?~ i
acc
[i=u.i t=acc]
|-
?~ a
~
=+ c=(b i.a)
?~ c
$(a t.a)
[i=u.c t=$(a t.a)]
::
++ reel :: right fold
~/ %reel
@ -826,11 +827,13 @@
[i=i.a $(a t.a)]
::
++ zing :: promote
|* a=(list (list))
^+ ?>(?=(^ a) (homo i.a))
|-
?~ a ~
(weld i.a $(a t.a))
=| *
|%
+- $
?~ +<
+<
(welp +<- $(+< +<+))
--
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2c, simple noun surgery ::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -1925,12 +1928,21 @@
::
+- add :: adds key-list pair
|* [b=* c=*]
=+ d=(get(a +>) b)
(~(put by a) [d c])
=+ d=(get(+< a) b)
(~(put by a) b [c d])
--
::
++ ju :: jug engine
|/ a=(jug)
+- del :: del key-set pair
|* [b=* c=*]
^+ a
=+ d=(get(+< a) b)
=+ e=(~(del in d) c)
?~ e
(~(del by a) b)
(~(put by a) b e)
::
+- get :: gets set by key
|* b=*
=+ c=(~(get by a) b)
@ -9468,6 +9480,7 @@
app=@tas :: app identity
== ::
sup=(map bone (pair ship path)) :: subscription set
pus=(jug path bone) :: noitpircsbus set
$: act=@ud :: change number
eny=@uvI :: entropy
lat=@da :: date of last tick

View File

@ -950,57 +950,62 @@
++ adze :: adze:ze
|= may=(list nori) :: reverse nori
%- flop
|- ^- (list nori)
?~ may ~
=+ yam=$(may t.may)
?- -.i.may
& [[%& (bind p.i.may acai) (curl q.i.may)] yam]
| yam
^- (list nori)
%+ murn may
|= n=nori
?- -.n
& [~ u=[%& (bind p.n acai) (curl q.n)]]
| ~
==
::
++ alar :: alar:ze
|= may=(list nori) :: nori to tako
^- (list tako)
?~ may ~
?- -.i.may
& (weld q.q.i.may $(may t.may))
| $(may t.may)
%- zing
%+ turn may
|= n=nori
?- -.n
& q.q.n
| ~
==
::
++ alda :: alda:ze
|= hoe=(list tako) :: deconstruct
|- ^- (map path (list miso))
?~ hoe ~
=+ hom=$(hoe t.hoe)
%+ ~(put by hom) p.i.hoe
=+ vue=(~(get by hom) p.i.hoe)
[q.i.hoe ?~(vue ~ u.vue)]
^- (map path (list miso))
%+ reel hoe
|= [rak=tako hom=(map path (list miso))]
%+ ~(add ja hom) p.rak q.rak
::
++ alot
|= yop=(map path (list miso))
++ alot :: alot:ze
|= yop=(map path (list miso)) :: construct, inverse alda
^- (list tako)
=+ puy=(~(tap by yop) ~)
|- ^- (list tako)
?~ puy ~
(weld (turn q.i.puy |=(a=miso [p.i.puy a])) $(puy t.puy))
%- zing
%+ turn puy :: map on pair -> list tako
|= yup=[p=path q=(list miso)]
%+ turn q.yup :: map on miso -> tako
|= mis=miso
[p.yup mis]
::
++ alto :: alto:ze
|= $: wek=waks
yop=(map path (list miso)) :: yop before peq
peq=(map path (list miso))
peq=(map path (list miso)) :: aka miso commute
==
^+ [wek peq]
=+ puy=(~(tap by (~(gas by yop) (~(tap by peq) ~))) ~)
|- ^+ [wek peq]
?~ puy [wek peq]
=+ wof=(~(get by wek) p.i.puy)
=+ yoq=(~(get by yop) p.i.puy)
=+ peb=(~(get by peq) p.i.puy)
%+ roll puy
|= $: yup=[p=path q=(list miso)]
$: kew=_wek
qep=_peq
==
==
=+ wof=(~(get by kew) p.yup)
=+ yoq=(~(get by yop) p.yup)
=+ peb=(~(get by qep) p.yup)
=+ lyr=(lyre wof ?~(yoq ~ u.yoq) ?~(peb ~ u.peb))
%= $
wek ?~(-.lyr wek (~(put by wek) p.i.puy u.-.lyr))
puy t.puy
peq (~(put by peq) p.i.puy +.lyr)
==
:- ?~ -.lyr kew (~(put by kew) p.yup u.-.lyr)
(~(put by qep) p.yup +.lyr)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
++ lisp :: transform urge
@ -1021,32 +1026,32 @@
=+ woo=(lode wig) :: dimensions
?> =(p.woo 0) :: line
[~[q.woo] wig] :: extend
?@ i.dog
?- -.i.wig
&
?: =(i.dog p.i.wig)
?@ i.dog :: dog skip
?- -.i.wig :: dog skip, wig skip
& :: consume min(d,w) skip offset
?: =(i.dog p.i.wig) :: consume both
=+ mol=$(dog t.dog, wig t.wig)
[[i.dog p.mol] [[%& i.dog] q.mol]]
?: (lth i.dog p.i.wig)
?: (lth i.dog p.i.wig) :: consume dog, part of wig
=+ mol=$(dog t.dog, p.i.wig (sub p.i.wig i.dog))
[[i.dog p.mol] [[%& i.dog] q.mol]]
=+ mol=$(i.dog (sub i.dog p.i.wig), wig t.wig)
=+ mol=$(i.dog (sub i.dog p.i.wig), wig t.wig) :: consume wig, part of dog
[[p.i.wig p.mol] [[%& p.i.wig] q.mol]]
::
|
| :: dog skip, wig chunk
=+ leg=(lent p.i.wig)
?> (gte i.dog leg)
=+ mol=$(i.dog (sub i.dog leg), wig t.wig)
?> (gte i.dog leg) :: assert no conflict
=+ mol=$(i.dog (sub i.dog leg), wig t.wig) :: consume wig, part of dog
[[(lent q.i.wig) p.mol] [i.wig q.mol]]
==
?> ?=(& -.i.wig)
?: =(p.i.wig -.i.dog)
== :: wig skip, dog chunk
?> ?=(& -.i.wig) :: assert no conflct (2x chunk)
?: =(p.i.wig -.i.dog) :: consume both (chunk = skip)
=+ mol=$(dog t.dog, wig t.wig)
[[i.dog p.mol] [[%& +.i.dog] q.mol]]
?: (gth p.i.wig -.i.dog)
?: (gth p.i.wig -.i.dog) :: consume dog, part of wig
=+ mol=$(dog t.dog, p.i.wig (sub p.i.wig -.i.dog))
[[i.dog p.mol] [[%& +.i.dog] q.mol]]
!!
!! :: assert no conflict
::
++ lide :: merge dogs
|= [wig=woof dog=woof]
@ -1078,46 +1083,38 @@
[i.dog $(dog t.dog, i.wig (sub i.wig i.dog))]
[i.wig $(i.dog (sub i.dog i.wig), wig t.wig)]
::
++ lode
++ lode :: urge dimensions
|= wig=(urge)
^- [p=@ q=@]
=+ woo=[p=0 q=0]
|- ^- [p=@ q=@]
?~ wig woo
?- -.i.wig
%+ reel wig
|= [wug=(unce) [p=@ q=@]]
?- -.wug
&
$(-.woo (add p.i.wig -.woo), +.woo (add p.i.wig +.woo), wig t.wig)
:- (add p.wug p)
(add p.wug q)
|
%= $
-.woo (add (lent p.i.wig) -.woo)
+.woo (add (lent q.i.wig) +.woo)
wig t.wig
==
:- (add (lent p.wug) p)
(add (lent q.wug) q)
==
:: :: woof dimensions
++ wode
::
++ wode :: woof dimensions
|= dog=(list $|(@ud [p=@ud q=@ud]))
^- [p=@ q=@]
=+ woo=[q=0 q=0]
|- ^- [p=@ q=@]
?~ dog woo
?@ i.dog
$(-.woo (add i.dog -.woo), +.woo (add i.dog +.woo), dog t.dog)
%= $
-.woo (add -.i.dog -.woo)
+.woo (add +.i.dog +.woo)
dog t.dog
==
%+ reel dog
|= [dug=$|(@ud [p=@ud q=@ud]) [p=@ q=@]]
?@ dug
[(add dug p) (add dug q)]
[(add p.dug p) (add q.dug q)]
::
++ lith :: initial merge points
|= wig=(urge)
^- woof
:- %chan
|- ^- (list $|(@ud [p=@ud q=@ud]))
?~ wig ~
?- -.i.wig
& [p.i.wig $(wig t.wig)]
| [[(lent p.i.wig) (lent q.i.wig)] $(wig t.wig)]
%+ turn wig
|= wug=(unce)
?- -.wug
& p.wug
| [(lent p.wug) (lent q.wug)]
==
::
++ alho :: update woof, misos
@ -1150,18 +1147,19 @@
++ lyre :: put yeb before zeq
|= [wof=(unit woof) yeb=(list miso) zeq=(list miso)]
^- [(unit woof) (list miso)]
?~ yeb
?~ wof [wof zeq]
=+ alw=(alho u.wof zeq)
[wof +.alw]
?~ wof
?: &(?=(%mut -.i.yeb) ?=(%c -.q.p.i.yeb))
$(wof (some (lith p.q.p.i.yeb)), yeb t.yeb)
?: ?=(%mut -.i.yeb)
%- |= fow=(unit woof) :: postprocess roll
?~ fow [fow zeq]
:- fow +:(alho u.fow zeq)
%+ roll yeb
|= [mis=miso waf=(unit woof)]
?~ waf
?: &(?=(%mut -.mis) ?=(%c -.q.p.mis))
(some (lith p.q.p.mis))
?: ?=(%mut -.mis)
~| "Cannot generate merge with non textfile changes"
!!
$(yeb t.yeb, wof (some %know))
$(wof (some (lobo u.wof i.yeb)), yeb t.yeb)
(some %know)
(some (lobo u.waf mis))
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ amor :: amor:ze
@ -2178,9 +2176,9 @@
++ sec *ring :: private key
--
++ nu ^? :: reconstructors
|% ++ pit |=([a=@ b=@] ^?(..nu)) :: from [width seed]
++ nol |=(a=@ ^?(..nu)) :: from naked ring
++ com |=(a=@ ^?(..nu)) :: from naked pass
|% ++ pit |=([a=@ b=@] ^?(..nu)) :: from [width seed]
++ nol |=(a=@ ^?(..nu)) :: from naked ring
++ com |=(a=@ ^?(..nu)) :: from naked pass
--
--
++ agon (map ,[p=ship q=desk] ,[p=@ud q=@ud r=waks]) :: mergepts
@ -2329,7 +2327,18 @@
[%va p=@tas q=(unit vase)] :: set/clear variable
[%xx p=curd] :: return card
[%xy p=path q=curd] :: push card
[%xz p=[p=ship q=term] q=ship r=logo s=zang]
[%zz p=path q=path r=curd] ::
== ::
++ zang :: XX evil hack
$% [%backlog p=path q=?(%da %dr %ud) r=@] ::
[%hola p=path] ::
$: %mess p=path ::
$= q ::
$% [%do p=@t] :: act
[%exp p=@t q=tank] :: code
[%say p=@t] :: speak
== == == ::
++ gilt ,[@tas *] :: presumed gift
++ gens ,[p=lang q=gcos] :: general identity
++ germ ?(%fine %that %this %mate %conf) :: merge style
@ -2342,6 +2351,7 @@
== ::
++ goad :: common note
$% [%eg p=riot] :: simple result
[%gr p=logo q=*] :: gall rush/rust
[%hp p=httr] :: http response
:: [%ht p=@ud q=scab r=cred s=moth] :: http request
[%it p=~] :: interrupt event
@ -2357,6 +2367,7 @@
[%do p=vase q=vase] :: call gate sample
[%eg p=kite] :: single request
[%es p=ship q=desk r=rave] :: subscription
[%gr ~] :: gall response
[%ht p=(list rout)] :: http server
[%hp ~] :: http response
[%lq p=@tas] :: listen for service
@ -2623,7 +2634,7 @@
$: lit=@ud :: imperial modulus
any=@ :: entropy
urb=(map ship sufi) :: all keys and routes
fak=?
fak=? ::
== ::
++ tube ,[p=@ta q=@ta r=@ta s=path] :: canonical path
++ tutu ,* :: presumed type

103
main/app/radio/core.hoon Normal file
View File

@ -0,0 +1,103 @@
!:
=> |%
++ axle
$% [%0 p=(map path ,[p=(list zong) q=(set ship)])]
==
++ blitz
$% [%zong p=zong]
[%user p=ship]
==
++ iron
$% [%zongs p=(list zong)]
[%users p=(list ship)]
==
++ gift
$% [%rush blitz]
[%rust iron]
[%rasp ~]
==
++ mess :: message
$% [%do p=@t] :: act
[%exp p=@t q=tank] :: code
[%say p=@t] :: speak
==
++ move ,[p=bone q=(mold note gift)]
++ note ,~
++ zing
$% [%backlog p=path q=?(%da %dr %ud) r=@]
[%hola p=path]
[%mess p=path q=mess]
==
++ zong
$% [%mess p=@da q=ship r=mess]
==
--
|= *
|_ [hid=hide vat=axle]
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
:_ +>.$
=+ sta=*path
|- ^- (list move)
?: ?=(~ pax)
~
?. ?=(~ +.pax)
$(sta `path`[-.pax sta], pax `path`+.pax)
=. sta (flop sta)
?+ -.pax ~
%mensajes
:_ ~
:* ost %give %rust %zongs
%- flop
(scag 5 p:(fall (~(get by p.vat) sta) [p=*(list zong) q=*(set ship)]))
==
%amigos
:_ ~
:* ost %give %rust %users
(~(tap in q:(fall (~(get by p.vat) sta) [p=*(list zong) q=*(set ship)])))
==
==
::
++ poke-zing
|= [ost=bone you=ship zig=zing]
^- [(list move) _+>]
?- -.zig
%backlog
=+ ya=(fall (~(get by p.vat) p.zig) [p=*(list zong) q=*(set ship)])
:_ +>.$
%+ send (welp p.zig /mensajes)
:* %give %rust %zongs
?: ?=(%ud q.zig)
%- flop
%+ scag r.zig
p:(fall (~(get by p.vat) p.zig) [p=*(list zong) q=*(set ship)])
=+ ^= tim ?-(q.zig %da r.zig, %dr (sub lat.hid r.zig))
%- flop
|- ^- (list zong)
?: |(?=(~ p.ya) (lth p.i.p.ya tim)) ~
[i.p.ya $(p.ya t.p.ya)]
==
%hola
=+ ya=(fall (~(get by p.vat) p.zig) [p=*(list zong) q=*(set ship)])
?: (~(has in q.ya) you)
[~ +>.$]
=. p.vat (~(put by p.vat) p.zig [p.ya (~(put in q.ya) you)])
[(send (welp p.zig /amigos) %give %rush %user you) +>.$]
%mess
=+ zog=`zong`[%mess lat.hid you q.zig]
=+ ya=(fall (~(get by p.vat) p.zig) [p=*(list zong) q=*(set ship)])
=. p.vat (~(put by p.vat) p.zig [[zog p.ya] q.ya])
[(send (welp p.zig /mensajes) %give %rush %zong zog) +>.$]
==
::
++ send
|= [pax=path msg=(mold note gift)]
^- (list move)
%- turn :_ |=(ost=bone [ost msg])
^- (list bone)
%+ ~(rep by sup.hid) *(list bone)
|= [p=[p=bone q=[ship path]] q=(list bone)] ^- (list bone)
?. =(pax +.q.p) q
[p.p q]
--

View File

@ -5,39 +5,55 @@
+
=> +
=> ^/===/lib/pony
=> ^/===/lib/chat
=+ ^= flag
$? %all
%monitor
%never
%leet
%nub
%time
[%haus p=@p]
[%r p=room]
$? [%haus p=@p]
[%s p=path]
==
=+ flags=*(list flag)
=> |%
++ chk-flag |=(f=@tas (lien flags |=(flag =(f +<))))
++ chat :: user action
$% [%all p=mess] :: say
[%back p=?(%da %dr %ud) q=@] :: backlog
[%how ~] :: help
[%who ~] :: who
== ::
++ mess :: message
$% [%do p=@t] :: act
[%exp p=@t q=tank] :: code
[%say p=@t] :: say
== ::
++ station path ::
++ zing :: client to server
$% [%backlog p=path q=?(%da %dr %ud) r=@] ::
[%hola p=station] ::
[%mess p=station q=mess] ::
== ::
++ zong :: server to client
$% [%mess p=@da q=ship r=mess] ::
== ::
--
=> |%
++ chat
|= now=@da
%+ cook |=(a=^chat a)
;~ pose
(cold [%how ~] wut)
(cold [%out ~] zap)
%+ stag %who %+ stag %tcc (teklist ^room tis cen room)
(cold [%who %ttt ~] ;~(plug tis tis tis))
(cold [%who %tis ~] tis)
%+ stag %kil (teklist ,@p hep sig fed:ag)
%+ stag %res (teklist ,@p lus sig fed:ag)
;~(pfix pam (stag %all (stag %$ (stag %& mess))))
;~(pfix bar (stag %all (stag %$ (stag %| mess))))
(stag %say ;~(plug ;~(pfix sig fed:ag) ;~(pfix ace mess)))
(stag %def mess)
(cold [%who ~] tis)
(stag %back (dat now))
(stag %all mess)
==
::
++ teklist
|* [t=_,* pep=_rule pef=_rule sef=_rule]
;~(pfix pep (cook (list t) (plus (ifix [pef (star ace)] sef))))
++ dat
|= now=@da
%+ cook
|= p=coin
?. ?=(~ -.p) [%ud 5]
?+ p.p.p [%ud 5]
%da [%da q.p.p]
%dr [%dr q.p.p]
%ud [%ud q.p.p]
==
;~(pfix (jest '\\\\ ') nuck:so)
::
++ expn
%- sear
@ -48,312 +64,117 @@
?~ hun ~
?~(a ~ [~ a (sell (slap seed u.hun))])
::
++ room
%+ cook |=(a=(list ,@t) `^room`(crip a))
(plus ;~(pose low nud hep))
::
++ mess
%+ cook |=(a=^mess a)
;~ pose
(stag %do ;~(pfix pat text))
(stag %ex ;~(pfix hax expn))
(stag %exp ;~(pfix hax expn))
(stag %do (full (easy '')))
(stag %qu text)
(stag %say text)
==
++ text (boss 256 (star ;~(pose (shim 32 126) (shim 128 255))))
::
++ text (boss 256 (star prn))
--
|%
++ rend
|= [sen=@da roo=@tas chr=tape nym=tape dum=^mess] :: roo=^room
|= [from=@p msg=^mess] :: roo=^room
^- tank
=+ da=(yell sen)
?- -.dum
%do =+ msg=?:(=(0 p.dum) "remains quietly present" (trip p.dum))
:- %leaf
%+ welp
?. (chk-flag %time) ~
(weld (timestamp sen) " ")
"%{(trip roo)} {chr}{nym} {msg}"
%ex :~ %rose
[" " "" ""]
:- %leaf
%+ welp
?. (chk-flag %time) ~
(weld (timestamp sen) " ")
"%{(trip roo)} {chr}{nym} {(trip p.dum)}"
q.dum
==
%qu
:- %leaf
%+ welp
?. (chk-flag %time) ~
(weld (timestamp sen) " ")
"%{(trip roo)} {chr}{nym}: {(trip p.dum)}"
?- -.msg
%do =+ mes=?:(=(0 p.msg) "remains quietly present" (trip p.msg))
:- %leaf
"{<from>} {mes}"
%exp :~ %rose
[" " "" ""]
:- %leaf
"{<from>} {(trip p.msg)}"
q.msg
==
%say [%leaf "{<from>}: {(trip p.msg)}"]
==
::
++ timestamp
|= t=@da
=+ da=(yell t)
"{?:((gth 10 h.da) "0" "")}{(scow %ud h.da)}:".
"{?:((gth 10 m.da) "0" "")}{(scow %ud m.da)}"
++ read-wlist
|= pax=path
%- (unit (list))
=+ fil=((hard arch) .^(%cy pax))
?~ q.fil ~
`(cue p:((hard ,[%dtzy %uw p=@]) (ream ((hard ,@) .^(%cx pax)))))
--
::
==
=> %= .
-
:- :* bud=(sein `@p`-<) :: chat server
oot=_@ud :: outstanding, server
tod=*(map ,@p ,@ud) :: outstanding, friend
giz=*(list gift) :: stuff to send
sad=`sand`[%& &] :: default state
wak=_@da :: next wakeup
:- :* ami=*(set ship)
bud=(sein `@p`-<) :: chat server
dun=| :: done
kills=*(list ,@p)
roo=`^room`coci
giz=*(list gift) :: stuff to send
sta=*station :: station
sub=*(list path) :: subscriptions
==
[who=`@p`-< how=`path`->]
==
|= [est=time *]
|= args=(list flag)
=. flags `(list flag)`args
=+ sta=est :: move up to declaration of state
=. wak est
=. flags args
=. bud
?: (lien args |=(a=flag &(?=(^ a) ?=(%haus -.a))))
(roll args |=([p=flag q=@p] ?:(&(?=(^ p) ?=(%haus -.p)) p.p q)))
?: (lien args |=(a=flag ?=(%haus -.a)))
(roll args |=([p=flag q=@p] ?:(?=(%haus -.p) p.p q)))
bud
=. roo
?: (lien args |=(a=flag &(?=(^ a) ?=(%r -.a))))
(roll args |=([p=flag q=^room] ?:(&(?=(^ p) ?=(%r -.p)) p.p q)))
roo
=. kills %- (list ,@p)
%+ fall
(read-wlist /[(scot %p who)]/conf/[(scot %da est)]/chat/killfile/wlist)
~
=. sta
?: (lien args |=(a=flag ?=(%s -.a)))
(roll args |=([p=flag q=station] ?:(?=(%s -.p) p.p q)))
sta
|- ^- bowl
=< abet:init
|%
++ abet `bowl`[(flop giz) ?:(dun ~ [~ hope vent(giz ~)])]
++ hope :: wait for events
=< apex
|% ++ apex ^- (list slip)
;: weld
buds
pals
regs
==
::
++ buds ^- (list slip)
?: =(0 oot) ~
[[/re [%ow ~]] ~]
::
++ pals ^- (list slip)
=| alx=(list slip)
|- ^+ alx
?~ tod alx
%= $
tod r.tod
alx %= $
tod l.tod
alx :_(alx [[%ra (scot %p p.n.tod) ~] [%ow ~]])
==
==
::
++ regs ^- (list slip)
:~ [/ob [%lq %ob]]
[/wa [%wa wak]]
[/ya [%lq %ya]]
^- slip
:- /up
:+ %up %text
:_ ""
=+ wyt=?:(?=(& -.sad) !=(0 oot) (~(has by tod) p.sad))
%+ weld
?. ?=(& -.sad)
(scow %p p.sad)
:(weld "%" (trip roo) ?:(p.sad " &" " |"))
?:(wyt "... " " ")
==
--
++ hope
:_ (turn sub |=(pax=path [[%gr pax] [%gr ~]]))
[/up [%up %text ["& " ""]]]
::
++ init (joke:(joke ~ [%who roo ~]) ~ [%ego roo est])
++ init (subs:(subs:(joke %hola sta) (welp sta /mensajes)) (welp sta /amigos))
++ joke :: send message
|= [hur=(unit ,@p) msg=*]
|= msg=zing
^+ +>
?~ hur
+>(oot +(oot), giz :_(giz [%sq bud %bo /re msg]))
%= +>
giz :_(giz [%sq u.hur %ya [%ra (scot %p u.hur) ~] msg])
tod =+ dut=(~(get by tod) u.hur)
(~(put by tod) u.hur ?~(dut 1 +(u.dut)))
==
+>(giz :_(giz [%xz [bud %radio] who %zing msg]))
::
++ nice :: got response
|= [hur=(unit ,@p) kay=cape]
++ join
|= you=ship
^+ +>
=. +>
?~ hur
+>(oot (dec oot))
=+ dyt=(need (~(get by tod) u.hur))
%_ +>.$
tod
?: =(1 dyt)
(~(del by tod) u.hur)
(~(put by tod) u.hur (dec dyt))
==
?- kay
%good +>
%dead (show %leaf "server {(scow %p ?~(hur bud u.hur))} choked")
==
::
++ priv :: private message
|= [now=@da her=@p mes=^mess]
%+ show(ami (~(put in ami) you))
%leaf
"{(scow %p you)} comes on the air"
++ joyn
|= yall=(list ship)
^+ +>
?: (dead her) +>
=+ ^= nym
=+ yow=(scot %p her)
=+ ^= woy
%- (hard ,@t)
.^(%a (scot %p who) %name (scot %da now) (scot %p her) ~)
?: =(%$ woy) yow
(cat 3 yow (cat 3 ' ' woy))
(show (rend est '(private)' "" (trip nym) mes))
%- shew(ami (~(gas in ami) yall))
(turn yall |=(you=ship [%leaf "{(scow %p you)} comes on the air"]))
::
++ said :: server message
|= [her=@p duz=(list zong)]
|= duz=(list zong)
^+ +>
?~ duz +>
%= $
duz t.duz
+>
=. giz
?. ?& ?=(%all -.i.duz)
=+ ^= r
%+ rexp (scow %p who)
(trip =>(t.i.duz ?@(+ p p)))
&(!=(~ r) !=([~ ~] r) !=([~ ~ ~] r))
==
~
[[%xy /d [%blit [%bel ~]~]] giz]
%- shew
^- (list tank)
%- show
^- tank
?- -.i.duz
%all
?: |((dead p.s.i.duz) !=(roo q.i.duz))
~
:_ ~
%- rend
:* p.i.duz
q.i.duz
?:(=(%white r.i.duz) "& " "| ")
(trip q.s.i.duz)
t.i.duz
==
%who
?. =(q.i.duz roo) ~
%+ ~(rep by r.i.duz) *(list tank)
|= [p=[r=^room u=(list user)] q=(list tank)]
:* [%leaf "%{(trip r.p)}:"]
:+ %rose [", " " " ""]
%+ turn
%+ weld
(skim u.p |=(a=user =(p.a who)))
(skip u.p |=(a=user =(p.a who)))
|=(a=user [%leaf (trip q.a)])
q
==
?(%new %out)
?. ?& !(dead p.r.i.duz)
=(q.i.duz roo)
?| (chk-flag %all)
?& (lth sta p.i.duz)
(chk-flag %monitor)
== ==
==
~
:_ ~ :- %leaf
;: weld
?. (chk-flag %time) ~
(timestamp p.i.duz)
?- -.i.duz
%new " +"
%out " -"
==
?: (chk-flag %nub)
(trip q.r.i.duz)
(scow %p p.r.i.duz)
?: (chk-flag %monitor) ~
(weld " %" (trip q.i.duz))
== ==
==
::
++ dead
|= her=@p
(lien kills |=(@p =(her +<)))
::
++ kill
|= her=(list ,@p)
%= +>
kills (weld her (skip kills |=(a=@p (lien her |=(b=@p =(a b))))))
giz
=+ j=(jam (weld her (skip kills |=(a=@p (lien her |=(b=@p =(a b)))))))
=+ encoded=(cat 3 (scot %uw j) `@t`10) :: Base-64 encoding
:_ giz
:- %ok
(foal /[(scot %p who)]/conf/[(scot %da est)]/chat/killfile/wlist encoded)
==
::
++ resurrect
|= her=(list ,@p)
%= +>
kills (skip kills |=(a=@p (lien her |=(b=@p =(a b)))))
giz
=+ j=(jam (skip kills |=(a=@p (lien her |=(b=@p =(a b))))))
=+ encoded=(cat 3 (scot %uw j) `@t`10) :: Base-64 encoding
:_ giz
:- %ok
(foal /[(scot %p who)]/conf/[(scot %da est)]/chat/killfile/wlist encoded)
==
%mess (rend q.i.duz r.i.duz)
== ==
::
++ shew |=(tax=(list tank) +>(giz [[%lo tax] giz])) :: print to screen
++ show |=(tan=tank +>(giz [[%la tan] giz])) :: print to screen
++ take :: alarm event
|- ^+ +
=. wak (add ~m1 (max wak est))
?.(=(0 oot) + (joke ~ `zing`[%ego roo est]))
::
++ subs
|= pax=path
^+ +>
+>(sub [pax sub], giz :_(giz [%zz /g [%gr pax] %show [bud %radio] who pax]))
::
++ toke :: user action
|= txt=@t
|= [now=@da txt=@t]
^+ +>
?: =(0 txt) +>
=+ rey=(rush txt chat)
=+ rey=(rush txt (chat now))
?~ rey
(show %leaf "invalid input")
?- -.u.rey
%all ?~ p.u.rey
(joke(sad [%& q.u.rey]) ~ `zing`[%all roo q.u.rey r.u.rey])
(joke(sad [%& q.u.rey]) ~ `zing`u.rey)
%def
%- joke
?: ?=(& -.sad)
[~ `zing`[%all roo p.sad p.u.rey]]
[[~ p.sad] `^mess`p.u.rey]
%how (shew (turn (lore ^:@/===doc%/help/txt) |=(a=@t [%leaf (trip a)])))
%out (show(dun &) %leaf "see you space cowboy...")
%say (joke(sad [%| p.u.rey]) [~ p.u.rey] `^mess`q.u.rey)
%who ?- p.u.rey
%tis %+ joke ~ ^- zing :+ %who roo `~[roo]
%ttt %+ joke ~ ^- zing :+ %who roo ~
%tcc %+ joke ~ ^- zing :+ %who roo `q.u.rey
==
%kil (kill p.u.rey)
%res (resurrect p.u.rey)
%all (joke %mess sta p.u.rey)
%back (joke %backlog sta p.u.rey q.u.rey)
%how (shew (turn (lore ^:@/===doc%/help/txt) |=(a=@t [%leaf (trip a)])))
%who (show %rose [", " "" ""] (turn (~(tap in ami)) |=(p=ship >p<)))
==
::
++ vent :: handle event
@ -361,23 +182,14 @@
^- bowl
=. est now
=< abet
?+ -.pax +>
%ob
?> ?=(%lq -.nut)
=+ n=((soft (list zong)) r.nut)
?~ n
~& %chat-zong-fail +>+
(said p.nut u.n)
%re ?>(?=(%ow -.nut) (nice ~ p.nut))
%ra ?> &(?=(%ow -.nut) ?=(^ t.pax))
(nice [~ (need (slaw %p i.t.pax))] p.nut)
%up ?>(?=(%up -.nut) (toke p.nut))
%wa ?>(?=(%wa -.nut) take)
%ya
?> ?=(%lq -.nut)
=+ n=((soft ^mess) r.nut)
?~ n
~& %chat-zong-fail +>+
(priv now p.nut u.n)
?+ -.pax ~& [%chat-vent-unknown -.nut] +>.$
%gr ?> ?=(%gr -.nut)
?+ p.nut ~& %vent-rush-logo-fail +>.$
%user (join ((hard ship) q.nut))
%users (joyn ((hard (list ship)) q.nut))
%zong (said [((hard zong) q.nut) ~])
%zongs (said ((hard (list zong)) q.nut))
==
%up ?>(?=(%up -.nut) (toke now p.nut))
==
--

38
try/bin/flopp.hoon Normal file
View File

@ -0,0 +1,38 @@
!:
:: /=main=/bin/app/hoon
::
=> %= .
+
=> +
|%
++ sii !:
=| *
|%
+- $
?~ +<
+<
$(+< +<+)
--
++ flopp
=| *
=| *
|%
+- $
?~ +<
?~ +>- ~
+>-
?~ +>-
$(+< +<+, +>- [+<- +<+(. ~)])
$(+< +<+, +>- [+<- +<+(. +>-)])
--
--
==
|= *
|= ~
^- bowl
:_ ~ :_ ~
:- %$
!>
=+ x=[i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]]
=+ y=(limo [1 2 3 4 ~])
(flopp x)