September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

37
Task/Amb/Python/amb-3.py Normal file
View file

@ -0,0 +1,37 @@
def main():
print (
unlines([
unwords([w1, w2, w3, w4])
for w1 in ['the', 'that', 'a']
if True
for w2 in ['frog', 'elephant', 'thing']
if joins(w1, w2)
for w3 in ['walked', 'treaded', 'grows']
if joins(w2, w3)
for w4 in ['slowly', 'quickly']
if joins(w3, w4)
])
)
# joins :: String -> String -> Bool
def joins(a, b):
return a[-1] == b[0]
# unlines :: [String] -> String
def unlines(xs):
return '\n'.join(xs)
# unwords :: [String] -> String
def unwords(xs):
return ' '.join(xs)
if __name__ == '__main__':
main()