Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,21 @@
: rep-string ( caddr1 u1 -- caddr2 u2 ) \ u2=0: not a rep-string
2dup dup >r r@ 2/ /string
begin 2over 2over string-prefix? 0= over r@ < and while -1 /string repeat
r> swap - >r 2drop r> ;
: test ( caddr u -- )
2dup type ." has "
rep-string ?dup 0= if drop ." no " else type ." as " then
." repeating substring" cr ;
: tests
s" 1001110011" test
s" 1110111011" test
s" 0010010010" test
s" 1010101010" test
s" 1111111111" test
s" 0100101101" test
s" 0100100" test
s" 101" test
s" 11" test
s" 00" test
s" 1" test ;

View file

@ -0,0 +1,13 @@
cr tests
1001110011 has 10011 as repeating substring
1110111011 has 1110 as repeating substring
0010010010 has 001 as repeating substring
1010101010 has 1010 as repeating substring
1111111111 has 11111 as repeating substring
0100101101 has no repeating substring
0100100 has 010 as repeating substring
101 has no repeating substring
11 has 1 as repeating substring
00 has 0 as repeating substring
1 has no repeating substring
ok