Skip to main content
Commonmark migration
Source Link

#ECMAScript6, 67 * 0.5 = 33.5 bytes#

ECMAScript6, 67 * 0.5 = 33.5 bytes

f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}

Pretty happy with this one...It's about a quarter the size of my original.

f(4) returns:

[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Old answer:

f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

#ECMAScript6, 67 * 0.5 = 33.5 bytes#

f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}

Pretty happy with this one...It's about a quarter the size of my original.

f(4) returns:

[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Old answer:

f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

ECMAScript6, 67 * 0.5 = 33.5 bytes

f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}

Pretty happy with this one...It's about a quarter the size of my original.

f(4) returns:

[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Old answer:

f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

added 219 characters in body
Source Link

#ECMAScript6, 104 7867 * 0.5 = 33.5 bytes# f=i=>{a=b=Array;while(i)a=a

f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}

Pretty happy with this one.concat(b.apply(null,b(i)).map(e=>i)),i--;returnIt's about a} quarter the size of my original.

f(4) returns:

[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Old answer:

f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

#ECMAScript6, 104 78 bytes# f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

#ECMAScript6, 67 * 0.5 = 33.5 bytes#

f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}

Pretty happy with this one...It's about a quarter the size of my original.

f(4) returns:

[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Old answer:

f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

deleted 50 characters in body
Source Link

#ECMAScript6, 104 10078 bytes# ((d)=>f=i=>{fora=b=Array;while(a=0,c=Array,b=c;a<=d;a++i)b=ba=a.concat(cb.apply(null,cb(ai)).map(e=>{return a}e=>i)),i--;return ba})(10)

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Input goes in the last set of parenthesesCalled with f(n).

#ECMAScript6, 104 100 bytes# ((d)=>{for(a=0,c=Array,b=c;a<=d;a++)b=b.concat(c.apply(null,c(a)).map(e=>{return a}));return b})(10)

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Input goes in the last set of parentheses.

#ECMAScript6, 104 78 bytes# f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!

Called with f(n).

Removed var keyword
Source Link
Loading
added 46 characters in body
Source Link
Loading
Source Link
Loading