This commit is contained in:
AF 2021-07-24 15:50:38 +03:00
parent 53f0785345
commit a293dd0ca1
5 changed files with 112 additions and 0 deletions

View File

@ -56,3 +56,5 @@ with TimeSample(' full'):
sys1 = sync(sys1.call(eproxy(77)))
sys1 = sync(sys1.call(eproxy(194)))
print(sys1)
with TimeSample(' full'):
print(with_common_interface(synced(readfile('src/sys4'))))

View File

@ -4,4 +4,5 @@
@convert/@
@io/@
@serialization/@
@collections/@
@numbers

1
src/collections/@.bu4 Normal file
View File

@ -0,0 +1 @@
@deque

96
src/collections/deque.bu4 Normal file
View File

@ -0,0 +1,96 @@
{ (g) /? /? /? /? /[1][g] | dequeEmpty }
{ (item) (g) /[item]/[dequeEmpty]/[item]/[dequeEmpty]/[0][g] | dequeSingle }
{
(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
[lPopped]
|
dequeLPopped
}
{
(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
[lItem]
|
dequeLItem
}
{
(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
[rPopped]
|
dequeRPopped
}
{
(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
[rItem]
|
dequeRItem
}
{
/(dequeLPush)
(deque)(item)
/(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
/
(g) /[rItem]/</[item]/[rPopped][dequeLPush]>/[item]/[deque]/[0] [g]
/
/[item][dequeSingle]
[isEmpty]
[deque]
[YC]
|
dequeLPush
}
{
/(dequeRPush)
(deque)(item)
/(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
/
(g) /[item]/[deque]/[lItem]/</[item]/[lPopped][dequeRPush]>/[0] [g]
/
/[item][dequeSingle]
[isEmpty]
[deque]
[YC]
|
dequeRPush
}
{
(_0)(_1)(_add)
/(dequeLength)
(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
/
/
/[dequeLength][lPopped]
/
[_1]
[_add]
/
[_0]
[isEmpty]
[YC]
|
dequeLLength
}
{
(_0)(_1)(_add)
/(dequeLength)
(isEmpty)(lPopped)(lItem)(rPopped)(rItem)
/
/
/[dequeLength][rPopped]
/
[_1]
[_add]
/
[_0]
[isEmpty]
[YC]
|
dequeRLength
}

12
src/sys4.bu4 Normal file
View File

@ -0,0 +1,12 @@
@@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ci
{ /[b_add]/[b1]/[b0][dequeLLength] | dequeLength }
{ /[b!]//[pair]/[dequeEmpty][dequeLPush][dequeLPush] | deque }
/
/[dequeLength][deque]
[b_to_nx]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""