12:00 AM
@RedwolfPrograms Go ahead, it doesn't matter :P
Welcome to the first Monthly Mini Golf! During this event, we'll post 18 CMCs (Chat Mini Challenges) for you all to solve. The first 5 will be posted at the start, and additional ones will be added every 5 to 10 minutes. If you have any questions, don't be afraid to ask. Good luck!
CMC: Given three points in the plane, determine if they are on the same line
CMC: Take an array of numbers. Take the sum, but where every second item is negated.
CMC: Subsequences, going out from the center (`'ABCD'` -> `['BC', 'ABCD']`, `'ABCDE'` -> `['C', 'BCD', 'ABCDE']`)
@RedwolfPrograms vtc as dupe
CMC: Given a string, generate all permutations of all prefixes of the input.
@lyxal Internet lol
CMC: Cartesian square with no cartesian product/power/square built-ins
@MatthewDaniels Done: 20 messages moved to Indonesian Gambling Spam
12:01 AM
@RedwolfPrograms Scala: `_.inits.map(_.permutations)`
@RedwolfPrograms Vyxal, `-s`, 3 bytes: `⁽Nẇ`
@cairdcoinheringaahing can't be done for `-1<=n<=2`; `x=abs(n)` works for all other integers
@RedwolfPrograms Scala: `x=>for(a<-x;b<-x)yield a->b`
@RedwolfPrograms Haskell: `foldr1(-)`
12:03 AM
@Neil Shame :/
@RedwolfPrograms APL, `-/` (stolen from Delfad0r's)
@RedwolfPrograms Vyxal, 11 bytes: `(x|?(←x n",`
@RedwolfPrograms JS, 39 bytes: `n=>(t=i=0,n.map(x=>t+=x*(++i%2*2-1)),t)`
@cairdcoinheringaahing you can post your "output an integer `x` such that `[n+x, n-x, n×x, n÷x, n*x]` are all unique integers" one now
@RedwolfPrograms Neil already "cracked" that one :P
@RedwolfPrograms Retina 0.8.2, 15 bytes
12:05 AM
in MMG Drafts, 2 hours ago, by Redwolf Programs
Draft: Given an integer `n`, output an integer `x` such that `[n+x, n-x, n×x, n÷x, n*x]` are all unique integers (`*` is power)
@RedwolfPrograms Jelly, 4 bytes. Kinda cheaty :P
Just found out that nil is not equal to nil in Pip. What is this nonsense :(
@RedwolfPrograms can this be a matrix of pairs or must it be a flat list of size N^2
Either's fine
This is a CMC :p
@RedwolfPrograms Haskell: `f x=(,)<\$>x<*>x`
@RedwolfPrograms Jelly, 3bytes
12:08 AM
aight. in that case, yuno with 4 bytes, `ドゥマメ、` (`ドゥ` is encoded as 1 byte BTW)
@RedwolfPrograms Can it be a 3d list?
Sure
@RedwolfPrograms Jelly, 2 bytes `,þ`
@RedwolfPrograms Vyxal, 3 bytes
TIO doesn't have `.flat` >:|
12:11 AM
@RedwolfPrograms Jelly, 6 bytes. Outputs a trailing newline
In other news, I'm an idiot
@RedwolfPrograms Jelly, 4 bytes
@RedwolfPrograms Js: x=>[...Array(s=(x.length+1)/2|0).keys()].map(n=>x.slice(s-n-1,s+n+1))
@cairdcoinheringaahing You're not an idiot, you're caird coinheringaahing.
@RedwolfPrograms Haskell: `f(x:y@(_:_:_))=f(init y)++[x:y];f e=[e]`
@RedwolfPrograms Pip, 11 bytes: `PMa@<_M\,#a`
@user If that weren't so motivational, I'd kick you :P
12:13 AM
@RedwolfPrograms JS, 65 bytes: `d=>[...d].fill(d).flat().map((_,i)=>[d[i%(l=d.length)],d[i/l|0]])`
@RedwolfPrograms Next lot now?
CMC: Collapse all identical characters
CMC: Given a multidimensional array, return how many dimensions it has
@RedwolfPrograms sed -E, `:;s/(.)\1/\1/;t`
@cairdcoinheringaahing I did partially mean it in a motivational way - you're not an idiot, at least on CGCC
Takes input as a string, since Haskell does not support nested lists
12:14 AM
@RedwolfPrograms Jelly, 4 bytes
@user You do seem to be an idiot in real life, though, since you're still awake :P
@user Yeah, that tracks :P
@RedwolfPrograms JS, 31 bytes: `s=>s.replace(/(.)\1*/g,r=>r[0])`
@hyper-neutrino Also 4 bytes
@RedwolfPrograms APL: `⍴` :P (Wezl pointed out it's really `≢⍴`)
12:15 AM
@user Fails for `Heeeellooooooo, WWWWWoorrlllldd!!!!`
Should output `Helo, World!`
@user isn't that match shape not shape?
Oh right
@Wezl ? I'm not sure what match shape is
@RedwolfPrograms tinylisp, 44 bytes: `(d f(q((A)(i(e(type A)(q List))(a(f(h A))1)0`
@user ≢⍴
@Wezl Oh right, I didn't read the CMC too closely :|
12:17 AM
@RedwolfPrograms JS, 21: `f=d=>d[0]?f(d[0])+1:0`
@RedwolfPrograms vyxal, 3 bytes
@RedwolfPrograms would `ŒḊ` be valid? jelly
@user You can post the S combinator one whenever you're ready
Redwolf is outgolfing me :p
@hyper-neutrino probably would
12:17 AM
pog
in MMG Drafts, 40 mins ago, by Redwolf Programs
Draft: Shortest S combinator: Given a binary function x, a unary function y, and a value z, output `x(z)(y(z))`, or `x(z, y(z))`
The clockwise vs. anti-clockwise one is good to post now too
@user Js (x,y,z)=>x(z)(y(z))
Ninja'd :p
@user Scala: `y=>z=>_(z)(y(z))`, only marginally less trivial than JS
12:19 AM
@ngn ^^^^
@user Where does _ come from
@user `s`, unlambda, one byte
@Ausername It basically turns the function into `y=>z=>x=>x(z)(y(z))`
@RedwolfPrograms should i post it?
wouldn't `x(z,y(z))` be shorter
12:20 AM
@Wezl Very funny.
@ngn Sure, go ahead
or is that not allowed if your language supports currying
@user Oh so language quirk
@hyper-neutrino It's not in the spirit of SKI
fair enough
12:21 AM
@Ausername Well, feature, but yeah
@user tinylisp, 18 bytes: `(q((x y z)(x z(y z`
@hyper-neutrino I mean, you can do it if you want, I just preferred it with currying
53 mins ago, by ngn
Draft: given three points in the plane (not all on the same line) determine if they describe a circle in a clockwise or anticlockwise direction using any two distinct return values
@user Jelly, 2 bytes
ninja'd >:-(
12:21 AM
That's going to be a tough one
i got the 2,1 for dyad and monad confused, lol
@user `{x[z;y z]}` in K
@Wezl `{x[z]y z}` (assuming `x` is dyadic)
interesting, did not know...
Fun fact: you can find out what deleted messages said if you have their reply id (which you can get if someone has replied to the message) by going to `https://chat.stackexchange.com/messages/{id}/history`
12:23 AM
steals for new language
Resume CMCing :P
@Wezl passing fewer args than needed causes currying
Circle is `x^2+y^2=r^2` right?
@cairdcoinheringaahing That's...not good
12:24 AM
@ngn oh right, knew that, just needed smart
2
Just realised I can get gold badge noow, hold on
@Wezl old trick. not mine.
@user That's assuming mods haven't purged the history. Otherwise, deleted chats are still supposed to be available, but not easily
Like deleted answers, but a lot harder
wait, you can?
doesn't work when i try in incognito
Might need 10k+ network wide
12:25 AM
ah
welp. looks like i need to be more aggressive with purging content
@ngn I think `_€ZÆm\$æA/€ṢƑ` works
(jelly)
Anyone with <10k network wide, try going here to test it (real link)
Python 2: lambda a,b,c:((b-a)/(c-a)).imag>0
Although I'm not sure if I understood this challenge correctly.
Takes input as complex numbers
WOOHOO FIRST GOLD BADGE!!!
@cairdcoinheringaahing I just saw god of meme
@hyper-neutrino how does it work?
12:27 AM
@ngn The points are all part of the circle's outer edge right?
@cairdcoinheringaahing 404
@RedwolfPrograms yes, they lie on and determine its circumference
Ok, so it's 10k+
(Sorry for kinda derailing the CMCs)
@ngn the clockwiseness is preserved if you compare them to any point inside the circle, and the average should always be inside the circle, I think. so i take the difference to the average, then arctan each, then check if it's sorted
@Wezl Appending matrices is good to post now
12:28 AM
@cairdcoinheringaahing Doesn't work for me, and I have 10k+ network-wide, so I guess it's 10k+ on a specific site?
<10k votes userscript is OP
@user It might even be RO specific then
@hyper-neutrino Oh that's smart
@Wezl ?
4 hours ago, by Wezl
Draft: Append two matrices `[[0,1],[4,5]], [[2,3],[6,7]] => [[0,1,2,3],[4,5,6,7]]`
12:28 AM
@cairdcoinheringaahing That makes more sense
I'm over here solving super complicated equation things
When I could just be hyper-neutrino
@Wezl `;"` I think
@Wezl Haskell: `zipWith(++)` (I think, haven't tested it)
haven't tested or opened tio even
@hyper-neutrino hm.. i'm not sure that's 100% correct
12:29 AM
@hyper-neutrino Yep
@user Ninja'd :)
@user :O so you're the one who's ninjing me
@Delfad0r and you too >:/
@Wezl python, `lambda x,y:[a+b for a,b in zip(x,y)]`
@Wezl Mwahaha
That moment when you won't be able to CMC for half an hour because road travel
o/ for now
12:30 AM
@Wezl JS, 34: `a=>b=>a.map((d,i)=>d.concat(b[i]))`
@lyxal o/
@Wezl APL, 1 byte: `,`
@Bubbler Ninja'd :P
@hyper-neutrino is offended
@RedwolfPrograms I think this is correct for collinear points in Pip, 14 bytes: `{\$=Y\$AT_-BMPg}`
@RedwolfPrograms Yeah, TNB's been in timeout before
12:31 AM
@user tbf I was testing it when you ninja'd me
@cairdcoinheringaahing You're good to post the cartesian to polar now
@hyper-neutrino what you should really check is the parity of the sorting permutation. but there's a simpler way.
in MMG Drafts, 3 hours ago, by Redwolf Programs
Draft: Given a Cartesian coordinate point, output its polar form
@RedwolfPrograms Python 2: lambda a,b,c:((b-a)/(c-a)).imag==0 (actually one more byte than the ccw circle one ^^)
@Wezl Racket, maybe something like `(<unicode lambda symbol>(a b)(map cons a b)`?
12:33 AM
@ user `(map\$append)` in unreleased-unfinished haskell-lisp thingy, and `...(map append...` in lisps
@Wezl yuno, 2 bytes: `ヴェタ` (`ヴェ` is one byte) - language feature postdates challenge
hmmmmmm :P
@ngn hint: sgn(det([[x0,x1,x2],[y0,y1,y2],[1,1,1]]))
@hyper-neutrino VTD for loophole violation :P
@ngn wdym by parity?
@Bubbler shhhhhhhhhhhhhhhhhhhhhhhhh
12:34 AM
@cairdcoinheringaahing JS, boring 39 bytes: `x=>y=>[Math.hypot(y,x),Math.atan2(y,x)]`
@ngn can you confirm that this is the correct interpretation of the circle challenge?
@hyper-neutrino lol that's interesting
does jelly have neither a bultin for pol/rec conversion or hypot
Don't think so
12:35 AM
Anyone going to be offering bounties on this MMG?
oh right. i'm dumb
I'll offer +100 to first, or second if someone else volunteers for first
First what?
@RedwolfPrograms okay anyone want their question to act as a proxy :P
Although actually determining what counts as first is the tricky part lol
12:37 AM
also yes, i am using this as an opportunity to pick up new language features to implement. yes that is loophole violation more or less :P
Maybe no bounty :p
@user We can do the interleaving one now
@RedwolfPrograms `transpose|flatten`, takes input as an array of lists, Jq (also insert corresponding Jelly 2 byter here)
@cairdcoinheringaahing Pip, 12 bytes: `PRT\$+g*gbATa`
TBH I don't think we need a bounty. If we have this as a regular thing, we can point to it as a place for trivial challenges that would be better off not on main, and we can use these as an activity booster (not that we need it but ¯\_(ツ)_/¯)
Agreed I guess
I'll post for user since I think they said they were getting dinner
4 hours ago, by user
Draft: Interleave n lists (too dupe-y?)
Not sure if it's guaranteed they'll be the same length
12:39 AM
Although if people want to award bounties for good answers to these, I'm absolutely not opposed to that :P
@RedwolfPrograms Jelly, one byte
@cairdcoinheringaahing J, 9 bytes: `|,r.inv@*`
JS, 34: `l=>l[0].flatMap(i=>l.map(l=>l[i]))`
@RedwolfPrograms finally implemented in yuno (so technically loophole violation) as `ッパマッペ` (which is 3 bytes)
@RedwolfPrograms jelly: `Z` I think (edit: taking a list of lists)
@Wezl `ż`
12:40 AM
that only works on two
you'd need `ż/` or something like that, no?
Oh right
`Z` works if you take input as a list of lists
if it's supposed to interleave a list of lists into a flatlist then `ZF` but if a list of cols is acceptable then `Z` is correct
@cairdcoinheringaahing J built-in, 2 bytes: `*.`
@RedwolfPrograms Given list of lists, 3 bytes in Pip: `WV_`
12:42 AM
This is actually a really good event for someone planning a language :p
@Wezl ...I forgot about that :P
@DLosc Given multiple lists as arguments, 5 bytes: `{WVg}`
@RedwolfPrograms `ジ` in yuno (postdates)
@Delfad0r intuitively, it appears so. with ..`-a` you translate to one of the vertices of the triangle, with division you subtract the headings of the two sides, and the result's imaginary component tells you which was to the left and which to the right
1 hour ago, by user
Draft: Replace "keyboard" with "leopard" on a webpage or in a string (xkcd)
12:43 AM
@RedwolfPrograms yes, i am shamelessly creating built-ins to solve most of these as we speak :P because i only am using like 10% of my codepage right now
Hehe, I have -8 notifications on Codidact
@RedwolfPrograms I love that xkcd =D
JS, obvious: `s=>s.replace(/keyboard/g,"leopard")`
@RedwolfPrograms python, `lambda x:x.replace("keyboard","leopard")` (much creative, very wow)
This one's more of a joke I think, not much golfing potential :p
12:44 AM
@cairdcoinheringaahing grins so broadly it overflows, corrupts australia, and proves HQ9+'s turing completeness
@RedwolfPrograms Case sensitive, though?
@RedwolfPrograms Dyalog APL, 21: `'keyboard'⎕R'leopard'`
I'm going to try doing it in a way that preserves the capitalization :p
Using lookahead to factor out `ard` happens to take one more byte :P
@RedwolfPrograms wow this is just a contest comparing regex boilerplate (which python loses of course)
12:45 AM
@RedwolfPrograms Js: k=>[...Array(Math.max(...k.map(l => l.length))).keys()].map(x=>k.map(m=>m[x]&&t.push(m[x])),t=[])&&t (takes array oof arrays)
@Ausername Why not just `l=>l[0].flatMap(i=>l.map(l=>l[i]))` :p
@RedwolfPrograms Shouldn't it be `flatMap((_,i)=>`?
Oh, yes it should
@RedwolfPrograms Lol
That is some pretty good golfing though, even if the approach wasn't the shortest :p
Actually yours works with different sizes arrays unlike mine
12:49 AM
JS array methods are OP, except when it's not
@Wezl Well in that case, Retina 16 bytes ;)
`f=l=>[...l].sort((a,b)=>b.length-a.length)[0].flatMap((_,i)=>l.map(l=>l[i])).filter(x=>x!=[][0])` works but is probably longer than necessary
lookahead still takes +1 in retina ;-;
It exactly ties with doing it using `Array` and `Math.max` lol
@RedwolfPrograms We'll see.
12:53 AM
I think having themes is a really great idea, opinions on caird's suggestion?
theme:
@lyxal You're good to post your `you're not <x>` one now
i think themes would be cool. maybe we can put them as answers under the meta post
Doesn't look like lyxal's here atm
12:55 AM
2 hours ago, by lyxal
Draft: `I'm <x>` -> `You're not <x>, you're <y>`
@RedwolfPrograms `k=>[...Array(Math.max(...k.map(l=>l.length)))].map((_,x)=>k.map(m=>m[x]&&t.push(m[x])),t=[])&&t` saves a few bytes
Nice!
25 mins ago, by lyxal
That moment when you won't be able to CMC for half an hour because road travel
@RedwolfPrograms Is `y` a second input?
12:55 AM
Presumably
Nah, `y` should be your username
is input exactly I'm <x> or do we need to find it and if so how far should we match
vtc as unclear xd
@cairdcoinheringaahing must suck for you :P (or maybe not, if you use jelly's compression of your name lmao)
I'll take over as lyxal (69 funny number, rickroll haha frick): Given a string in the form `I'm <x>` output `You're not <x>, you're <y>`, where `y` is your username. `x` will contain any ASCII charactrs
I do a great lyxal impression, no? :P
JS, 49: `t=>y=>`You're not\${t.match(/ .+/)[0]}, you're `+y`
`ṫ5“You're not “, you're ”j“hyper-neutrino` in jelly, probably compressable
12:59 AM
@RedwolfPrograms Vim, 28 bytes: `c3lYou're not<esc>Ji, you're`
@Redwolf That was a bit more interesting to golf than I expected
Imaginary brownie points if your language allows to reuse `You're` and `you're`