merge in hall changes from mark branch

This commit is contained in:
Anthony 2018-03-06 17:47:43 -08:00
commit 645d2d8b30
6 changed files with 71 additions and 49 deletions

View File

@ -1210,6 +1210,7 @@
?=(^ tal.u.ran.src)
::
?- -.u.tal.u.ran.src
$sd &
$da (gte now.bol +.u.tal.u.ran.src)
$ud ?& ?=(^ seq)
(gte u.seq +.u.tal.u.ran.src)
@ -1227,29 +1228,40 @@
|= ran/range
^- (list telegram)
=+ [num=0 gaz=grams zeg=*(list telegram)]
:: fill in empty ranges to select all grams.
:: fill in empty ranges to select all grams,
:: and calculate absolutes for relative places.
=. ran
?~ ran `[[%ud 0] `[%ud count]]
?~ tal.u.ran `[hed.u.ran `[%ud count]]
=* hed hed.u.ran
=? hed ?=($sd -.hed)
[%ud (sub count (min count (abs:si +.hed)))]
?~ tal.u.ran `[hed `[%ud count]]
=* tal u.tal.u.ran
=? tal ?=($sd -.tal)
[%ud (sub count (min count (abs:si +.tal)))]
ran
:: never fails, but compiler needs it.
?> &(?=(^ ran) ?=(^ tal.u.ran))
=* hed hed.u.ran
=* tal u.tal.u.ran
%- flop
|- ^- (list telegram)
?~ gaz zeg
?: ?- -.u.tal.u.ran :: after the end
$ud (lth +.u.tal.u.ran num)
$da (lth +.u.tal.u.ran wen.i.gaz)
?: ?- -.tal :: after the end
$sd !! :: caught above
$ud (lth +.tal num)
$da (lth +.tal wen.i.gaz)
==
:: if past the river, we're done searching.
:: if past the range, we're done searching.
zeg
?: ?- -.hed.u.ran :: before the start
$ud (lth num +.hed.u.ran)
$da (lth wen.i.gaz +.hed.u.ran)
?: ?- -.hed :: before the start
$sd !! :: caught above
$ud (lth num +.hed)
$da (lth wen.i.gaz +.hed)
==
:: if before the river, continue onward.
:: if before the range, continue onward.
$(num +(num), gaz t.gaz)
:: if in the river, add this gram and continue.
:: if in the range, add this gram and continue.
$(num +(num), gaz t.gaz, zeg [i.gaz zeg])
::
++ so-in-range
@ -1265,16 +1277,20 @@
^- {in/? done/?}
?~ ran [& |]
=/ min
?- -.hed.u.ran
$ud (gth count +.hed.u.ran)
$da (gth now.bol +.hed.u.ran)
=* hed hed.u.ran
?- -.hed
$sd & :: relative is always in.
$ud (gth count +.hed)
$da (gth now.bol +.hed)
==
?~ tal.u.ran
[min |]
=- [&(min -) !-]
?- -.u.tal.u.ran
$ud (gte +(+.u.tal.u.ran) count)
$da (gte +.u.tal.u.ran now.bol)
=* tal u.tal.u.ran
?- -.tal
$sd | :: relative is always done.
$ud (gte +(+.tal) count)
$da (gte +.tal now.bol)
==
::
:> #

View File

@ -229,8 +229,8 @@
%+ welp /circle/[inbox]/grams/config/group
?. =(0 count)
[(scot %ud last) ~]
=+ history-days=~d5
[(scot %da (sub now.bol history-days)) ~]
=+ history-msgs=200
[(cat 3 '-' (scot %ud history-msgs)) ~]
==
::
:> #
@ -700,7 +700,7 @@
;~ pose
(cold [%da now.bol] (jest 'now'))
(stag %da (drat hed))
(stag %ud dem:ag)
placer
==
::
++ rang :< subscription range

View File

@ -22,18 +22,4 @@
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
=/ mon (mix (lsh 5 1 (end 5 1 eny)) p.bec)
=/ tic .^(@ /a/(scot %p p.bec)/tick/(scot %da now)/(scot %p mon))
%+ sole-yo
leaf+"(see https://github.com/urbit/arvo/issues/327 for details)"
%+ sole-yo
:- %leaf
;: weld
"WARNING: linking a moon to your "
?-(ran $czar "galaxy", $king "star", $duke "planet")
" can cause networking bugs"
==
%+ sole-lo
[& %$ "enter y/yes to continue: "]
|= inp/tape
?. |(=("y" inp) =("yes" inp))
(sole-so [%tang leaf+"canceled" ~])
(sole-so [%tang leaf+"moon: {<`@p`mon>}; ticket: {<`@p`tic>}" leaf+"" ~])
(sole-so [%tang leaf+"ticket: {<`@p`tic>}" leaf+"moon: {<`@p`mon>}" ~])

View File

@ -66,10 +66,20 @@
|= ran/range
^- path
?~ ran ~
%+ welp
/(scot -.hed.u.ran +.hed.u.ran)
:- (place-to-knot hed.u.ran)
?~ tal.u.ran ~
/(scot -.u.tal.u.ran +.u.tal.u.ran)
[(place-to-knot u.tal.u.ran) ~]
::
++ place-to-knot
:> msg pointer to path component
:>
:> turns a place structure into a knot for use in
:> subscription paths.
::
|= pla/place
^- knot
?. ?=($sd -.pla) (scot -.pla +.pla)
(cat 3 '-' (scot %ud (abs:si +.pla)))
::
++ path-to-range
:> path to msg range
@ -80,18 +90,27 @@
|= pax/path
^- range
?~ pax ~
=/ hes/(unit place) (rush i.pax placer)
:: skip past non-number parts of path.
?: ?=({$~ $~} [(slaw %da i.pax) (slaw %ud i.pax)])
$(pax t.pax)
:+ ~
=+ hed=(slaw %da i.pax)
?^ hed [%da u.hed]
[%ud (slav %ud i.pax)]
?~ hes $(pax t.pax)
:+ ~ u.hes
?~ t.pax ~
:- ~
=+ tal=(slaw %da i.t.pax)
?^ tal [%da u.tal]
[%ud (slav %ud i.t.pax)]
(rush i.t.pax placer)
::
++ placer
:> parse a range place
;~ pose
(stag %ud dem:ag)
::
=- (stag %da (sear - crub:so))
|= a/dime
^- (unit @da)
?:(?=($da p.a) `q.a ~)
::
%+ stag %sd
%+ cook (cury new:si |)
;~(pfix hep dem:ag)
==
::
++ change-glyphs :< ...
::

View File

@ -55,6 +55,7 @@
++ place :> range indicators
$% {$da @da} :< date
{$ud @ud} :< message number
{$sd @sd} :< previous messages
== ::
++ prize :> query result
$% {$client prize-client} :< /client

View File

@ -277,7 +277,7 @@
:> input if it fits or a default value if it doesn't.
:>
:> examples: * @ud ,[p=time q=?(%a %b)]
_|=(* +<)
_|~(* +<)
::
++ pair
:> dual tuple