Activity for Hakerh400
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: Stairs? Stairs! Stairs. [Haskell], 78 bytes (!)0.(2) i!n|i<n=(drop 3$(n-i)#' '++"/"++i#'#'):(i+2)!n|0<1=[] (#)=replicate Try it online! (more) |
— | about 3 years ago |
Edit | Post #283992 |
Post edited: |
— | about 3 years ago |
Edit | Post #283992 | Initial revision | — | about 3 years ago |
Answer | — |
A: When The Ternary Is Balance [Haskell], 78 77 bytes (g[0]!) g a=mapM(\->[-1..1])a++g(0:a) (a:b)!c|foldl1((+).(3))a==c=a|0<1=b!c Try it online! (more) |
— | about 3 years ago |
Edit | Post #283922 | Initial revision | — | about 3 years ago |
Answer | — |
A: Generalized Sort [Haskell], 29 bytes import Data.List foldr sortBy Try it online! (more) |
— | about 3 years ago |
Comment | Post #283882 |
Does the coefficient of the highest power of x need to be 1? Can we multiply the entire polynomial by a non-zero constant? (more) |
— | about 3 years ago |
Comment | Post #283865 |
Test cases should not be a replacement for the challenge specification. The meaning of "several variants of writing the number in English" should be precisely defined. Can we mix different variants in the same answer and/or in the same output? Where can exactly "and" appear (is "twenty and one" a val... (more) |
— | about 3 years ago |
Edit | Post #283863 | Initial revision | — | about 3 years ago |
Answer | — |
A: Make my value binary [Haskell], 29 bytes import Text.Printf printf"%b" Try it online! Without builtins: [Haskell], 37 bytes f n|n<2=[n]|0<1=f(div n 2)++[rem n 2] Try it online! (more) |
— | about 3 years ago |
Edit | Post #283819 |
Post edited: |
— | about 3 years ago |
Edit | Post #283819 | Initial revision | — | about 3 years ago |
Answer | — |
A: Compute the determinant [Haskell], 75 73 bytes -2 bytes thanks to @user f[]=1 f(x:y)=foldr(-)0$zipWith(\i->(f[take i r++drop(i+1)r|r<-y]))[0..]x Try it online! (more) |
— | about 3 years ago |
Edit | Post #283740 | Initial revision | — | about 3 years ago |
Answer | — |
A: Multiply two strings [Haskell], 25 bytes f a=(>>= \c->map(min c)a) Try it online! (more) |
— | about 3 years ago |
Comment | Post #283379 |
[An example of adding 3 arguments to a Haskell program](https://tio.run/##bY7BasMwDIbvfgrRixNYAttuCwkM1vugu5UehKOmprbVyU62UPrsmVN2GjtJ/Pr0SSeMZ3JuWay/sCTYzTGRr7dhssLBU0jKow3QwkDpVYYIXdfCRWweqGsF75h5SCeCIzvHXzYMkPgevNH0wewiGA6RHb0ohaughb3OzaN@gLU@/dZnfWgUOfIZ6NmM6@36cySZdzk1iaXQ@x4TVgE9tZvVtTnosrlba6G... (more) |
— | over 3 years ago |
Comment | Post #283379 |
By opening DevTools console, you can easily figure out which HTML elements on TIO are responsible for adding new arguments and you can write a script to do that automatically. (more) |
— | over 3 years ago |
Comment | Post #283337 |
The second testcase should be `-3 * 2` instead of `-4 * 2`, and the 6th testcase should be `(1 - 1) / 1 (1 - 1)` instead of `1 / 1 (1 - 1)` (and in the standard algebra it's indeterminate, not undefined). (more) |
— | over 3 years ago |
Comment | Post #283337 |
So you're using a non-standard model of PEMDAS (see [this](https://math.berkeley.edu/~gbergman/misc/numbers/ord_ops.html))? You need to explicitly mention that in the post, and add testcase `(++++++++******)//((+++***)+++)`. Also, is division by zero undefined or 0? It can't be both. Either remove it... (more) |
— | over 3 years ago |
Comment | Post #283337 |
What are the outputs of `()`, `+/(+-)` and `(+-)/(+-)`? (more) |
— | over 3 years ago |
Edit | Post #283320 | Initial revision | — | over 3 years ago |
Answer | — |
A: Are All Elements Equal? [brainfuck], 40 bytes Outputs `ÿ` if all elements are equal, and `\x00` byte otherwise. ->,>,[[->+]>>[->]>[->]>>][[-]-.+] Try it online! (more) |
— | over 3 years ago |
Edit | Post #283307 | Initial revision | — | over 3 years ago |
Answer | — |
A: Are All Elements Equal? [Haskell], 16 bytes f(a:b)=all(==a)b Try it online! (more) |
— | over 3 years ago |
Comment | Post #283288 |
Your examples may not include subtraction and division, as the challenge explicitly states that the function must be commutative and associative. (more) |
— | over 3 years ago |
Comment | Post #283288 |
In case you didn't know, C can take a function as an argument: [59 bytes](https://tio.run/##fc7RCoIwFAbge5/iUAQ7NiMDr5Y@SQRnm5agM5aCID77mlg3lV4MDvv4z/lVpCoyN7ctjao6ncP52eqyOdwzp0TBStMCcRZKnEbuH@JQNJaplARlsUCVShZFxBUKm7edNaDE6EhrRhwkDvD@JdiDFDAGdVf9UDhT7xd/03WmoKbSsB6HAOBhfY@CbXb6YjYcChZzAH8RUfzTZFWnr... (more) |
— | over 3 years ago |
Comment | Post #283268 |
"... you will not be able to examine it to see how it works" - that's an uncomputable requirement. Determining whether a program examines the given function (assuming it's able to do so) is equivalent to solving the halting problem, especially in languages that need to parse a function from a string.... (more) |
— | over 3 years ago |
Edit | Post #283271 | Initial revision | — | over 3 years ago |
Answer | — |
A: Reduce over the range [1..n] [Haskell], 18 bytes n!g=foldl1 g[1..n] Try it online! (more) |
— | over 3 years ago |
Edit | Post #283174 | Initial revision | — | over 3 years ago |
Answer | — |
A: Guess the language! (Cops' Thread) ???, 268 bytes !(115,114,101,98,98,111,82,32,100,110,97,32,115,112,111,67)0|2.(0,0). 1|0|5.#.(0,1).(0,2)0|4.#.(2,0,(0,5),(0,2)).(0,1)-{0|5.#.(0,0 ,(0,1))(0,0,(0,1)).#.(0,(0,0,2))(0,(0,0,2)).#.(0,0,5)0|0|1+0|2 .1|0|5.#.(0,1).(0,2)0|4.#.(2,0,(0,5),(0,2)).(0,1)} New lines added ... (more) |
— | over 3 years ago |
Edit | Post #283130 |
Post edited: |
— | over 3 years ago |
Edit | Post #283130 |
Post edited: |
— | over 3 years ago |
Edit | Post #283109 |
Post edited: |
— | over 3 years ago |
Comment | Post #283146 |
`Array(99).fill()` ---> `[...Array(99)]`. Besides that, you also don't need parentheses after `join` (more) |
— | over 3 years ago |
Edit | Post #283145 |
Post edited: |
— | over 3 years ago |
Edit | Post #283145 | Initial revision | — | over 3 years ago |
Answer | — |
A: 99 Shortened Bottles of Beer [Haskell], 221 215 bytes f=a 99 (#)=(++) a n=d n#", "#c".\n"n#b(n-1) b 0="Go to the store and buy some more, "#d 99#"." b n="Take one down and pass it around, "#d n#".\n\n"#a n c m n=show n#" bottle"#['s'|n>1]#" of beer"#m d=c" on the wall" Try it online! ... (more) |
— | over 3 years ago |
Comment | Post #283130 |
Then it would literally be a plagiarism of https://codegolf.stackexchange.com/a/125314 (more) |
— | over 3 years ago |
Edit | Post #283130 | Initial revision | — | over 3 years ago |
Answer | — |
A: It's Hip to be Square [Haskell], 24 bytes Probably the optimal solution. Credits go to nimi from PPCG. f n=elem n$map(^2)[0..n] Try it online! My original solution, 25 bytes f a=any((==a).(^2))[0..a] Try it online! (more) |
— | over 3 years ago |
Comment | Post #283108 |
"Given a list of positive integers" - 0 is not a positive integer (second test case). (more) |
— | over 3 years ago |
Comment | Post #283107 |
[Cracked](https://codegolf.codidact.com/posts/283109#answer-283109) (more) |
— | over 3 years ago |
Edit | Post #283109 | Initial revision | — | over 3 years ago |
Answer | — |
A: Guess the language! (Robbers' Thread) Cracks Shaggy's answer Let the cops be "Cops" The conjunction is " and " The robbers are "Robbers" Say the cops with the conjunction with the robbers It can be one of: FALSE Phooey Rotor The Shaggy's intended solution turns out to be Rockstar (found by @Razet... (more) |
— | over 3 years ago |
Edit | Post #283019 | Initial revision | — | over 3 years ago |
Answer | — |
A: Gamer Meme Creator [Haskell], 116 bytes a#b=a!b:a++[a!"BOTTOM TEXT"] a!b=replicate(div(m a-k b)2)' '++b m=foldr1 max.map k k=length.dropWhile(==' ').reverse Try it online! (more) |
— | over 3 years ago |
Edit | Post #282508 | Initial revision | — | over 3 years ago |
Answer | — |
A: A number adder, not a death adder [Haskell], 64 bytes main=do a>=print.("++a++"+).read" Try it online! Run both programs (more) |
— | over 3 years ago |
Comment | Post #282499 |
[71 bytes](https://tio.run/##dZBNboMwEIX3nMKLKDLVBPHXJlFkbtATWKNmnAAxIjgCqxvK2akNVZtNvXqe977Rsxv6pOHS64fddeZazpWYOYEKRaGiOz24FoUkqRFINojC6UYo@U72FvXUXc2dhy8qasuutrevGH1OI4bbLc0X0w2W2XKwAxNMBswdKRNIIYMcXuEN9ghMxvA0cgv@z6Xu@pQ4Zs5KFjyOIU9gf4AsgSyH9Afw/AGOiAGegqAyPeO@DjPVWitk47KrLS2TBEyhK@qd0@@YPkyva91R... (more) |
— | over 3 years ago |