Sierpinski carpet: Difference between revisions
m
J: remove failing golfed code, and clean up presentation slightly
(→{{header|Nascom BASIC}}: Added) |
m (J: remove failing golfed code, and clean up presentation slightly) |
||
Line 3,149:
That said, using spaces and '#' characters takes a bit more work. One approach would be:
<lang j>
scarp=:{{' #'{~(#:7 5 7) ,/@(1 3 ,/"2@|: */)^:
scarp 2
#########
# ## ## #
Line 3,160 ⟶ 3,161:
# ## ## #
#########
scarp 3
###########################
# ## ## ## ## ## ## ## ## #
Line 3,191 ⟶ 3,192:
Here, what we are doing is forming a tensor product of our #:7 5 7 boolean array with our argument and then collapsing two of the dimensions so they line up right. Our starting argument is the 1 by 1 array with the value 1. Once we have repeated this process enough times, we select spaces for our zeros and pound signs for our 1s.
=={{header|Java}}==
|