Activity for forestbeastsâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #281948 |
Post edited: Slightly shorter solution! |
— | over 3 years ago |
Edit | Post #281948 |
Post edited: Language-tag the code blocks for (hopefully) proper syntax highlighting |
— | over 3 years ago |
Edit | Post #281948 | Initial revision | — | over 3 years ago |
Answer | — |
A: Juggler sequences JavaScript (Node.js), 73 66 bytes This returns a Generator, which calculates the sequence on the fly when you use it! ```js functionf(a){while(a>1){yield a a=(a%2?a1.5:a0.5)} yield a} ``` Original, more aesthetically pleasing but slightly longer version: ```js functionf(a){while(1){y... (more) |
— | over 3 years ago |
Edit | Post #281945 | Initial revision | — | over 3 years ago |
Answer | — |
A: Shape of an array JavaScript (Node.js), 51 bytes ``` n=[];f=(a)=>a&&a.map?(n.push(a.length),f(a[0]),n):n ``` Run f on your input, e.g. `f([[],[]])`. Explanation: ``` n=[]; // make a global array to hold the results f=(a)=> // make the function a&&a.map? // is a defined, and an array? (n.push(a... (more) |
— | over 3 years ago |
Edit | Post #281944 | Initial revision | — | over 3 years ago |
Answer | — |
A: Bytes to Segfault Swift 5.4, 17 bytes ``` func f(){f()};f() ``` Pretty simple. It just calls itself until it stack overflows. You need to compile and run it, not just do it in the REPL, because the REPL just drops you back into the interpreter once it overflows. It gives a warning "all paths through this fu... (more) |
— | over 3 years ago |
Edit | Post #281943 | Initial revision | — | over 3 years ago |
Answer | — |
A: Truthify an array JavaScript (Node.js), 68 bytes ``` f=(a)=>a.map((x)=>[...x.entries()].filter((e)=>e[1]).map((e)=>e[0])) ``` Run the function f on your input, e.g. `f([[1,0,1],[1,0,1],[0,1,0]])`. The output looks like this: ``` [[0, 2], [0, 2], [1]] ``` with one subarray for each input subarray. ... (more) |
— | over 3 years ago |