Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
46
Task/Modular-arithmetic/Quackery/modular-arithmetic.quackery
Normal file
46
Task/Modular-arithmetic/Quackery/modular-arithmetic.quackery
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
[ stack ] is modulus ( --> s )
|
||||
|
||||
[ this ] is modular ( --> [ )
|
||||
|
||||
[ modulus share mod
|
||||
modular nested join ] is modularise ( n --> N )
|
||||
|
||||
[ dup nest? iff
|
||||
[ -1 peek modular oats ]
|
||||
else [ drop false ] ] is modular? ( N --> b )
|
||||
|
||||
[ modular? swap
|
||||
modular? or ] is 2modular? ( N N --> b )
|
||||
|
||||
[ dup modular? if [ 0 peek ] ] is demodularise ( N --> n )
|
||||
|
||||
[ demodularise swap
|
||||
demodularise swap ] is 2demodularise ( N N --> n )
|
||||
|
||||
[ dup $ '' = if
|
||||
[ $ '"modularify(2-->1)" '
|
||||
$ "needs a name after it."
|
||||
join message put bail ]
|
||||
nextword
|
||||
$ "[ 2dup 2modular? iff
|
||||
[ 2demodularise " over join
|
||||
$ " modularise ]
|
||||
else " join over join
|
||||
$ " ] is " join swap join
|
||||
space join
|
||||
swap join ] builds modularify(2-->1) ( --> )
|
||||
|
||||
( --------------------------------------------------------------- )
|
||||
|
||||
modularify(2-->1) + ( N N --> N )
|
||||
|
||||
modularify(2-->1) ** ( N N --> N )
|
||||
|
||||
( --------------------------------------------------------------- )
|
||||
|
||||
[ dup 100 ** + 1 + ] is f ( N --> N )
|
||||
|
||||
13 modulus put
|
||||
10 f echo cr
|
||||
10 modularise f echo
|
||||
modulus release cr
|
||||
Loading…
Add table
Add a link
Reference in a new issue