lull: implement +wyt for getting the size of a |deq

This commit is contained in:
yosoyubik 2023-03-22 12:26:50 +01:00
parent 9772114f6f
commit 2545e05c7a
3 changed files with 22 additions and 12 deletions

View File

@ -80,6 +80,15 @@
[* * * * ~] [%4 ls]
==
::
++ wyt
|= a=(pha val)
^- @ud
?- -.a
%nul 0
%one 1
%big :(add (lent +.p.a) (lent +.r.a) $(a q.a))
==
::
++ afx-to-pha
|= =(afx val)
^- (pha val)

View File

@ -3092,11 +3092,6 @@
++ packet-queue
%- (ordered-map live-packet-key live-packet-val)
lte-packets
:: +live-packets: number of sent packets awaiting ack
::
:: ++ live-packets
:: ^- @ud
:: ~(wyt by live.state)
:: +gauge: inflate a |pump-gauge to track congestion control
::
++ gauge (ga metrics.state ~(wyt by live.state))
@ -3715,13 +3710,13 @@
(call %done ok=%.y)
--
--
:: +fine: construct remote scry core
:: +fi: construct |fine remote scry core
:: XX TODO rethink core naming/structure to follow current ames
::
++ fi
=< |%
++ fine-core .
:: ++ pe-abed XX
:: ++ fi-abed XX TODO
++ fi-abet abet :: +abet:pe
::
:: +| %entry-points
@ -4017,7 +4012,7 @@
=. cor (ke-send:cor hoot.want)
[`want | cor]
::
++ ke-gauge (ga metrics.keen 0) :: XX implement length deq
++ ke-gauge (ga metrics.keen (wyt:ke-deq wan.keen))
::
++ ke-timer-wire
`wire`(welp /fine/behn/wake/(scot %p her) path)

View File

@ -9,17 +9,23 @@
(apl:de *(pha @) big-list)
=/ foo-list (gulf 1 8)
|%
++ foo
++ foo
(apl:de *(pha @) 1 2 3 4 5 6 7 8 ~)
++ bar
++ bar
`(pha @)`(apl:de *(pha @) 8 9 10 11 12 13 14 15 ~)
::
++ test-tap
=/ ls
=/ ls
~> %bout.[1 %tap]
(tap:de big)
(expect-eq !>(ls) !>(big-list))
::
++ test-wyt
=/ le
~> %bout.[1 %wyt]
(wyt:de big)
(expect-eq !>(le) !>(big-num))
::
++ test-left
^- tang
=/ bar
@ -29,7 +35,7 @@
~> %bout.[1 %apl]
(apl:de bar 1 2 3 4 5 6 ~)
%- zing
:-
:-
~> %bout.[1 %eq-1]
(expect-eq !>((tap:de bar)) !>((gulf 1 15)))
=^ val=(unit @) bar