Activity for user
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #284242 | Initial revision | — | about 3 years ago |
Answer | — |
A: Weave Strings Together Scala, 60 bytes ```scala .map( map "".+).reduce(.zipAll(,"","")map(+)).mkString ``` Try it in Scastie! First, `.map( map "".+)` turns every string into a list of strings containing a single character. After, these lists of strings are `reduced` by zipping with each other, padding with an empty... (more) |
— | about 3 years ago |
Suggested Edit | Post #284191 |
Suggested edit: Figuring out if it's a good idea is exactly what the Sandbox is for, no need to explicitly state it :) (more) |
helpful | about 3 years ago |
Comment | Post #284221 |
Should probably also add the first few values in the challenge itself instead of just having an OEIS link. Nice challenge (more) |
— | about 3 years ago |
Edit | Post #284191 |
Post edited: Fixed grammar a bit |
— | about 3 years ago |
Comment | Post #284195 |
[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRIc8qT9cwMS9Fty5NIzpPX99Ix1grT9swNjpP1ShW839JanFJcmJxarGCrUJRYl56qoahjoKhoSYXV1p@kUKeQmaeAlyJFZcCEBQUZeaVaOTpKCg9apukpKMA4qVp5GlqanL9BwA "Python 3 – Try It Online") (more) |
— | about 3 years ago |
Comment | Post #284191 |
I would suggest saying that the quine should be payload-capable rather than talking about data sections, because I'm not sure what exactly that means. (more) |
— | about 3 years ago |
Suggested Edit | Post #284191 |
Suggested edit: Fixed grammar a bit (more) |
helpful | about 3 years ago |
Edit | Post #284212 | Initial revision | — | about 3 years ago |
Answer | — |
A: Collatz conjecture; Count the tries to reach $1$ Scala, 50 bytes ```scala Stream.iterate()(x=>Seq(x/2,3x+1)(x%2))indexOf 1 ``` Try it in Scastie! (more) |
— | about 3 years ago |
Edit | Post #284145 |
Post edited: |
— | about 3 years ago |
Comment | Post #284145 |
@#53588 Thanks again! (more) |
— | about 3 years ago |
Comment | Post #284145 |
@#53196 Thanks! but Shaggy suggested yet another clever golf :) (more) |
— | about 3 years ago |
Comment | Post #284180 |
Looks like you forgot to add a scoring criterion? (more) |
— | about 3 years ago |
Edit | Post #284145 |
Post edited: |
— | about 3 years ago |
Comment | Post #284145 |
@#53588 Ah, smart! (more) |
— | about 3 years ago |
Comment | Post #284145 |
@#53588 Whoops, that's fixed now (more) |
— | about 3 years ago |
Edit | Post #284145 |
Post edited: |
— | about 3 years ago |
Comment | Post #284158 |
+1. It might also be worth mentioning that you can have numbers before keywords without whitespace in between and stuff like that. (more) |
— | about 3 years ago |
Edit | Post #284145 | Initial revision | — | about 3 years ago |
Answer | — |
A: It's Hip to be Square [Python 3], 46 bytes Saved 8 bytes thanks to Shaggy! lambda n:[n-ii or exit(1)for i in range(1+n)] Try it online! [Python 3.8 (pre-release)], 50 54 52 bytes Fixed a silly mistake thanks to Shaggy and saved 2 bytes! for i in range(1+(x:=int(input()))):x-ii or exit... (more) |
— | about 3 years ago |
Comment | Post #283971 |
`Scanner` is not the only way to take input, although it might be the shortest. That has nothing to do with `Scanner s=new Scanner(System.in)`, though, which you can obviously inline. You're also not allowed to "hide" imports in the header: you need to include them in your bytecount, but here, I'd su... (more) |
— | about 3 years ago |
Comment | Post #283971 |
Did you even try golfing this? The two variable assignments look entirely useless to me. (more) |
— | about 3 years ago |
Comment | Post #283858 |
If they're just your stuffed toys and not television characters or something that people would recognize, I don't really see a point to the dialogue at the start. Only you would "get" it, so it doesn't add anything to the challenge. (more) |
— | about 3 years ago |
Comment | Post #283858 |
What is the flavortext a reference to? What are Mark and Cream? (more) |
— | about 3 years ago |
Edit | Post #283910 | Initial revision | — | about 3 years ago |
Answer | — |
A: Generalized Sort Scala, 64 bytes ```scala c=>.sortBy(x=>c.map((x)))(math.Ordering.Implicits.seqOrdering) ``` Try it in Scastie! A rather crude answer, but I'll come back later to golf it. It's rather simple, though - it simply sorts by the result of applying every comparator function to each of the elements. (more) |
— | about 3 years ago |
Comment | Post #283874 |
I know you're probably still working on it, but when you add testcases, can you add some for negative integers too? (more) |
— | about 3 years ago |
Comment | Post #283880 |
I would say that for code-golf and code-bowling questions, including test cases should be mandatory, not just encouraged. On the other hand, C&R doesn't really need them. (more) |
— | about 3 years ago |
Comment | Post #283882 |
Might be helpful to say what a root is in plainer terms so it's easier for non-mathy people to understand (given x-intercepts/x values where P(x)=0 or something) (more) |
— | about 3 years ago |
Comment | Post #283428 |
Oh, I didn't realize C strings needed that. (btw, I love the trick you used on your JS answer, I just used it to shorten my own answer :)) (more) |
— | about 3 years ago |
Edit | Post #283384 |
Post edited: |
— | about 3 years ago |
Edit | Post #283384 |
Post edited: |
— | about 3 years ago |
Comment | Post #283428 |
Is there any way for you to drop some letters off the end too (or would that increase the byte count)? (more) |
— | about 3 years ago |
Comment | Post #283819 |
Great answer! You can do [this](https://tio.run/##VY07DsIwEET7nGIKCpusrQQSfiLcgJrCuIhELCwCRI4LQNw92BR8qp19sztzrPtT07bDYJSu8sSw2@rOK3NtD44Jno0etttZf2R7KzZsbJSvTw0sXJoe3LVjNs25e7q1uGvOVSalvg3n2l5Q4Vx3W7DO2YuHhOHwTe/7JHkPVAmgoFROyDRBZYRc6wApQlkSJhGLKaGQ5ccJ6zzy8CaK730I@cn5yv/UkEmYRqsghIZZlHPCgrD8u4o8Fr@... (more) |
— | about 3 years ago |
Edit | Post #283793 |
Post edited: |
— | about 3 years ago |
Edit | Post #283799 |
Post edited: |
— | about 3 years ago |
Suggested Edit | Post #283799 |
Suggested edit: (more) |
helpful | about 3 years ago |
Edit | Post #283796 | Initial revision | — | about 3 years ago |
Answer | — |
A: Compute the determinant [Python 3.8 (pre-release)], 106 95 bytes Saved 11 bytes thanks to Peter Taylor! f=lambda m:sum((-1)ixf([r[:i]+r[i+1:]for r in m[1:]])for i,x in enumerate(m[0]))if m else 1 Try it online! Here's an attempt at beating Quintec's answer. Only 78 67 more bytes to go! (more) |
— | about 3 years ago |
Edit | Post #283793 |
Post edited: |
— | about 3 years ago |
Edit | Post #283793 |
Post edited: |
— | about 3 years ago |
Edit | Post #283793 | Initial revision | — | about 3 years ago |
Answer | — |
A: Compute the determinant Scala, 130 125 bytes Saved 5 bytes by returning 1 like Hakerh400's great answer ```scala def f(m:Seq[Seq[Double]]):Double=if(m.sizem(0)(i)f(m.tail.map(r=>r.take(i)++r.drop(i+1)))-a} ``` Try it in Scastie! A recursive function that uses the first row for the Laplace expansion. Explanation ... (more) |
— | about 3 years ago |
Comment | Post #283791 |
A determinant in 28 bytes or less without using numpy or other libraries? That's highly unlikely. (more) |
— | about 3 years ago |
Edit | Post #283702 |
Post edited: |
— | about 3 years ago |
Edit | Post #283702 |
Post edited: |
— | about 3 years ago |
Comment | Post #283702 |
Thanks! I don't know how I missed that one. (more) |
— | about 3 years ago |
Edit | Post #283702 |
Post edited: |
— | about 3 years ago |
Comment | Post #283702 |
@#53588g Ah thanks, I forgot you could do that with keywords. (more) |
— | about 3 years ago |