func cuboid (x=1,y=1,z=1,s=' ',c='+',h='-',v='|',d='/') { say("cuboid %d %d %d:" % (x, y, z)) ' ' * z+1 + c + h*x + c -> say { |i| ' ' * (z - i + 1) + d + s*x + d + (s * (i - (i > y ? i-y : 1))) + (i - 1 == y ? c : (i > y ? d : v)) -> say }.for(1..z) c + h*x + c + (s * (z < y ? z : y) + (z < y ? v : (z == y ? c : d))) -> say { |i| v + s*x + v + (z > y  ? (i >= z ? (s*x + c) : (s * y-i + d))  : (y - i > z  ? (s * z + v)  : (s * y-i + (y-i == z ? c : d)) ) ) -> say; }.for(1..y) c + h*x + c -> say } cuboid(2, 3, 4) cuboid(1, 1, 1) cuboid(6, 2, 1) cuboid(2, 4, 1)