This commit is contained in:
AF 2021-07-24 22:07:41 +03:00
parent dac9ccf109
commit e66aa40a16
12 changed files with 106 additions and 9 deletions

10
main.py
View File

@ -1,5 +1,4 @@
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
import math
import random
from bu4.common_interface import with_common_interface
@ -9,7 +8,6 @@ from bu4.evaluation.synced import synced
from bu4.parsing.toolchain.readfile import readfile
from timesample import TimeSample
with TimeSample('all'):
with TimeSample('sys0'):
with TimeSample('compilation'):
@ -58,10 +56,8 @@ with TimeSample('all'):
TimeSample.print(sys3)
with TimeSample('sys1'):
sys1 = with_common_interface(synced(readfile('src/sys1')))
a_ = random.randrange(2 ** 16)
b_ = random.randrange(2 ** 16)
sys1 = sync(sys1.call(eproxy(a_)))
sys1 = sync(sys1.call(eproxy(b_)))
TimeSample.print(sys1, math.gcd(a_, b_))
sys1 = sync(sys1.call(eproxy(5)))
sys1 = sync(sys1.call(eproxy(6)))
TimeSample.print(sys1)
with TimeSample('sys4'):
TimeSample.print(with_common_interface(synced(readfile('src/sys4'))))

15
manual/main.md Normal file
View File

@ -0,0 +1,15 @@
```bu4
/[method][object]
```
```bu4
/[object][virtual]
```
```bu4
/
[accumulated]
/
[accumulated]
/
[accumulated]
[accumulator]
```

View File

@ -1,6 +1,7 @@
@b!
@01
@zq
@lb
@double
@bitwise/@
@arithmetic/@

8
src/binary/lb.bu4 Normal file
View File

@ -0,0 +1,8 @@
{
(b)
/(zq)(lb)(hb!)
[lb]
[b]
|
b_lb
}

View File

@ -4,3 +4,4 @@
@push
@length
@reduce
@map

View File

@ -0,0 +1,43 @@
{
(map)
/(dequeMap)
(isEmpty)(lPopped)(lItem)(rPopped-unused)(rItem-unused)
/
{ /[dequeMap][lPopped] | lPMapped }
/(isEmptyL)(lPoppedL-unused)(lItemL-unused)(rPoppedL)(rItemL)
{ /[lItem][map] | item }
/
(g) /[rItemL]/</[item]/[rPoppedL][dequeLPush]>/[item]/[lPMapped]/[0] [g]
/
/[item][dequeSingle]
[isEmptyL]
[lPMapped]
/
[dequeEmpty]
[isEmpty]
[YC]
|
dequeLMap
}
{
(map)
/(dequeMap)
(isEmpty)(lPopped-unused)(lItem-unused)(rPopped)(rItem)
/
{ /[dequeMap][rPopped] | rPMapped }
/(isEmptyR)(lPoppedR)(lItemR)(rPoppedR-unused)(rItemL-unused)
{ /[rItem][map] | item }
/
(g) /[item]/[rPMapped]/[lItemR]/</[item]/[lPoppedR][dequeRPush]>/[0] [g]
/
/[item][dequeSingle]
[isEmptyR]
[rPMapped]
/
[dequeEmpty]
[isEmpty]
[YC]
|
dequeRMap
}

View File

@ -4,3 +4,4 @@
@id
@collector
@compose
@extract

1
src/core/extract.bu4 Normal file
View File

@ -0,0 +1 @@
{ (method)(object) /[method][object] | extract }

View File

@ -1 +1,2 @@
@gcd
@exp

29
src/math/exp.bu4 Normal file
View File

@ -0,0 +1,29 @@
{
(_mul)(_zq)(_lb)(_halve)(_1)
/(exp)
(_e)
/
{ /</[_e][_halve]>[exp] | _hexp}
(_x)
/
/
[_1]
/
[_x]
/[_e][_lb]
/
{ /[_x][_hexp] | _hexpx }
/
[_hexpx]
/
[_hexpx]
[_mul]
[_mul]
/
(_x)
[_1]
/[_e][_zq]
[YC]
|
_exp
}

View File

@ -4,6 +4,7 @@
@ci
{ /[b_zq]/[b_div][_gcd] | gcd }
{ /[b1]/[b_halve]/[b_lb]/[b_zq]/[b_mul][_exp] | exp }
(a)(b)
@ -12,6 +13,6 @@
/[b][n_to_b]
/
/[a][n_to_b]
[gcd]
[exp]
[b_to_n]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

View File

@ -7,6 +7,6 @@
{ /[b7]//[b1]//[b5]/[dequeEmpty][dequeLPush][dequeLPush][dequeLPush] | deque }
/
/</[b0]/[b_add][dequeLReduce]>[deque]
/</[b0]/[b_add][dequeLReduce]>//[b_double][dequeRMap]//[b_double][dequeLMap][deque]
[b_to_n]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""