Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Binary-search/Quackery/binary-search.quackery
Normal file
32
Task/Binary-search/Quackery/binary-search.quackery
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
[ stack ] is value.bs ( --> n )
|
||||
[ stack ] is nest.bs ( --> n )
|
||||
[ stack ] is test.bs ( --> n )
|
||||
|
||||
[ ]'[ test.bs put
|
||||
value.bs put
|
||||
nest.bs put
|
||||
1 - swap
|
||||
[ 2dup < if done
|
||||
2dup + 1 >>
|
||||
nest.bs share over peek
|
||||
value.bs share swap
|
||||
test.bs share do iff
|
||||
[ 1 - unrot nip ]
|
||||
again
|
||||
[ 1+ nip ] again ]
|
||||
drop
|
||||
nest.bs take over peek
|
||||
value.bs take 2dup swap
|
||||
test.bs share do
|
||||
dip [ test.bs take do ]
|
||||
or not
|
||||
dup dip [ not + ] ] is bsearchwith ( n n [ x --> n b )
|
||||
|
||||
[ dup echo
|
||||
over size 0 swap 2swap
|
||||
bsearchwith < iff
|
||||
[ say " was identified as item " ]
|
||||
else
|
||||
[ say " could go into position " ]
|
||||
echo
|
||||
say "." cr ] is task ( [ n --> n )
|
||||
Loading…
Add table
Add a link
Reference in a new issue