Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/String-matching/Quackery/string-matching.quackery
Normal file
23
Task/String-matching/Quackery/string-matching.quackery
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[ tuck size split drop = ] is starts ( [ [ --> b )
|
||||
|
||||
[ tuck size negate split nip = ] is ends ( [ [ --> b )
|
||||
|
||||
[ 2dup = iff true
|
||||
else
|
||||
[ over [] = iff false done
|
||||
2dup starts iff true done
|
||||
dip behead nip again ]
|
||||
dip 2drop ] is contains ( [ [ --> b )
|
||||
|
||||
[ iff
|
||||
[ say "true" ]
|
||||
else
|
||||
[ say "false" ] ] is echobool ( b --> )
|
||||
|
||||
|
||||
$ "abcdefgh" $ "abc" starts echobool cr
|
||||
$ "abcdefgh" $ "xyz" starts echobool cr
|
||||
$ "abcdefgh" $ "fgh" ends echobool cr
|
||||
$ "abcdefgh" $ "xyz" ends echobool cr
|
||||
$ "abcdefgh" $ "cde" contains echobool cr
|
||||
$ "abcdefgh" $ "xyz" contains echobool cr
|
||||
Loading…
Add table
Add a link
Reference in a new issue