Search
Vyxal J, 12 bytes ḣmėƛ÷꘍ṘǏ;⁋?m Try it Online! ḣ # Head extract (x[0], x[1:] ) m # Mirror the ToS (x[1:]) ė # Zip with 0...length ƛ ; # Map... ...
Vyxal R, 1 byte R Try it Online! Function must be inserted in the header. The R flag casts integers to ranges when an integer can't be used. R is the builtin for 'Reduce list by function', an...
Scala, 64 bytes 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...
JavaScript, 76 bytes Outputs an array of lines. s=>[...s+=[...s].reverse().join``].map((c,x)=>s[-~x]?c.padEnd(x)+(x?c:``):s) Try it online!
jq, 48 bytes [while(.>0;./2|floor)]|map(.%2)|reverse|join("") Try it online! jq is the Language of the month for September! if the output is not required as per the question, join can be o...
If you have any tips for golfing in Python, add them as answers to this post.
jq --raw-output, 32 bytes jq is the language of the month, apparently. Here it is! Not sure if the --raw-output flag really matters, someone let me know. "#"*.+(" #"+" "*(.-2)+"#")*(.-1) Try ...
Python 3, 78 bytes def t(n,*l):d="0+-"[n%3];return d*(not l or n*n) if n*n<2 else t((n+1)//3,1)+d Try it online!
Haskell, 78 bytes (!)0.(*2) i!n|i<n=(drop 3$(n-i)#' '++"_/"++i#'#'):(i+2)!n|0<1=[] (#)=replicate Try it online!
Combine conditionals Python has its fair share of comparison operators and can actually be used in a single conditional. For example: x == 2 and y == 2 can be: x==y==2 Used on Make $2 + 2 ...
Japt, 10 bytes `HÁM, {U}! Try it The backtick decompresses a compressed string, the {} is Japt's string interpolation and U is the first input variable.
Haskell, 43 35 bytes main=interact$("Hello, "++).(++"!") Try it online!
C (gcc), 43 bytes a[99];main(){printf("Hello, %s!",gets(a));} Try it online!
Ruby, 15 bytes ->a{a.all?a[0]} ->a{ } # lambda taking array `a` a.all? # do all items in the array match... a[0] # ...the first? Try it online!
C (gcc), 46 bytes f(int*a){return *a<0|a[1]<0||*a==a[1]&f(a+1);} This takes an array that is terminated by a negative number (which is not part of the list content, just like the te...
Lua, 32 bytes print(string.reverse(io.read())) Try it online! Noice built-in.
Ruby, 43 bytes ->n{(1..n).map{|i|" "*(n-i)+?/*i+?\\*i}*$/} ->n{ } # lambda (1..n).map{|i| } # map over 1 to n ...
JavaScript (Node.js), 606 bytes for(_="=>\\\\ =j(...(a:').join`\\n`[q](/aa),/ / / d[c[___) .match(/.{.||]/g,=='.mapf=(n,m=([a,b]a?m(b)+a',l=10000n,j=, b,c=0a-c?[b(cj,b,c+1)]:[],b=[q='rep...
APL (Dyalog Classic), 47 bytes i←+∘1⋄d←-∘1⋄s←×⍨⋄o←⎕∘←⋄{}{0⌈a×256≠a←⍎⍕⍺,⍵}/⌽0,⍞ Try it online!
JavaScript (Node.js), 80 bytes f=a=>a.map(a=>(a&=6,a-2?a-6?c+=1-a/2:d+=c+' ':c*=c,c*=c!=-1&c!=256),c=0,d='')&&d Try it online!
Jelly, 9 bytes Rȧ_@Rп@L Try it online! Takes $t_1$ on the left and $t_2$ on the right. R}ȧ_@RпL works given the arguments in the opposite order. R Ascending range from 1 to t_1 (...
Pyth, 10 bytes s*R^H~hZhA Try it online! Alternate 10 byte solution: s.e*b^eQkh Try it online!