Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,12 @@
> import Data.List
> "abc" `isPrefixOf` "abcdefg"
True
> "efg" `isSuffixOf` "abcdefg"
True
> "bcd" `isInfixOf` "abcdefg"
True
> "abc" `isInfixOf` "abcdefg" -- Prefixes and suffixes are also infixes
True
> let infixes a b = findIndices (isPrefixOf a) $ tails b
> infixes "ab" "abcdefabqqab"
[0,6,10]

View file

@ -0,0 +1,10 @@
procedure main()
write("Matching s2 :=",image(s2 := "ab")," within s1:= ",image(s1 := "abcdabab"))
write("Test #1 beginning ",if match(s2,s1) then "matches " else "failed")
writes("Test #2 all matches at positions [")
every writes(" ",find(s2,s1)|"]\n")
write("Test #3 ending ", if s1[0-:*s2] == s2 then "matches" else "fails")
end