Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

etc. I've then used the oblique adverb on append ,/. to read the rows diagonally to straighten(ish) the triangle. I didn't need to do this, as randomrarandomra points out. I could have just reversed |. the lot to get the same result. Even better, I could have just used (,,.~)^:6,'o' to save the reverse step completely.

etc. I've then used the oblique adverb on append ,/. to read the rows diagonally to straighten(ish) the triangle. I didn't need to do this, as randomra points out. I could have just reversed |. the lot to get the same result. Even better, I could have just used (,,.~)^:6,'o' to save the reverse step completely.

etc. I've then used the oblique adverb on append ,/. to read the rows diagonally to straighten(ish) the triangle. I didn't need to do this, as randomra points out. I could have just reversed |. the lot to get the same result. Even better, I could have just used (,,.~)^:6,'o' to save the reverse step completely.

Added explanation
Source Link
Gareth
  • 11.4k
  • 1
  • 37
  • 86

A quick explanation:

The verb (,~,.~) is what's doing the work here. It's a hook which first stitches ,. the argument to itself (o -> oo) and then appends the original argument to the output:

oo 

becomes

oo o 

This verb is repeated 6 times ^:6 with the output of each iteration becoming the input of the next iteration. So

oo o 

becomes

oooo o o oo o 

which in turn becomes

oooooooo o o o o oo oo o o oooo o o oo o 

etc. I've then used the oblique adverb on append ,/. to read the rows diagonally to straighten(ish) the triangle. I didn't need to do this, as randomra points out. I could have just reversed |. the lot to get the same result. Even better, I could have just used (,,.~)^:6,'o' to save the reverse step completely.

Ah well, you live and learn. :-)

A quick explanation:

The verb (,~,.~) is what's doing the work here. It's a hook which first stitches ,. the argument to itself (o -> oo) and then appends the original argument to the output:

oo 

becomes

oo o 

This verb is repeated 6 times ^:6 with the output of each iteration becoming the input of the next iteration. So

oo o 

becomes

oooo o o oo o 

which in turn becomes

oooooooo o o o o oo oo o o oooo o o oo o 

etc. I've then used the oblique adverb on append ,/. to read the rows diagonally to straighten(ish) the triangle. I didn't need to do this, as randomra points out. I could have just reversed |. the lot to get the same result. Even better, I could have just used (,,.~)^:6,'o' to save the reverse step completely.

Ah well, you live and learn. :-)

Source Link
Gareth
  • 11.4k
  • 1
  • 37
  • 86

J

,/.(,~,.~)^:6,'o' 

Not ideal, since the triangle is lopsided and followed by a lot of whitespace - but interesting nonetheless I thought.

Output:

o oo o o oooo o o oo oo o o o o oooooooo o o oo oo o o o o oooo oooo o o o o oo oo oo oo o o o o o o o o oooooooooooooooo o o oo oo o o o o oooo oooo o o o o oo oo oo oo o o o o o o o o oooooooo oooooooo o o o o oo oo oo oo o o o o o o o o oooo oooo oooo oooo o o o o o o o o oo oo oo oo oo oo oo oo o o o o o o o o o o o o o o o o oooooooooooooooooooooooooooooooo o o oo oo o o o o oooo oooo o o o o oo oo oo oo o o o o o o o o oooooooo oooooooo o o o o oo oo oo oo o o o o o o o o oooo oooo oooo oooo o o o o o o o o oo oo oo oo oo oo oo oo o o o o o o o o o o o o o o o o oooooooooooooooo oooooooooooooooo o o o o oo oo oo oo o o o o o o o o oooo oooo oooo oooo o o o o o o o o oo oo oo oo oo oo oo oo o o o o o o o o o o o o o o o o oooooooo oooooooo oooooooo oooooooo o o o o o o o o oo oo oo oo oo oo oo oo o o o o o o o o o o o o o o o o oooo oooo oooo oooo oooo oooo oooo oooo o o o o o o o o o o o o o o o o oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo