Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for Shaggy‭

Type On... Excerpt Status Date
Answer A: Efficient censorship
Japt `-h`, 7 bytes à ñÊkøV Try it à ñÊkøV :Implicit input of strings U=X & V=Y à :Powerset of U ñ :Sort by Ê : Length k :Remove elements that øV : Contain V :Implicit output of last eleme...
(more)
11 months ago
Answer A: Digit antitranspose
Japt, 2 bytes Input as a multi-line string ÕÔ Try it ÕÔ :Implicit input of string Õ :Transpose Ô :Reverse
(more)
over 1 year ago
Answer A: Sort letters by height
Japt, 23 16 15 13 bytes Lexicographical sort using the custom alphabet `tipbdghkflyqj`. I/O as characters arrays, sorts in ascending order. n`“pbdghkf§qj Try it
(more)
over 1 year ago
Answer A: Mediocre pop count
JavaScript, 104 102 99 bytes I/O as a character array. a=>a.filter(x=>a[...Buffer(x)[0].toString(2)].sort()).sort()) Try it online!
(more)
over 1 year ago
Answer A: Lowercase, but not just the letters
JavaScript, 52 51 28 bytes s=>Buffer(s).map(x=>x|32)+`` Try it online! -1 byte thanks to trichoplax‭.
(more)
over 1 year ago
Answer A: Lowercase, but not just the letters
Japt, 3 bytes c|H Try it c|H :Implicit input of string c :Map charcodes | : Bitwise OR with H : 32
(more)
over 1 year ago
Answer A: Mediocre pop count
Japt, 13 bytes ÆüÈc¤ñÃé ¤¬øX Try it ÆüÈc¤ñÃé ¤¬øX :Implicit input of string U Æ :Filter each character, X by ü : Group & sort U by È : Passing each character through the following function c : ...
(more)
over 1 year ago
Answer A: Just the vowels please
JavaScript, 27 24 bytes Input as a string, output as a character array or empty array. s=>s.split(/[^aeiou]/i) Try it online! Thanks to Moshi for pointing out the `` I was missing that would allow me to use `split` instead of `match` and get down to 24 bytes.
(more)
over 1 year ago
Answer A: Just the vowels please
Japt v2.0a0, 3 bytes o\v Try it o\v :Implicit input of string o :Keep only \v :RegEx /[aeiou]/gi
(more)
over 1 year ago
Answer A: 55 fruit salad: choose your own Kolmogorov complexity
Japt, 233 bytes `ÜÊ Ò˜ Í a×G ¯¯o ÖÚb ¯ØÚ ×– »Ûá ÝÁ„ Á²g fig ¤¶n ÓI„ lªo §Ö‡ ÚAo Ú-n Û u Ûo nÂ) šem ÇÓy pe‡ pi¦ Îñˆ ΰn Ѧk Ѧl sŽb ÉŽ ȃp Èîp ÈlŸ ‘y °ÛG Ù i abiu alڈ app¤ ‡aza bael b„„a ¼ÚAe Þ×l ÖðŠo ¯mÞö ÖÇÐU ¯qui րry ¬¬n© c¨Îà emÞV gŸpe Î\ Just a compressed string, decompressed by...
(more)
over 1 year ago
Answer A: Up to date JavaScript Try-It-Online
There is a new project called Attempt This Online intended as an alternative to TIO. It's pretty nascent so doesn't yet support the same volume of languages as TIO and the only version of JavaScript currently available is Node. Other than that, there are plenty of tools available online for writin...
(more)
over 1 year ago
Answer A: The holeyest base
Japt `-h`, 19 18 bytes Gõ ñ@ìX xg#‘5#}4s3 Try it Gõ ñ@ìX xg#‘5#}4s3 :Implicit input of integer U G :16 õ :Range [1,G] ñ :Sort by @ :Passing each X through the following functio...
(more)
over 1 year ago
Answer A: 8 coexisting queens
Japt `-R`, 16 15 bytes Uses spaces for `#`s and `"`s for `Q`s. ##Ë64ì £QùXÄÃy Test it (footer reformats the output to use the characters from the spec) This one uses `1`s for `#`s. ##Ë64ì £#ÿ¤hXQ Test it (footer as above) ##Ë64ì £QùXÄÃy ##Ë64 ...
(more)
over 1 year ago
Answer A: Determine whether an integer is square-free
JavaScript, 31 bytes Outputs `0` for falsey and a non-zero value for truthy. If the 2 values must be consistent then replace the last `` with `&&` to output `true` instead. n=>(g=d=>d++>n||n%d2g(d))(1) Try it online!
(more)
over 1 year ago
Answer A: Presumptuous base conversion
Python, 45 bytes I am not a Python guy at all, so I'm quite proud of this. I'm sure, though, there's something simple I could be doing to save myself a few bytes! lambda n:int(n,int(max("1"+n),16)+1)or len(n) Try it online!
(more)
over 1 year ago
Answer A: Presumptuous base conversion
JavaScript, 73 71 63 53 52 bytes Well, this ain't pretty at all! Will need to take another pass over it to try to improve upon it, maybe with recursion.Yeah, I was completely overthinking this one! s=>parseInt(s,`0x`+[...s].sort().pop()-0)||s.length Try it online! (Includes all test ...
(more)
over 1 year ago
Answer A: Presumptuous base conversion
Japt, 13 bytes Takes input as a character array. mnG ìUrÔÄ ªUl Try it mnG\nìUrÔÄ ªUl :Implicit input of character array U m :Map n : Convert from base G : 16 \n :Reassign to U ...
(more)
over 1 year ago
Answer A: Looping counter
Japt, 6 bytes ßOpP±Q Test it ßOpP±Q ß :Recursive call Op :Output with trailing newline P :Empty string, initially ± :Append Q :Quotation mark
(more)
over 1 year ago
Answer A: Determine whether an integer is square-free
Japt, 5 bytes k eUâ Try it
(more)
over 1 year ago
Answer A: Looping counter
JavaScript, 25 bytes Could be 21 but calling the function like that feels like cheating. (f=s=>f(s+=8,print(s)))`` Try it online! 22 bytes Didn't want to post this as my main solution as it's pretty much the same as Moshi's. for(s=``;;)print(s+=8) Try it online!
(more)
over 1 year ago
Answer A: Create a range grid
Japt `-m`, 4 bytes VÆT° Try it
(more)
over 1 year ago
Answer A: Make a frequency table (histogram)
Japt, 8 bytes ü ®â pZl Try it
(more)
over 1 year ago
Answer A: Find n Niven Numbers
Japt, 10 bytes ÈvXìx}jU1ì Try it
(more)
over 1 year ago
Answer A: "Hello, {name}!"
JavaScript, 28 bytes alert(`Hello, ${prompt()}!`) Try it online!
(more)
over 2 years ago
Answer A: Operation "Find The Operator"
Japt, 16 bytes Takes the result as the first input and the other 2 values as an array as the second input. Uses `z` for floor division & `p` for exponentiation and outputs `"` if there's no match (costing 3 bytes :\\) "+-z%p"ƶVrXêQ Try it
(more)
over 2 years ago
Answer A: Collatz conjecture; Count the tries to reach $1$
JavaScript, 28 bytes f=n=>n-1&&-f(n%2?n3+1:n/2) Try it online!
(more)
over 2 years ago
Answer A: Collatz conjecture; Count the tries to reach $1$
Japt, 15 bytes É©Òß[U3ÄUz]gUv Try it É©Òß[U3ÄUz]gUv :Implicit input of integer U É :Subtract 1 © :Logical AND with Ò :Negate the bitwise NOT of (i.e., increment) ß :Recursive call with inp...
(more)
over 2 years ago
Answer A: Reverse an ASCII string
Rockstar, 67 bytes listen to S split S O's"" while S roll S into C let O be C+O say O Try it here (Code will need to be pasted in)
(more)
over 2 years ago
Answer A: Evens or Odds - you know this one
Rockstar, 44 bytes Outputs `1` for odd or `0` for even. listen to N let M be N/2 turn up M say M2-N Try it here (Code will need to be pasted in)
(more)
over 2 years ago
Answer A: A number adder, not a death adder
Rockstar, 40 bytes listen to N say "listen to N say N-0+"+N Which outputs P2, where `X` is the input from P1: listen to N say N-0+X Try it here (Code will need to be pasted in)
(more)
over 2 years ago
Answer A: Repeat the characters
Rockstar, 90 bytes listen to S split S listen to N O's"" while S roll S into C let C beN-0 let O be+C say O Try it here - code will need to be pasted in; `s` goes on the first line of input (leave blank for the empty string) and `n` goes on the ...
(more)
over 2 years ago
Answer A: Repeat the characters
JavaScript, 36 bytes s=>n=>s.replace(/./g,`$&`.repeat(n)) Try it online!
(more)
over 2 years ago
Answer A: Repeat the characters
Japt `-m`, 2 bytes pV Try it pV :Implicit map of first input string p :Repeat V :Second input times
(more)
over 2 years ago
Question Digit Sum Integer Sequence (working title)
Inspired by this challenge. If anyone has any suggestions for a song title I could use for the challenge title then please leave a comment. Definition We define `f(x)` for a given integer as the sum of: - `x` itself, - `s`, the smallest digit in the decimal representation of `x`, and, - `l`, t...
(more)
over 2 years ago
Answer A: "Hello, {name}!"
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.
(more)
over 2 years ago
Answer A: Stairs? Stairs! Stairs.
Japt `-R`, 13 bytes Uses `=` in place of `#`. Æ"/"+Xç¥ÃoÅù Try it Æ"/"+Xç¥ÃoÅù :Implicit input of integer U Æ :Map each X in the range [0,U) "/" : Literal string + : Append Xç : X times repeat...
(more)
over 2 years ago
Answer A: 1, 2, Fizz, 4, Buzz!
Rockstar, 138 135 133 bytes F takes I&S let M be N/I turn up M if N-IM S's"" return S N's0 while N-100 let N be+1 say F taking 3,"Fizz"+F taking 5,"Buzz" or N Try it here (Code will need to be pasted in)
(more)
over 2 years ago
Answer A: Word Set Square
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! – Try It Online")
(more)
over 2 years ago
Answer A: Generalized Sort
Japt `-h`, 5 bytes Takes the array to be sorted as input and assigns the array of functions, in reverse order, to variable V. V£=ñX Try the names test case I could save a byte by replacing `=ñ` with just `n` and tweaking the functions but doing it this way allows me to do something Ja...
(more)
over 2 years ago
Answer A: Generalized Sort
JavaScript, 25 bytes Arguments are curried, i.e. `f(a)(s)`, where `a` is the array to be sorted and `s` is an array of functions to sort by, in reverse order. Modifies `a` in place, which I don't know that we have a consensus on here yet - if it's not permitted then add `&&a` to the end to return ...
(more)
over 2 years ago
Answer A: Make my value binary
JavaScript, 16 bytes n=>n.toString(2) Try it online!
(more)
over 2 years ago
Answer A: Make my value binary
Japt, 1 byte ¤ Try it or run all test cases
(more)
over 2 years ago
Answer A: My house is destroyed! Can you make me one?
Rockstar, 82 bytes listen to N let N be-2 X's-1 say "##"+"#"N while N-X say "#"+" "N+"#" let X be+1 Try it (code will need to be pasted in)
(more)
over 2 years ago
Answer A: Make $2 + 2 = 5$
JavaScript, 19 bytes x=>y=>x-2|y-2?x+y:5 Try it online!
(more)
over 2 years ago
Answer A: Make $2 + 2 = 5$
Japt `-x`, 6 5 bytes Takes input as an array of integers p!UdÍ Try it p!UdÍ :Implicit input of array U p :Push ! : Logical NOT of Ud : Any true (not zero) when Í : Subtracted from 2 :Implicit output of sum ...
(more)
over 2 years ago
Answer A: My house is destroyed! Can you make me one?
JavaScript, 47 bytes n=>`0`.repeat(n)+(` 0`.padEnd(n--)+0).repeat(n) Try it online! – Try It Online") My first pass used recursion before I realised I was over thinking things! First 51 byte version includes a leading newline, second 52 byte version was in case that wasn't allow...
(more)
over 2 years ago
Answer A: My house is destroyed! Can you make me one?
Japt `-R`, 11 10 bytes ÆQ+ùUÉÃvçQ Try it ÆQ+ùUÉÃvçQ :Implicit input of integer U Æ :Map the range [0,U) Q : Quotation mark + : Append another ù : Left padded with spaces to length UÉ : ...
(more)
over 2 years ago
Answer A: Roll n fair dice
Japt `-mx`, 3 bytes Takes `n` as the first input and `m` as the second. ÒVö Try it ÒVö :Implicit map of the range [0,first input) Ò :Negate the bitwise NOT of (i.e., increment) V :Second input ö :Random int in range [0,V) :Implicit...
(more)
over 2 years ago
Question In The Jailhouse Now
Challenge Given an integer `n>=4` as input create an ASCII art "prison door" measuring `n-1` characters wide and `n` characters high, using the symbols from the example below. Example ╔╦╗ ╠╬╣ ╠╬╣ ╚╩╝ The characters used are as follows: ┌───────────────┬─────────┬──...
(more)
over 2 years ago
Answer A: Multiply two strings
JavaScript, 37 bytes I/O as character arrays. a=>b=>b.flatMap(x=>a.map(y=>x<y?x:y)) Try it online!
(more)
over 2 years ago