15 lines
411 B
Text
15 lines
411 B
Text
val wordsets = [
|
|
fw/the that a/,
|
|
fw/frog elephant thing/,
|
|
fw/walked treaded grows/,
|
|
fw/slowly quickly/,
|
|
]
|
|
|
|
val alljoin = fn(words) { for[=true] i of len(words)-1 {
|
|
if words[i][-1] != words[i+1][1]: break val=false
|
|
}}
|
|
|
|
# amb expects 2 or more arguments
|
|
val amb = fn(words...[2..]) { if alljoin(words) { join words, delim=" " } }
|
|
|
|
writeln join(mapX(wordsets..., by=amb) -> filter, delim="\n")
|