Activity for Lundin
| Type | On... | Excerpt | Status | Date |
|---|---|---|---|---|
| Edit | Post #284951 |
Post edited: |
— | 5 months ago |
| Comment | Post #284951 |
@#53890 I think whatever default rules we got for taking input would be ok to use too. (more) |
— | 5 months ago |
| Comment | Post #295576 |
Technically, a macro parameter is not a global and equivalent to passing a function parameter by reference, and the result of a macro should be equivalent to `return`. So I think this is fine - usually typing out `#define` for a function-like macro isn't ideal for golfing, but sometimes it is. (more) |
— | 6 months ago |
| Edit | Post #295684 |
Post edited: Swapped function for function-like macro |
— | 6 months ago |
| Edit | Post #295684 |
Post edited: Swapped function for function-like macro |
— | 6 months ago |
| Edit | Post #295684 | Initial revision | — | 6 months ago |
| Answer | — |
A: Single letter HTML [C (gcc)], 31 30 bytes #define f(a) strchr("abipq",a) Try it online! f(a){return strchr("abipq",a);} The most obvious (and non-creative) solution. This under default rules that a truthy value in the language is anything non-zero. To display explicitly 1 or ... (more) |
— | 6 months ago |
| Edit | Post #295553 |
Post edited: |
— | 7 months ago |
| Edit | Post #295553 |
Post edited: |
— | 7 months ago |
| Comment | Post #295553 |
@#53890 Ok in this case I must use another named parameter so I don't think that would improve golfing. I'll add the return. (more) |
— | 7 months ago |
| Comment | Post #295553 |
@#53890 Huh I might have mixed up several rules with each other. Well in that case I suppose I should add a return statement. (more) |
— | 7 months ago |
| Edit | Post #295553 |
Post edited: |
— | 7 months ago |
| Edit | Post #295553 |
Post edited: |
— | 7 months ago |
| Edit | Post #295553 |
Post edited: Actually we get away with no paranthesis around comma in this specific case |
— | 7 months ago |
| Edit | Post #295553 |
Post edited: |
— | 7 months ago |
| Edit | Post #295553 |
Post edited: |
— | 7 months ago |
| Edit | Post #295553 | Initial revision | — | 7 months ago |
| Answer | — |
A: Lone ones [C (gcc)], 67 bytes a;r;i;f(long n){for(;i<33;)a=n&1l<<i++?a?2:1:a&1?r++,0:0;return a;} Try it online! General algorithm: - This is a little state machine where the variable 'alone' `a` can have the value 0=zero, 1=alone candidate, 2=not alone. Essentially a 'carry' but ... (more) |
— | 7 months ago |
| Comment | Post #293750 |
I think the point here is whether or not it is ok to take input as a string rather than an integer. With default rules I believe that should be just fine. (more) |
— | 12 months ago |
| Comment | Post #279856 |
@#53890 Heh, thanks. I think it's simply because I was used at writing everything as a one-liner and forgot obvious things :) Saved only 3 bytes though because one was apparently a tab. (more) |
— | over 1 year ago |
| Edit | Post #279856 |
Post edited: |
— | over 1 year ago |
| Comment | Post #293610 |
The code was more fun in my first attempt before I realized you can short a lot of it :) (more) |
— | over 1 year ago |
| Edit | Post #293610 |
Post edited: |
— | over 1 year ago |
| Edit | Post #293610 |
Post edited: |
— | over 1 year ago |
| Edit | Post #293610 | Initial revision | — | over 1 year ago |
| Answer | — |
A: "Hello, World!" [Taxi], 183 bytes Go to Writer's Depot:w 1 r 3 l 2 l."Hello, World!"is waiting at Writer's Depot.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.Go to Taxi Garage:s 1 l 1 l 2 r. Try it online! (more) |
— | over 1 year ago |
| Edit | Post #293074 |
Post edited: Loop condition would fail to stop in some valid test cases |
— | almost 2 years ago |
| Edit | Post #293074 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293074 | Initial revision | — | almost 2 years ago |
| Answer | — |
A: Find the IP address class [C (gcc)], 55 bytes a;f(chars){for(;atoi(s)&128>>a&&a<4;a++);return 65+a;} Try it online! Just call atoi and start masking with 0x80. If true, keep looping and next check with 0x40 and so on, until the mask either results in zero or 4 bits have been checked, meaning all b... (more) |
— | almost 2 years ago |
| Edit | Post #293005 | Initial revision | — | almost 2 years ago |
| Answer | — |
A: Display a Progress Bar [C (gcc)], 88 bytes char a[53]={91},p=a+1,i;f(n,d){for(;i<50;)p[i++]=1.n/d<=i/50.?45:124;p[i]=93;puts(a);} Try it online! There's two approaches to this in C that I came up with - either write into an array then print it, or print everything at once but use conditionals. I tr... (more) |
— | almost 2 years ago |
| Comment | Post #292830 |
@#53890 It depends on the language. Many languages block execution if there are serious compiler diagnostics ("errors"). Other languages like C and C++ do not. The important part here is that the program must run. But as usual each solution would compete against other solutions with a similar app... (more) |
— | almost 2 years ago |
| Comment | Post #292756 |
It doesn't really matter that much, it's just an offset of fixed number of characters that you add/remove to the total. But it's quite far-fetched (at least in the C family of languages) to say that input and output to a program may come through function parameters IMO, which I believe are the de... (more) |
— | almost 2 years ago |
| Edit | Post #292831 | Initial revision | — | almost 2 years ago |
| Question | — |
Category migration and the sandbox This has probably been discussed before but I couldn't find any posts about it. I think we should re-make the sandbox category in the following way: - Votes in the sandbox category should not count towards user reputation. If users get intimidated to post sandbox proposals fearing down-vo... (more) |
— | almost 2 years ago |
| Edit | Post #292830 | Initial revision | — | almost 2 years ago |
| Question | — |
Source with the whole alphabet in order of appearance The challenge is to write as short a source as possible, where the English alphabet (in alphabetical order from top to bottom) `"abcdefghijklmnopqrstuvwxyz"` is a sub-sequence of the source code. The first mentioning of the next expected letter is the only one that counts. If a letter appears... (more) |
— | almost 2 years ago |
| Edit | Post #292376 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #292756 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #292756 | Initial revision | — | almost 2 years ago |
| Answer | — |
A: How many odd digits? [C (gcc)], 41 bytes r;o(chars){for(;s;r+=s++&1);return r;} Try it online! This is under the assumption that in a function solution, input has to be passed as parameter and output through the return value. The result variable is allocated outside the function to get gcc implic... (more) |
— | almost 2 years ago |
| Edit | Post #292376 |
Post edited: Added a rule about comments |
— | almost 2 years ago |
| Comment | Post #292376 |
@#8056 I could have sworn that I had written a rule about comments but apparently not. Thanks, will fix! (more) |
— | almost 2 years ago |
| Comment | Post #292376 |
@#53890 I honestly have no idea but probably all of the mainstream ones. Perhaps less so esoteric languages? The challenge accepts answers which is "language x + library y" even if "y" isn't officially part of the language/standard but some common extension. Like for example one could post an ans... (more) |
— | about 2 years ago |
| Edit | Post #292376 |
Post edited: |
— | about 2 years ago |
| Comment | Post #292376 |
@#53890 That sounds much clearer indeed, I'll use that - thanks! (more) |
— | about 2 years ago |
| Edit | Post #292376 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292376 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292376 |
Post edited: |
— | about 2 years ago |
