RosettaCodeData/Task/Amb/Langur/amb.langur
2023-07-01 13:44:08 -04:00

15 lines
404 B
Text

val .wordsets = [
w/the that a/,
w/frog elephant thing/,
w/walked treaded grows/,
w/slowly quickly/,
]
val .alljoin = f(.words) for[=true] .i of len(.words)-1 {
if last(.words[.i]) != first(.words[.i+1]): break = false
}
# .amb expects 2 or more arguments
val .amb = f(...[2 .. -1] .words) if(.alljoin(.words): join " ", .words)
writeln join "\n", filter(mapX(.amb, .wordsets...))