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: Multiply two strings
Japt `-m`, 5 bytes Takes input in reverse order. Sadly, Japt has no minimum built-in for strings. VcmUc Try it VcmUc :Implicit map of each U in the first input string V :Second input c :Map charcodes m : Minimum with Uc : Ch...
(more)
over 2 years ago
Answer A: 99 Shortened Bottles of Beer
JavaScript (V8), 185 bytes for(c=99;c;)print((f=(s=` on the wall`)=>`${c||99} bottle${-c?`s`:``} of beer`+s)()+`, ${f``}. ${--c?`Take one down and pass it around`:`Go to the store and buy some more`}, ${f()}. `) Try it online!
(more)
over 2 years ago
Answer A: Generate Lewis Caroll's Jabberwocky
Japt, 610 606 bytes Don't think there's anything more that can be done with it than this. 933î`'T°s ߍ¦g, „d e sҐy ‘vƒ Did gyœ „d g‹½e ˆ e °¼; A¥ Úßy ØÀ e ޒgovƒ, A˜ e Ú  ÎÈs ŒtgŸ¼.0"BeØ e 1, my s! T” jaws È ßÒ, e claws È ¯t®! BeØ e Jubjub bird, „d д ...
(more)
almost 3 years ago
Answer A: Small integer swapping
Japt, 3 bytes I/O as an array. cUé Try it cUé :Implicit input of array U c :Concatenate Ué : U rotated right once
(more)
almost 3 years ago
Question Coat of Many Colours
Challenge Given a list of unique colour names as input, sort them in the order that they first appear in Joseph's Amazing Technicolour Dreamcoat. Example Input: green, blue, red, brown Output: red, green, brown, blue The full list of colours, in order, is: 1. red 2. ...
(more)
almost 3 years ago
Answer A: Juggler sequences
Japt, 17 bytes Needs some more work. É?[U]cßÂUp½+Uu:1ì Try it If there's a proof that the length of the sequence for any given `n` never exceeds `n3` then ... Japt, 14 bytes NcU³Æ=Âp½+UuÃâ Try it
(more)
almost 3 years ago
Answer A: Juggler sequences
JavaScript, 37 32 bytes Outputs a comma delimited string. f=n=>n-1?n+[,f(n(.5+n%2)|0)]:n Try it online!
(more)
almost 3 years ago
Answer A: Getting perfect squares, differently
JavaScript (V8), 28 bytes for(x=y=0;;++y)print(x+=++y) Try it online!
(more)
almost 3 years ago
Answer A: Getting perfect squares, differently
Japt, 9 bytes No infinite lists in Japt so we'll have to go with a recursive solution. ßOpTµJJµ2 Test it ßOpTµJJµ2 ß :Recursive call with (irrelevant) argument Op : Output with trailing newline (returns undefined and second argument is ignored) ...
(more)
almost 3 years ago
Answer A: Are All Elements Equal?
Rockstar, 76 bytes Takes individual integers as input. listen to f let n be f o's1 while n let o be o and n is f listen to n say o Try it (Code and input will need to be added manually, with each input integer on its own line)
(more)
almost 3 years ago
Answer A: Are All Elements Equal?
JavaScript, 20 bytes Outputs `false` for truthy and `true` for falsey. a=>a.some(x=>x-a[0]) Try it online! Outputs `true` and `false` as normal. a=>new Set(a).size<2 Try it online!
(more)
almost 3 years ago
Answer A: Are All Elements Equal?
Japt, 3 bytes e¡g Try it e¡g :Implicit input of array U e :Is equal to ¡ :Map U g : First element of U
(more)
almost 3 years ago
Answer A: Reduce over the range [1..n]
JavaScript, 25 bytes The function is called with `f(g)(n)`, where `g` is a function. g=>h=n=>n-1?g(h(n-1),n):1 Try it online!
(more)
almost 3 years ago
Answer A: Reduce over the range [1..n]
Japt, 4 bytes Takes the operator as a string but would also work without modification using a function by assigning it to variable `V`. That can be done in the header by leaving a blank line and then entering a function in the form `XY{X[op]Y}`, where `[op]` is the operator or method. õ rV ...
(more)
almost 3 years ago
Answer A: Guess the language! (Cops' Thread)
Jelly, cracked by m90 13 bytes Should be pretty simple - I'm running out of ideas; one of the downsides of only golfing in 2 languages! “¿×⁶ṆḶN{N=ȷṾ» Try it online!
(more)
almost 3 years ago
Answer A: Guess the language! (Cops' Thread)
brainfuck, cracked by Aaron Miller, 243 bytes void main(x,y)->{ printf=io.write(z=x-y); printf("+++++[++++>---.+[--->++++.+.+++.+[---->++++.[->++++.+++++++++++++.----------.-[--->+-.>-[--->+---.--[--->+-.-------------..+++.+++++++++++++.+."); print "Cops and Robbers"; }
(more)
almost 3 years ago
Answer A: 99 Shortened Bottles of Beer
Japt, 117 116 115 bytes Needs more golfing or, perhaps, a completely different approach. Borrows a couple of tricks trick from ETHProductions' original version. Includes 2 trailing newlines. ´LÇ=L+` Þ­¤{´LÎçs}  Þ8`". {=Z+`  e Ø!`}, {Z}. {LÎg`Go ‘ e ÐJe „d ¿y Ñ Ú ...
(more)
almost 3 years ago
Question It's Hip to be Square
Challenge A catalogue type challenge that simply asks: Given an integer `n` (where `n>=0`) as input return a truthy value if `n` is a perfect square or a falsey value if not. Rules - You may take input by any reasonable, convenient means. - You need not handle inputs greater than what your ch...
(more)
almost 3 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Mark Girrafe's answer: PicoLisp A sneaky search of TIO's GitHub org revealed this one ;) (prinl "Cops and Robbers")(bye) Try it online!
(more)
almost 3 years ago
Answer A: Guess the language! (Cops' Thread)
Rockstar, cracked by Hakerh400, 126 bytes I never thought of languages that would ignore everything except the strings - I should have stated that the solution should be irreducible. Hakerh400 gets the win here but Razetime got the correct answer after the fact. Let the cops be "Cops" ...
(more)
almost 3 years ago
Answer A: Guess the language! (Cops' Thread)
JSFuck, cracked by user, 6106 bytes With honourable mention to AndrewTheCodeGolfer who first recognised it as JavaScript. This version will only work in Firefox v90+. [][(![]+[])[+!![]]+(!![]+[])[+[]]][([]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+!![]]+(!![]...
(more)
almost 3 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Mark Girrafe's answer: Rust fn main(){print!("Cops and Robbers")} Try it online!
(more)
almost 3 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Mark Girrafe's answer: F# printfn"Cops and Robbers" Try it online!
(more)
almost 3 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Quintec‭'s answer: Canvas My first clue was the `echp`; if the language used `echo` then why wouldn't it error on that? The second clue was that the last line contained the exact output we needed so I suspect that we're looking for a golfing language that ignores all but the last line of a ...
(more)
almost 3 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Kevin M. Mansour‭'s answer: Erlang Searched for languages that use `fwrite`, no joy. Searched for `io:fwrite`, got it instantly ``` main([])-> io:fwrite("Cops and Robbers"). ``` Try it online!
(more)
almost 3 years ago
Answer A: Guess the language! (Robbers' Thread)
Cracks Mark Girrafe's answer: Japt No way I wasn't getting this one! Even if the intended solution was Pyth. "Cops and Robbers Test it
(more)
almost 3 years ago
Answer A: Gamer Meme Creator
Japt, 19 bytes Takes the artwork as an array of lines and the string as the second input. If we can require that the artwork be right padded with spaces on each line so they're all the same length then the first 2 bytes can be removed but I suspect that them being different lengths is integral to ...
(more)
almost 3 years ago
Answer A: "Hello, World!"
Rockstar, 19 bytes say "Hello, World!" Try it here (Code will need to be pasted in)
(more)
almost 3 years ago
Answer A: Guess the language! (Cops' Thread)
Japt, cracked by Razetime, 44 bytes ((Cops)&(Robbers))`¬ps „d žbÞ`¸ËhDÎmEgviuø Test it `...`¸ËhDÎmEgviuø `...` :Compressed string "cops and robbers" ¸ :Split on spaces Ë :Map each D at index E h ...
(more)
almost 3 years ago
Answer A: The Pell Numbers
Japt, 11 9 bytes Outputs the first `n` terms. Change the `h` to `g` to get the `n`th 0-indexed term. ÈÑ+ZÔÅÎ}h Try it ÈÑ+ZÔÅÎ}h :Implicit input of integer U È :Function taking an integer X and an array Z as arguments Ñ : X2 + ...
(more)
almost 3 years ago
Answer A: The Pell Numbers
JavaScript, 26 bytes Outputs the `n`th term, 0-indexed. f=n=>n f=n=>--n&&f(n)+[,(g=n=>n<2?n:g(--n)2+g(--n))(n)] Try it online!
(more)
almost 3 years ago
Answer A: Add two negabinary integers
Japt, 8 bytes Input as an array of negabinary digit arrays, output as a negabinary digit array. xì2n)ì2n Try it or run all test cases (headers & footers convert to & from digit arrays) xì2n)ì2n :Implicit input of 2D digit array x :Reduce by addition after ...
(more)
almost 3 years ago
Answer A: A number adder, not a death adder
Japt, 4 bytes P1 is: +"+U Try it Which outputs P2, where `N1` is the input from P1: N1+U Try it
(more)
almost 3 years ago
Answer A: Shuffle a subset of a list
Japt, 17 bytes ô@VøYÃíUgV öx)c f Try it Japt, 17 bytes ô@VøYÃíUgV öx)c f Try it ô@VøYÃíUgV öx)c f :Implicit input of arrays U=integers & V=indices ô :Split U on elements ... @ :That return true when their indices are ...
(more)
almost 3 years ago
Answer A: Create a Sudoku
Japt, 10 bytes Outputs a 2D-array. 9õ ñu3 £éX Try it 9õ ñu3\n£éX 9õ :Range [1,9] ñ :Sort by u3 : Mod 3 of each \n :Assign to variable U £ :Map each X éX : U rotated...
(more)
almost 3 years ago
Answer A: Partial Sums of Harmonic Series
JavaScript, 29 bytes f=(n,x=0)=>n>0?f(n-1/++x,x):x Try it online!
(more)
almost 3 years ago
Answer A: Golf a FRACTRAN interpreter
JavaScript, 44 bytes a=>g=n=>a.every(([p,q])=>(x=np/q)%1)?n:g(x) Try it online!
(more)
almost 3 years ago
Answer A: Golf a FRACTRAN interpreter
Japt v2.0a0, 18 bytes The `r÷` can be removed if we can take an array of floats instead. T=V£Xr÷Ãæv1)?ßT:U Try it T=V£Xr÷Ãæv1)?ßT:U :Implicit input of integer U and 2D-array V T= :Assign to variable T V£ : Map each X in V ...
(more)
almost 3 years ago
Answer A: Prime Difference
Japt, 15 14 bytes @§XnÈj}aX+j}a2 Try it or run all test cases @§XnÈj}aX+j}a2 :Implicit input of integer U @ :Function taking an integer X as argument § : Is U <= ... Xn : Subtract X from È : ...
(more)
almost 3 years ago
Answer A: Diagonalized alphabet
Japt `-R`, 16 bytes This feels far too long for the task at hand - what am I missing?! ;Bó v ¬£14îUiX q Test it ;Bó\nv ¬£14îUiX q ;B :Uppercase alphabet ó :Uninterleave \n :Assign to variable U ...
(more)
almost 3 years ago
Answer A: Backspace an array
Japt, 9 bytes ô rÈÔÅÔcY Try it or run all test cases ô rÈÔÅÔcY :Implicit input of array ô :Split on falsey elements (i.e., 0) r :Reduce by È :Passing each Y through the following function, with the first element serving as the st...
(more)
almost 3 years ago
Answer A: Word Set Square
Japt `-R`, 16 15 14 bytes pÔ¬Ëú°EDùEÃÆpÔ Try it pÔ¬Ëú°EDùEÃÆpÔ :Implicit input of string p :Append Ô : Reverse ¬ :Split Ë :Map each D at 0-based index E ú : Right pad ...
(more)
almost 3 years ago
Answer A: Obligatory Quine Challenge
Japt, 9 bytes All credit to ETH on this one. 9îQi"9îQi Test it 9î :Repeat the following to length 9 Q : Quotation mark i"9îQi : Prepend "9îQi" And, for the sake of completeness, the original 10 byte Japt quine, again with all credit to ...
(more)
almost 3 years ago
Answer A: 1, 2, Fizz, 4, Buzz!
Japt `-R`, 27 bytes Lõ@"FiBu"ò úz4 ËpXv°EÑÄìªX Test it Lõ@"FiBu"ò úz4 ËpXv°EÑÄìªX L :100 õ :Range [1,L] @ :Map each X "FiBu" : Literal string ...
(more)
almost 3 years ago
Answer A: Merge two strings
Japt `-h`, 13 12 9 bytes à m+V kbU Try it à m+V kbU :Implicit input of strings U & V à :Combinations of U m :Map +V : Append V k :Filter elements that return falsey (i.e., 0) bU : First 0-based i...
(more)
almost 3 years ago
Answer A: Are they abundant, deficient or perfect?
Japt, 11 bytes Could be 2 bytes shorter if not for a bug in Japt when trying to get the proper divisors of a number. õ üÈgXnXâ x Try it õ üÈgXnXâ x :Implicit input of integer U õ :Range [0,U] ü :Group & sort È :By passin...
(more)
almost 3 years ago
Answer A: Word Count Tool
Japt v2.0a0, 19 18 17 bytes I need more caffeine! Takes input as an array of lines. Output is a reversed array. [Uc¸¬U¬Ucq\s f]ml Try it - includes all test cases, header splits string on newlines for ease of input. footer reverse the output for easier verification. [Uc¸¬U¬Ucq\...
(more)
almost 3 years ago
Answer A: Output 256 in many different ways
Japt, 27 Solutions This started out as a collaboration with Quintec but quickly got very out of hand! Posted with their permission. More solutions to follow. Hopefully! 256 Try it Just the boring, literal `256`. 3^7^73^333 Try it Some bitwise XORing. 4²²...
(more)
almost 3 years ago
Answer A: Evaluate a single variable polynomial equation
JavaScript (Node.js), 33 bytes a=>n=>a.reduce((o,x,y)=>o+xny) Try it online!
(more)
almost 3 years ago
Answer A: Solve Goldbach's Conjecture
Japt, 13 bytes o ï æ@¶XxXej Try it o ï æ@¶XxXej :Implicit input of integer U o :Range [0,U) ï :Cartesian product æ :First pair X that returns true @ :When passed through the following function ...
(more)
almost 3 years ago