Zebra puzzle: Difference between revisions

Content deleted Content added
Line 4,166:
# Julia 1.0
using Combinatorics
function make(str, test = (_) -> true)
filter(test, collect( permutations(split(str))) )
end
Line 4,175:
drinks = make("beer coffee milk tea water", x -> "milk" == x[3])
 
#Julia 1.0 compatible
colors = make("blue green red white yellow",
x -> 1 == findfirst(x,c -> c == "white", x) - findfirst(x,c -> c == "green",x))
 
pets = make("birds cats dog horse zebra")