urbit/lib/talk.hoon

221 lines
5.1 KiB
Plaintext
Raw Normal View History

2015-01-15 22:32:04 +03:00
::
2016-02-11 03:41:28 +03:00
:::: /hoon/talk/lib
::
2015-01-15 22:32:04 +03:00
:: This file is in the public domain.
::
/? 310
/- talk
2016-11-17 04:42:58 +03:00
::
2015-01-15 22:32:04 +03:00
::::
::
2015-09-02 03:24:18 +03:00
[. ^talk]
|_ bol/bowl:gall
2015-01-15 22:32:04 +03:00
++ main :: main story
2017-06-14 04:06:38 +03:00
|= who/ship
^- cord
=+ can=(clan:title who)
2015-01-15 22:32:04 +03:00
?+ can %porch
2015-12-09 04:54:26 +03:00
$czar %court
$king %floor
==
2015-06-02 21:36:56 +03:00
::
::TODO add to zuse?
++ true-self
|= who/ship
?. ?=($earl (clan:title who)) who
(sein:title who)
::
2017-06-14 03:51:10 +03:00
++ above
|= who/ship
?: ?=($czar (clan:title who)) ~zod
(sein:title who)
2015-06-02 21:36:56 +03:00
::
2016-03-15 03:37:34 +03:00
++ said-url :: app url
|= url/purl:eyre
2016-03-15 04:02:59 +03:00
:^ ost.bol %poke /said-url
:+ [our.bol %talk] %talk-action
^- action
:+ %phrase
[[our.bol (main our.bol)] ~ ~]
[%app dap.bol (crip (en-purl:html url))]~ :: XX
2016-03-15 03:37:34 +03:00
::
2015-06-02 02:25:22 +03:00
++ said :: app message
2016-08-11 21:15:06 +03:00
|= {our/@p dap/term now/@da eny/@uvJ mes/(list tank)}
:- %talk-action
^- action
:- %convey
|- ^- (list thought)
?~ mes ~
2015-06-06 02:01:44 +03:00
:_ $(mes t.mes, eny (sham eny mes))
^- thought
:+ (shaf %thot eny)
[[our (main our)] ~ ~]
2017-07-01 03:37:28 +03:00
[now [%app dap (crip ~(ram re i.mes))]]
::
++ uniq
|= eny/@uvJ
^- {serial _eny}
[(shaf %serial eny) (shax eny)]
::
++ change-glyphs ::< ...
::>
::
|= {gys/(jug char (set circle)) bin/? gyf/char cis/(set circle)}
^+ gys
:: simple bind.
?: bin (~(put ju gys) gyf cis)
:: unbind all of glyph.
?~ cis (~(del by gys) gyf)
:: unbind single.
(~(del ju gys) gyf cis)
::
2017-06-22 03:16:22 +03:00
++ change-nicks ::< change nick map
::> changes a nickname in a map, adding if it doesn't
::> yet exist, removing if the nickname is empty.
::
|= {nis/(map ship cord) who/ship nic/cord}
^+ nis
?: =(nic '')
(~(del by nis) who)
(~(put by nis) who nic)
::
2017-06-22 03:16:22 +03:00
++ change-config ::< apply config diff
::> applies a config diff to the given config.
::
|= {cof/config dif/diff-config}
^+ cof
?- -.dif
$full cof.dif
$caption cof(cap cap.dif)
$filter cof(fit fit.dif)
$remove cof
::
$source
%= cof
src
%. cir.dif
?: add.dif
~(put in src.cof)
~(del in src.cof)
==
::
$permit
%= cof
ses.con
%. sis.dif
?: add.dif
~(uni in ses.con.cof)
~(dif in ses.con.cof)
==
::
$secure
%= cof
sec.con
sec.dif
::
ses.con
?. .= ?=(?($white $green) sec.dif)
?=(?($white $green) sec.con.cof)
~
ses.con.cof
==
==
::
2017-06-22 03:16:22 +03:00
++ change-status ::< apply status diff
::> applies a status diff to the given status.
::
|= {sat/status dif/diff-status}
^+ sat
?- -.dif
$full sat.dif
$presence sat(pec pec.dif)
$remove sat
::
$human
%= sat
man
?- -.dif.dif
$full man.dif.dif
$true [han.man.sat tru.dif.dif]
$handle [han.dif.dif tru.man.sat]
==
==
==
::
2017-06-14 04:06:38 +03:00
::TODO annotate all!
++ depa :: de-pathing core
=> |% ++ grub * :: result
++ weir (list coin) :: parsed wire
++ fist $-(weir grub) :: reparser instance
--
|%
::
++ al
|* {hed/$-(coin *) tal/fist}
|= wir/weir ^+ [*hed *tal]
?~ wir !!
[(hed i.wir) (tal t.wir)]
::
++ at
|* typ/{@tas (pole @tas)}
=+ [i-typ t-typ]=typ
|= wer/weir
^- (tup:dray:wired i-typ t-typ) ::< ie, (tup %p %tas ~) is {@p @tas}
?~ wer !!
?~ t-typ
?^ t.wer !!
((do i-typ) i.wer)
:- ((do i-typ) i.wer)
(^$(typ t-typ) t.wer)
::
++ mu :: true unit
|* wit/fist
|= wer/weir
?~(wer ~ (some (wit wer)))
::
++ af :: object as frond
|* buk/(pole {cord fist})
|= wer/weir
?> ?=({{$$ $tas @tas} *} wer)
?~ buk !!
=+ [[tag wit] t-buk]=buk
?: =(tag q.p.i.wer)
[tag ~|(tag+`@tas`tag (wit t.wer))]
2017-10-06 14:29:15 +03:00
?~ t-buk ~|(bad-tag+`@tas`q.p.i.wer !!)
(^$(buk t-buk) wer)
::
++ or
=+ tmp=|-($@(@tas {@tas $})) ::TODO typ/that syntax-errors...
|* typ/tmp
|= con/coin
::^- _(snag *@ (turn (limo typ) |*(a/@tas [a (odo:raid:wired a)])))
?> ?=($$ -.con)
=/ i-typ ?@(typ typ -.typ)
?: =(i-typ p.p.con)
:- i-typ
^- (odo:raid:wired i-typ)
q.p.con
?@ typ ~|(%bad-odor !!)
(^$(typ +.typ) con)
::
++ do
|* typ/@tas
2017-06-14 04:06:38 +03:00
=/ typecheck `@tas`typ
|= con/coin
^- (odo:raid:wired typ)
?. ?=($$ -.con) ~|(%not-dime !!)
?. =(typ p.p.con) ~|(bad-odor+`@tas`p.p.con !!)
q.p.con
::
++ ul :: null
|=(wer/weir ?~(wer ~ !!))
::
++ un
|* wit/$-(coin *)
2017-06-14 04:06:38 +03:00
|= wer/weir ^+ *wit
?~ wer !!
?^ t.wer !!
(wit i.wer)
--
2015-01-15 22:32:04 +03:00
--