I've got the following code, which works, but obviously contains duplication. Is there a way to move that "dissection_available?...:..." to the place, where it should be?

return dissection_available
    ?solution.dup
             .transposed.map!(a=>a.map!(b=>"?#."[b]).array)
.zip(dissection.dup.transposed.map!(a=>a.map!(b=>"X#.?"[b]).array))
             .map!(a=>a[0].to!string~"  "~a[1].to!string)
             .join("\n")
             .to!string
    :solution.dup
             .transposed.map!(a=>a.map!(b=>"?#."[b]).array)
             .join("\n")
             .to!string;

solution and dissection are of type const(int[][]).

Reply via email to