1
0
mirror of https://github.com/ilyakooo0/urbit.git synced 2024-12-22 22:31:30 +03:00
urbit/mar/talk/telegrams.hoon

321 lines
8.3 KiB
Plaintext
Raw Normal View History

2015-09-03 00:53:11 +03:00
::
:::: /hoon/talk-telegrams/mar
::
/? 314
/- talk
2015-09-15 20:45:04 +03:00
/+ talk
2015-09-03 00:53:11 +03:00
!:
=+ talk
2015-09-03 00:53:11 +03:00
|_ gam=(list telegram)
::
2015-09-15 04:03:40 +03:00
++ grab-work-duty => [jo work-stuff]
|^ dute
++ as
:: |*(a=fist (cu sa (ar a))) :: XX types
|* a=fist
%- cu :_ (ar a)
~(gas in *(set ,_(need *a)))
++ ot
|* a=(pole ,[@tas fist])
|= b=json
%. ((^ot a) b)
%- slog
?+ b ~
[%o *]
%+ murn `(list ,[@tas fist])`a
|= [c=term d=fist] ^- (unit tank)
=+ (~(get by p.b) c)
?~ - (some >[c (turn (~(tap by p.b)) head)]<)
=+ (d u)
?~ - (some >[c u]<)
~
==
++ of
|* a=(pole ,[@tas fist])
|= b=json
%. ((of:jo a) b)
%- slog
?+ b ~
[%o *]
%+ murn `(list ,[@tas fist])`a
|= [c=term d=fist] ^- (unit tank)
=+ (~(get by p.b) c)
?~ - ~
=+ (d u)
?~ - (some >[c u]<)
~
==
++ id (ci (slat %uv) so)
++ ship (su fed:ag)
++ dute
%- of :~
create/task change/(ot id/id meat/uppd ~)
archive/id update/(ot id/id version/ni her/(su fed:ag) meat/uppd ~)
==
++ task
%- ot :~
id/id 'date_created'^di
version/ni 'date_modified'^di
creator/ship doer/(mu ship)
tags/(as so) 'date_due'^(mu di)
done/(mu di) title/so
description/so discussion/(ar (ot date/di ship/ship body/so ~))
==
++ audi (as stan)
++ stan (su ;~((glue fas) ;~(pfix sig fed:ag) urs:ab))
++ uppd
%- of :~
set-doer/(mu (su fed:ag))
set-date-due/(mu di)
set-tags/(as so)
set-title/so
set-description/so
set-done/bo
add-comment/so
==
--
++ grow-work-duty
=> work-stuff
=+ jope=|=(a=ship [%s (rsh 3 1 (scot %p a))])
=+ jove=|=(a=@uvI [%s (scot %uv a)])
=< |= duty
%+ joba +<-
?- +<-
%create (task tax)
%archive (jove id)
%change (jobe id/(jove id) meat/(flesh meat) ~)
%update
%- jobe :~
id/(jove id)
version/(jone version)
her/(jope her)
meat/(flesh meat)
==
==
|%
++ tags
|= a=(set ,@t)
[%a (turn (sort (~(tap in a)) aor) |=(b=cord s/b))]
::
++ task
|= ^task
%- jobe :~ id/[%s (scot %uv id)]
tags/(^tags tags)
doer/?~(doer ~ (jope u.doer))
title/[%s title]
creator/(jope creator)
version/(jone version)
'date_created'^(jode date-created)
'date_modified'^(jode date-modified)
description/[%s description]
=< discussion/[%a (turn discussion .)]
|=(comment (jobe date/(jode date) ship/(jope ship) body/[%s body] ~))
'date_due'^?~(date-due ~ (jode u.date-due))
done/?~(done ~ (jode u.done))
==
++ flesh
|= ^flesh
%+ joba +<-
?- +<-
%set-doer ?~(her ~ (jope u.her))
%set-date-due ?~(wen ~ (jode u.wen))
%set-tags (tags tag)
%set-title [%s til]
%set-description [%s des]
%set-done [%b don]
%add-comment [%s com]
==
--
2015-09-03 00:53:11 +03:00
++ grab
|%
++ noun (list telegram)
++ mime |=(^mime (json (rash q.q apex:poja)))
++ json
2015-09-15 04:03:40 +03:00
=> [jo ..telegram dute=grab-work-duty]
2015-09-03 00:53:11 +03:00
|= a=json ^- (list telegram)
=- (need ((ar (ot ship/(su fed:ag) thought/thot ~)) a))
|%
2015-09-15 04:03:40 +03:00
++ of
|* a=(pole ,[@tas fist])
|= b=json
%. ((of:jo a) b)
%- slog
?+ b ~
[%o *]
%+ murn `(list ,[@tas fist])`a
|= [c=term d=fist] ^- (unit tank)
=+ (~(get by p.b) c)
?~ - ~
=+ (d u)
?~ - (some >[c u]<)
~
==
2015-09-03 00:53:11 +03:00
++ op :: parse keys of map
|* [fel=_rule wit=fist]
%+ cu mo
%- ci :_ (om wit)
|= a=(map cord ,_(need *wit))
^- (unit (list ,_[(wonk *fel) (need *wit)]))
(zl (turn (~(tap by a)) (head-rush fel)))
::
++ as :: array as set
:: |*(a=fist (cu sa (ar a))) :: XX types
|* a=fist
%- cu :_ (ar a)
~(gas in *(set ,_(need *a)))
::
2015-09-15 04:03:40 +03:00
++ ke :: callbacks
|* [gar=* sef=_|.(fist)]
|= jon=json
^- (unit ,_gar)
=- ~! gar ~! (need -) -
((sef) jon)
2015-09-03 00:53:11 +03:00
::
2015-09-15 04:03:40 +03:00
++ lake |*(a=_,* $+(json (unit a)))
2015-09-03 00:53:11 +03:00
++ head-rush
|* a=_rule
|* [b=cord c=*]
=+ nit=(rush b a)
?~ nit ~
(some [u.nit c])
::
::
++ thot
^- $+(json (unit thought))
%- ot :~
serial/(ci (slat %uv) so)
audience/audi
statement/stam
==
::
++ audi (op parn memb) :: audience
++ auri (op parn (ci (soft presence) so))
++ memb (ot envelope/lope delivery/(ci (soft delivery) so) ~)
++ lope (ot visible/bo sender/(mu (su parn)) ~)
::
++ parn
^- $+(nail (like partner))
2015-09-15 04:03:40 +03:00
%+ pick
2015-09-03 00:53:11 +03:00
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
%+ sear (soft passport)
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
::
2015-09-15 04:03:40 +03:00
++ stam (ot date/di bouquet/(as (ar so)) speech/spec ~)
++ spec
%+ ke *speech |. ~+
%- of :~
lin/(ot say/bo txt/so ~)
2015-09-15 20:45:04 +03:00
url/(ot txt/(su aurf:urlp) ~)
exp/(ot txt/so ~)
tax/(ot xat/dute ~)
2015-09-15 04:03:40 +03:00
app/(ot txt/so src/so ~)
fat/(ot tor/tors taf/spec ~)
ext/(ot nom/so txe/blob ~)
non/ul
:: inv/(ot ship/(su fed:ag) party/(su urs:ab) ~)
==
++ tors
%+ ke *torso |. ~+
%- of :~
name/(ot nom/so mon/tors ~)
2015-09-16 02:26:22 +03:00
text/(cu lore so)
tank/(ot dat/(cu (hard (list tank)) blob) ~)
2015-09-03 00:53:11 +03:00
==
2015-09-15 04:03:40 +03:00
::
++ blob (cu cue (su fel:ofis))
2015-09-03 00:53:11 +03:00
--
--
::
++ grow
|%
++ mime [/text/json (taco (crip (pojo json)))]
++ json
=> +
|^
:- %a
%+ turn gam
|= telegram
(jobe ship/(jope p) thought/(thot q) ~)
::
++ jove
|= [a=envelope b=delivery]
%- jobe :~
envelope/(jobe visible/[%b p.a] sender/?~(q.a ~ s/(parn u.q.a)) ~)
delivery/[%s b]
==
::
++ jope |=(a=ship (jape +:<a>)) ::[%s (crip +:(scow %p a))])
2015-09-15 20:50:30 +03:00
++ joke |=(a=tank [%s (role (turn (wash 0^80 a) crip))])
2015-09-03 00:53:11 +03:00
++ jode |=(a=time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1)))
++ jome :: stringify keys
|* [a=_cord b=_json]
|= c=(map ,_+<.a ,_+<.b)
(jobe (turn (~(tap by c)) (both a b)))
::
++ both :: cons two gates
|* [a=_,* b=_,*]
|=(c=_[+<.a +<.b] [(a -.c) (b +.c)])
::
++ thot
|= thought
(jobe serial/(jape <p>) audience/(audi q) statement/(stam r) ~)
::
++ audi (jome parn jove)
++ bouq
|= a=bouquet
a/(turn (~(tap in a)) |=(b=path a/(turn b |=(c=span s/c))))
::
++ parn
|= a=partner ^- cord
?- -.a
%& (stat p.a)
%| %- crip
?- -.p.a
%twitter "{(trip -.p.a)}/{(trip p.p.a)}"
==
==
::
++ stat
|= a=station ^- cord
(crip "{<p.a>}/{(trip q.a)}")
::
++ stam
|= statement
(jobe date/(jode p) bouquet/(bouq q) speech/(spec r) ~)
::
++ spec
|= a=speech
%+ joba -.a
?+ -.a ~|(stub/-.a !!)
%lin (jobe txt/[%s q.a] say/[%b p.a] ~)
2015-09-15 20:45:04 +03:00
%url (joba txt/(jape (earf p.a)))
%exp (joba txt/[%s p.a])
%tax (jobe txt/(jape (rend-work-duty p.a)) xat/(grow-work-duty p.a) ~)
2015-09-03 00:53:11 +03:00
%app (jobe txt/[%s q.a] src/[%s p.a] ~)
%fat (jobe tor/(tors p.a) taf/$(a q.a) ~)
2015-09-15 04:03:40 +03:00
%ext (jobe nom/[%s p.a] txe/(jape (sifo (jam +.a))) ~)
%non ~
2015-09-03 00:53:11 +03:00
:: %inv (jobe ship/(jope p.a) party/[%s q.a] ~)
==
::
++ tors
|= a=torso
%+ joba -.a
?- -.a
%text [%s (role +.a)]
2015-09-15 20:50:30 +03:00
%tank (jobe txt/[%a (turn +.a joke)] dat/(jape (sifo (jam +.a))) ~)
2015-09-03 00:53:11 +03:00
%name (jobe nom/s/p.a mon/$(a q.a) ~)
==
::
--
--
::
2015-09-03 02:20:11 +03:00
++ grad
|%
++ form %talk-telegrams
++ diff |=((list telegram) +<)
++ pact |=((list telegram) +<)
++ join |=([(list telegram) (list telegram)] `(unit mime)`~)
--
2015-09-03 00:53:11 +03:00
--