Activity for Arpad Horvath
| Type | On... | Excerpt | Status | Date |
|---|---|---|---|---|
| Edit | Post #294525 |
Post edited: using >>= (like a bind operator) |
— | 12 months ago |
| Edit | Post #294525 |
Post edited: I need to revert += solution as it gives reserved solution |
— | 12 months ago |
| Edit | Post #294525 |
Post edited: courtesy |
— | about 1 year ago |
| Edit | Post #294525 |
Post edited: -2 bytes |
— | about 1 year ago |
| Edit | Post #290206 |
Post edited: Some fixes |
— | about 1 year ago |
| Edit | Post #290206 |
Post edited: Make the first line a header |
— | about 1 year ago |
| Edit | Post #290206 |
Post edited: Make the first line a header |
— | about 1 year ago |
| Edit | Post #294525 |
Post edited: string concatenation instead of list |
— | about 1 year ago |
| Edit | Post #294525 |
Post edited: |
— | about 1 year ago |
| Edit | Post #294525 | Initial revision | — | about 1 year ago |
| Answer | — |
A: Convert to Hexadecimal [Python 3.8 (pre-release)], 70 bytes -1 bytes using default arg & -1 bytes using >>= (thanks trichoplax) def h(n,a=''): while n>0:a="0123456789ABCDEF"[n%16]+a;n>>=4 return a Try it online! (more) |
— | about 1 year ago |
| Comment | Post #293336 |
I am not familiar with TIO. (And also with APL, I've used Q/KDB+ earlier, and they are somewhat similar.)
If I remember correctly assigning the function to a name is not part of the code
so I've added the assignment (f←) in the footer.
If that counts too, than it is 2 characters longer. (more) |
— | over 1 year ago |
| Edit | Post #293336 |
Post edited: |
— | over 1 year ago |
| Edit | Post #293336 | Initial revision | — | over 1 year ago |
| Answer | — |
A: Expand a greyscale/colour hex code [APL (Dyalog Classic)], 31 bytes '#',{4=≢⍵:⍵[2 2 3 3 4 4]⋄6⍴1↓⍵} Try it online! (more) |
— | over 1 year ago |
| Comment | Post #292945 |
with lambda function it is little bit shorter
Instead of
def f(n,d):return
(19 chars with the space at the end)
You can write:
lambda n, d:
(11 chars)
As far as I know you don't need to assign it to a name, so it is a solution. (more) |
— | over 1 year ago |
| Edit | Post #293328 |
Post edited: Testing |
— | over 1 year ago |
| Edit | Post #293328 | Initial revision | — | over 1 year ago |
| Answer | — |
A: Expand a greyscale/colour hex code Q/KDB+, 39 bytes {"#",?[4=count x;x 1 1 2 2 3 3;6#1x]} Testing the function: q)cc:{"#",?[4=count x;x 1 1 2 2 3 3;6#1x]} q)cc "#ABCDEF" "#ABCDEF" q)cc "#A" "#AAAAAA" q)cc "#AB" "#ABABAB" q)cc "#ABC" "#AABBCC" q) is the prompt, other lin... (more) |
— | over 1 year ago |
| Edit | Post #291390 | Initial revision | — | over 2 years ago |
| Answer | — |
A: Round trip stones [Python], 104 bytes ```python f=lambda n:"1.0000000.7272730.7285710.7368420.7437890.7491640.7533440.7566570.7593360.761542"[8n-8:8n] ``` Try it online! Not too clever. I am curious whether it can be beaten with a Python code that really calculates the probability and prints the re... (more) |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: version |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: just python |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: |
— | over 2 years ago |
| Comment | Post #291320 |
There are 8 kind of characters, " IXLCDM". 2 characters are 6 bits that can be easily mapped to printable characters (after 32 code point). This string is much shorter then the "DD DM IC ..." string itself. Even if I add the extraction it is still somewhat shorter.
I just regenerate the " IXLC... (more) |
— | over 2 years ago |
| Edit | Post #291324 | Initial revision | — | over 2 years ago |
| Answer | — |
A: The 50 substrings that validate any string of Roman numerals [Haskell], 271 bytes import Data.Char import Data.List n=" IVXLCDM" r x=maximum[if(s`isInfixOf`x)then s else"A"|s(n!!div x 8):[(n!!(x-8(div x 8)))])$map(\x->ord x-32)"&PW!H.!@/$HF$@G\"H6\"@7\"03#P?%N%O%U%]%^%&N&O!!+!1!=!9!<!:!;$=$<\"\"+#M#N#L#O#K#C#=#<%MH))\'X;;"] Try... (more) |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: even shorter 220 |
— | over 2 years ago |
| Comment | Post #291320 |
Sorry for making that much work for you. My bad. I don't know exactly what did I do then but does't work for me now. But fortunately the current one is just 1 bytes longer.
It works if I use square brackets inside te max function, but then it is longer then the current one. (more) |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: Fixing the code |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: 3.9 |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: shorter |
— | over 2 years ago |
| Edit | Post #291320 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291320 | Initial revision | — | over 2 years ago |
| Answer | — |
A: The 50 substrings that validate any string of Roman numerals [Python], 220 bytes Works with Python 3.8 or newer. n=" IVXLCDM" x=("".join([n[(d:=ord(c)-32)//8]+n[d-8(d//8)]for c in'&PW!H.!@/$HF$@G"H6"@7"03#P?%N%O%U%]%^%&N&O!!+!1!=!9! r=lambda c:max(s if s in c else"A"for s in'DD DM IC ID IL IM LC LD LL LM VC VD VL VM VV VX XD XM CC... (more) |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: small fix |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: remove test |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: remove duplicate |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: was a long variable name |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: try it online after the code |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: you can try it online |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: Doesn't matter whether the assignments are in one line or several lines, the number of bytes are the same, so I have here the more readable version with new lines. |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: 584 |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: shorter version |
— | over 2 years ago |
| Comment | Post #291299 |
Thank you, At the end I have realized, that using 0,1 and 2 instead of the variables is even shorter. (more) |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: remove set |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: reordering long version |
— | over 2 years ago |
| Edit | Post #291299 |
Post edited: test cases |
— | over 2 years ago |
