Skip to main content
added 98 characters in body
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36

D, 133 127 126 125 121 119 bytes

import std.conv,std.stdio;void f(T)(T a,T b,T s=0){for(T j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 71 bytes:

import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

##How? (Only D specific tricks)

  • f(T)(T a,T b,T s=0) D's template system can infer types
  • for(T j;j++<s;) Integers default to 0.
  • ' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
  • a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)
  • One thing that might be relevant (I didn't use this though) newlines can be in strings!

D, 133 127 126 125 121 119 bytes

import std.conv,std.stdio;void f(T)(T a,T b,T s=0){for(T j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 71 bytes:

import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

##How? (Only D specific tricks)

  • f(T)(T a,T b,T s=0) D's template system can infer types
  • for(T j;j++<s;) Integers default to 0.
  • ' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
  • a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)

D, 133 127 126 125 121 119 bytes

import std.conv,std.stdio;void f(T)(T a,T b,T s=0){for(T j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 71 bytes:

import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

##How? (Only D specific tricks)

  • f(T)(T a,T b,T s=0) D's template system can infer types
  • for(T j;j++<s;) Integers default to 0.
  • ' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
  • a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)
  • One thing that might be relevant (I didn't use this though) newlines can be in strings!
added 10 characters in body
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36

D, 133 127 126 125125 121 119 bytes

  
import std.conv,std.stdio;void f(intT)(T a,intT b,longT s=0){for(intT j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 7272 71 bytes:

import std.stdio;void f(int a,int b){while(a<=b){a++.write;'\v'.write;}}
import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

##How? (Only D specific tricks)

  • f(T)(T a,T b,T s=0) D's template system can infer types
  • for(T j;j++<s;) Integers default to 0.
  • ' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
  • a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)

D, 133 127 126 125 bytes

 
import std.conv,std.stdio;void f(int a,int b,long s=0){for(int j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 bytes:

import std.stdio;void f(int a,int b){while(a<=b){a++.write;'\v'.write;}}

D, 133 127 126 125 121 119 bytes

 
import std.conv,std.stdio;void f(T)(T a,T b,T s=0){for(T j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 71 bytes:

import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

##How? (Only D specific tricks)

  • f(T)(T a,T b,T s=0) D's template system can infer types
  • for(T j;j++<s;) Integers default to 0.
  • ' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
  • a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)
added 10 characters in body
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36

D, 133 127 126126 125 bytes

import std.conv,std.stdio;void f(int a,int b,ulonglong s=0){for(int j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 bytes:

import std.stdio;void f(int a,int b){while(a<=b){a++.write;'\v'.write;}}

D, 133 127 126 bytes

import std.conv,std.stdio;void f(int a,int b,ulong s=0){for(int j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 bytes:

import std.stdio;void f(int a,int b){while(a<=b){a++.write;'\v'.write;}}

D, 133 127 126 125 bytes

import std.conv,std.stdio;void f(int a,int b,long s=0){for(int j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 bytes:

import std.stdio;void f(int a,int b){while(a<=b){a++.write;'\v'.write;}}
added 31 characters in body
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36
Loading
Add a
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36
Loading
deleted 1 character in body
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36
Loading
deleted 1 character in body
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36
Loading
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36
Loading