Posts by Wezl
Ruby, 33 bytes ->n{?#*n+(' #'+' '*(n-2)+?#)*~-n} Try it online! Basically the same as moshi's python (developed parallelly).
Ruby, 74 bytes Full program: s=gets+$_.reverse puts [s[0]]+s[1..-2].chars.zip(0..).map{_1+' '*_2+_1}<<s Note that this is not fit for interactive use because it looks weird when you inp...
Ruby, 17 bytes ->{_2.reduce(_1)} Takes function (Proc) followed by Array. 32 bytes without inject or reduce ->f,(a,*r){r.map{|n|a=f[a,n]};a}
Yes Challenges are what we need to survive Some of our users answer almost every new challenge, but that's not enough to keep codidact alive if there are no new challenges now and then. Challeng...
posix SH + GNU sed, 43 bytes seq $1|tac|sed -zE 's/(\n.+)(\n.+)/\2\1/mg' seq $1 # 1..the argument (inclusive) |tac| # reverse sed # replace...
Sed -E, 25 bytes Takes second input, , comma, first input (inputs cannot contain , commas). s/^(.*)(.*),(.*)\1$/\3\2/
Natural to set (set meaning an unordered collection with no duplicates, though answers may use and output lists instead) Recently I was brainstorming what a language with only (arbitrarily nested...
Jq, -rn 18 bytes "|@json+."|@json+. "|@json+." # the string | # through the filter @json # json encoded + # concatenated with ...
Exploiting layout Make it thin Newlines and indentation are expensive, so remove them when possible. Some examples: &v factorial v< > >:1-:| v* < >$>\:| ...
jq, 16 bytes, preferably -rR ./""|reverse|add Annoyingly, jq has convenient things like implicit I/O, and annoying things like adding strings, but you can't reverse a string >:|. ./""&...