New answers tagged


Vyxal, 6 bytes s²Ṙḣ∑= Try it Online! A very simple 6 byter. Can't think of any stack manipulation to get it to 5. Outputs 1 for truthy, 0 for falsey. Explained s²Ṙḣ∑= s² # sort and square the input Ṙ # reverse the list so that it's in descending order ḣ # push the head of that, and the rest of that to the stack ∑= # does the sum of the ...


Pari/GP, 73 bytes Based on @loopy walt's Python answer. a->7>#Set([a=if(i%2,matrix(#a,,i,j,a[i,(#a\2+i-j)%#a+1]),a~)|i<-[1..12]]) Try it online! Takes a matrix skewed to the left with zero padding.


Python 3.8 (pre-release), 137 bytes g=lambda h:(*[".".join(r.split(".")[::-1])for r in h],) f=lambda h,*S:len(S)<8>0<f(g(map("".join,zip(*(t:=h[::-1])))),h,g(t),*S)or h in S Try it online! The function f takes in a tuple of strings representing a left-skewed hexagon. Returns True if the hexagon is symmetric, or False ...


Python NumPy, 92 bytes (@Neil) def f(l,*o): for a in[l>0]*6:l.T[::-1][a[::-1]]=l[a];o+=str(l),str(l.T) return 7>len({*o}) Attempt This Online! Pure (no NumPy) Python version, 111 bytes lambda l:7>len({l:=((x:=~len(l)//2)and(*(k[(x:=x+1):]+k[:x]for k in i*l[::-1]),)or(*zip(*l),))for i in[0,1]*6}) Attempt This Online! Old Python, 128 bytes def f(*l):...


Charcoal, 61 58 bytes WS⊞υ⪪ι¹≔⟦⟧θF⁶F²«⊞θ⭆υ⪫λωUMυ⎇κ⮌λE✂υ⁺⊘Lυμ±⁻⊘⊕׳Lυμ±¹⊟ν»⊙θ⊖№θι Try it online! Link is to verbose version of code. Takes input as newline-terminated ASCII art but without any spaces and outputs a Charcoal boolean, i.e. - for symmetric, nothing if not. Explanation: WS⊞υ⪪ι¹ Input the list of rows. ≔⟦⟧θ Start building up the list of rows and ...


Husk, 6 bytes √Σzo□- Try it online! Explanation √Σzo□- z zip input arguments o with composed function - difference □ squared Σ sum √ sqrt


Factor + math.distances, 18 bytes euclidian-distance Try it online! Built-in.


Desmos, 26 bytes f(a,b)=total((a-b)^2)^{.5} The function \$f(a,b)\$ takes in two lists, \$a\$ and \$b\$, representing the two points, and returns the distance between them. I think the code is pretty self explanatory, even for someone unfamiliar with Desmos. Try It On Desmos! Try It On Desmos! - Prettified

Top 50 recent answers are included