Activity for user
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #283704 |
Post edited: |
— | about 3 years ago |
Edit | Post #283704 | Initial revision | — | about 3 years ago |
Answer | — |
A: Multiply two strings Scala, 25 bytes ``` a=>.flatMap(a map .min) ``` Try it in Scastie! Pretty trivial solution, but here's a bad explanation anyway: ``` //a is the first string a =>.flatMap(a map .min) //b is the second string, x is each char in b a => b => b.flatMap(x => a map x.min) //For every char y i... (more) |
— | about 3 years ago |
Edit | Post #283702 | Initial revision | — | about 3 years ago |
Answer | — |
A: In The Jailhouse Now Scala, 90 89 88 bytes Saved 2 bytes thanks to Shaggy ```scala n=>1 to n map{x=>val s=if(x //The input 1 to n //Make a range [1..n] map{x=> //For each x in that range, make a line: val s= //s is a string in the form "$left$inner$right" if(x<2)"╔╦╗" //For the top else if(x<n)"╠╬╣" //For t... (more) |
— | about 3 years ago |
Comment | Post #283620 |
You could say "Grabbed resources and weed" so that "need" isn't repeated twice but it still rhymes. (more) |
— | over 3 years ago |
Comment | Post #283555 |
You can use an `else` instead of the `continue`, and you might want a slightly different input format to avoid the try/except stuff. However, I'd recommend taking a look at the other answers - you don't need `z` at all if you multiply by `x` each time and add the next coefficient (you'll have to take... (more) |
— | over 3 years ago |
Edit | Post #283562 | Initial revision | — | over 3 years ago |
Answer | — |
A: Evaluate a single variable polynomial equation [Python 3], 46 bytes f=lambda p,x,a=0:p and f(p[1:],x,ax+p[0])or a Try it online! Takes input reversed. (more) |
— | over 3 years ago |
Comment | Post #283555 |
You can use `1` instead of `True`, use `n+=[a]` instead of `n.append(a)`, drop the both the `continue`s, and use `for a in n:` and then use `a` instead of `n[i]`. However, it'd be better to just use one loop instead of filling up an array and then iterating over it *again*. Even better would be a rec... (more) |
— | over 3 years ago |
Edit | Post #279159 |
Post edited: Use [] because it wasn't clear where the list ended and where x was |
— | over 3 years ago |
Comment | Post #283413 |
But what's the difference between swapping and changing places? I'm still confused lol (more) |
— | over 3 years ago |
Comment | Post #283413 |
What's the difference? (more) |
— | over 3 years ago |
Comment | Post #283413 |
How is the mentioned loophole a loophole? (more) |
— | over 3 years ago |
Comment | Post #283408 |
I can bet you 1 dollar (I'd bet more but don't have the money) that most of the answers will simply copy fizzbuzz, rot13, 99 beers, etc. from other answers on previous challenges without doing anything interesting whatsoever. Your typical answer would look like:
```
if input is fizzbuzz:
do the ... (more) |
— | over 3 years ago |
Edit | Post #283418 | Initial revision | — | over 3 years ago |
Answer | — |
A: Small integer swapping [Python 3.8 (pre-release)], 39 bytes print(x:=input(),y:=input()) print(y,x) Try it online! (more) |
— | over 3 years ago |
Edit | Post #283384 |
Post edited: |
— | over 3 years ago |
Edit | Post #283384 |
Post edited: |
— | over 3 years ago |
Edit | Post #283384 |
Post edited: |
— | over 3 years ago |
Edit | Post #283384 |
Post edited: |
— | over 3 years ago |
Edit | Post #283384 | Initial revision | — | over 3 years ago |
Answer | — |
A: Coat of Many Colours Scala, 119 bytes Saved 26 bytes after porting Moshi's solution! ```scala sortBy("y gree br sc bla oc pe rub ol v f li go ch m cre c s ro a l ru g pu w p o b"split " "indexWhere .startsWith) ``` Original solution, 145 130 bytes Saved 15 bytes after looking at Moshi's solution! ```sca... (more) |
— | over 3 years ago |
Comment | Post #283338 |
Not being pretty, following good practices, or being optimized is practically a requirement for code golf :P (more) |
— | over 3 years ago |
Comment | Post #283305 |
Ah, got it. (pad) (more) |
— | over 3 years ago |
Comment | Post #283305 |
[Husk](https://github.com/barbuz/Husk), 1 byte: [`E`](https://tio.run/##yygtzv6f@6ip8b/r////o6MNdaAwVifaAMwy0zEHsg1jYwE) (more) |
— | over 3 years ago |
Edit | Post #279660 |
Post edited: There's no need for a single code-golf-tips tag when there's two separate tags for it. |
— | over 3 years ago |
Comment | Post #283305 |
How do you do that? (more) |
— | over 3 years ago |
Comment | Post #283341 |
No, I didn't mean make a full-fledged golflang, just use pseudocode or maybe take a subset of Python/C/whatever without multiplication and exponentiation. (more) |
— | over 3 years ago |
Comment | Post #283341 |
What counts as a multiplication/exponentiation builtin is quite poorly defined, and although many languages might get by without them just fine here, they might not for other sorts of challenges/other builtins. I'd advise against banning them. One alternative is to create your own mini language for t... (more) |
— | over 3 years ago |
Comment | Post #283305 |
Since there's no trivial builtins answer yet, I edited my Husk one into one. Any idea on how to CW it? Or perhaps it could be edited into the question itself? (more) |
— | over 3 years ago |
Edit | Post #283312 |
Post edited: Made trivial |
— | over 3 years ago |
Comment | Post #283312 |
Oh great, I'll remove it then! (more) |
— | over 3 years ago |
Comment | Post #283312 |
@#53310 But they're not distinct values otherwise, they're either 0 or some arbitrary positive integer. Is that alright? (more) |
— | over 3 years ago |
Edit | Post #283312 | Initial revision | — | over 3 years ago |
Answer | — |
A: Are All Elements Equal? Trivial answers [Husk], 1 byte E Try it online! (more) |
— | over 3 years ago |
Comment | Post #283175 |
I don't understand what's confusing you about them, but perhaps [this worksheet](https://scastie.scala-lang.org/4rnXDcJVTF27sQ3aVb1eDQ) will help. (more) |
— | over 3 years ago |
Edit | Post #283268 |
Post edited: Remove blackbox function stuff |
— | over 3 years ago |
Comment | Post #283268 |
¯\\_(ツ)_/¯ Blackbox functions have been used a lot Somewhere Else without any problems (afaik). I'll remove that part if you like, though. (more) |
— | over 3 years ago |
Edit | Post #283175 |
Post edited: Finalized |
— | over 3 years ago |
Edit | Post #283268 | Initial revision | — | over 3 years ago |
Question | — |
Reduce over the range [1..n] Task I often need to find the factorial of a number or the sum of all numbers up to a number when cheating on math tests. To help me with this, your task is to write $F$, a generalized version of those functions: $$F(n) = 1 2 \space ... \space (n-1) n$$ Please note that the operator $ $... (more) |
— | over 3 years ago |
Comment | Post #280343 |
I see. Does Corsaka's answer count as a consensus? It's got 5 upvotes and no downvotes, and there aren't any answers that advocate *for* giving rep. (more) |
— | over 3 years ago |
Comment | Post #283231 |
Thanks for clarifying that in the draft, but I don't like the error handling part. It doesn't add anything to the challenge and is just cumbersome. Much better to simply say that everything that's currently in the error handling section is just undefined behavior. (more) |
— | over 3 years ago |
Comment | Post #280343 |
This is a bit embarrassing, but I can't tell if sandboxed posts still give rep, since I don't get a notification for reputation here like I would Somewhere Else. However, I'm about 70% sure I got rep off of a draft in the Sandbox, so if they do still give rep, could that be turned off any time soon? (more) |
— | over 3 years ago |
Comment | Post #283231 |
What do `^^^` (`^ 3`) and `//` (`/ 2`) return? As far as I know, they aren't used as unary operators in math. Is this simply undefined behavior? (more) |
— | over 3 years ago |
Comment | Post #283175 |
Ah, thanks, I've edited that into my draft. (more) |
— | over 3 years ago |
Edit | Post #283175 |
Post edited: |
— | over 3 years ago |
Edit | Post #282951 |
Post edited: |
— | over 3 years ago |
Edit | Post #283166 |
Post edited: |
— | over 3 years ago |