Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

4 of 5
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/

##Maple, 30 / 37 chars

Inspired by Mr.Wizard's Mathematica entry, I present this 30-char Maple 12 command:

<`*`,('cat(02ドル*i+1)'$i=0..8)>;

Output:

 [ * ]
 [ ]
 [ 0 ]
 [ ]
 [ 000 ]
 [ ]
 [ 00000 ]
 [ ]
 [ 0000000 ]
 [ ]
 [ 000000000 ]
 [ ]
 [ 00000000000 ]
 [ ]
 [ 0000000000000 ]
 [ ]
 [ 000000000000000 ]
 [ ]
 [00000000000000000]

I can also get rid of the brackets at the cost of seven more chars:

`*`;for i in0ドル..8 do;cat(02ドル*i+1);od;

Output omitted — it looks just like above, only without the brackets. Unfortunately, I don't know any way to keep Maple from inserting blank lines between the output rows in text mode. It looks better in classic worksheet mode. I guess I could include a screenshot...

screenshot

(The screenshot shows an earlier 44-char version of the command, but I'm too lazy to retake it. The output is still the same.)

Oh, and yes, the size is fully adjustable: just replace the 8 with n-2 for an n-row tree. With the first solution, going above 25 rows (or 10 in the GUI) requires also setting interface(rtablesize = n), though.

(Ps. I thought I'd managed to beat GolfScript with the latest version, but alas...)

Ilmari Karonen
  • 21k
  • 5
  • 55
  • 101

AltStyle によって変換されたページ (->オリジナル) /