« first day (2455 days earlier)      last day (2387 days later) » 

2:04 PM
ok I give up with std::vector
I'm going to go back to int* because it makes more sense to me
 
@Mr.Xcoder I think you should get a mod to unfreeze the chat room then :P
 
@cairdcoinheringaahing Mhm, I'll see.
Anyway up for JHT (can't post that challenge rn)?
 
@user202729 C++ question: how do I return an array from a function without it giving me a -Wreturn-stack-address warning?
 
it can't be a stack variable
because then it becomes UD after the function returns
you need to allocate the array using new or malloc
 
2:16 PM
@HyperNeutrino Yes, use new or std::array or std::vector.
 
huh
that would explain why the output is just a bunch of random numbers after the function returned
 
oh makes so much more sense thanks!
 
I prefer using STL containers, because you don't have to delete it later.
 
oh huh
c++ makes absolutely no sense to me at all lol
 
oh wait what am I doing I am actually dumb lol
 
C++ doesn't have dynamic memory manipulation. (actually it does, std::shared_ptr) so you have to handle them yourself if you use new. Generally I don't like using new.
 
ok
wait question about std::vector: is the memory used by a vector guaranteed to be a whole contiguous segment no matter what?
 
Yes.
But generally you don't need to care about it, use the provided iterators.
 
hm ok
wait but how does that work if it doesn't know its needed size ahead of time?
 
2:28 PM
What "that" works?
 
nvm I realized that since it's compiled it does know its needed size ahead of time
I was just wondering how it knows how much memory to allocate to prevent other things from using the memory in the block that it might eventually need
 
buffer overflow
 
When you allocate it, you own it. You have the syntax new int[/* put size here */] (both in C++ and Java) (that's how vector is implemented)
 
oh ok
but like what if the vector allocates enough memory for say 100 values and then you push 101 values to it
and the 101th block of memory is occupied by something else
 
It allocates a new int[] with size about 200 and copy everything to the new array.
(and of course, delete[] the old one)
 
2:31 PM
ohhh that makes sense now thanks
so does allocating a tiny vector and then expanding it constantly waste a bunch of time then?
 
Amortized constant time per operation.
(that is, push_back n elements takes time O(n), even if some operation may takes very long time)
However if you already know the size you can assign, resize (which affect the content) or reserve (which does not affect the content, but improve running time slightly; may be important in competitive programming)
 
hm ok
halp sums.erase(std::unique(sums.begin(), sums.end()), sums.end()); isn't working
oh nvm
lol halp is just help
but yeah I'm dumb; I put std::sort(sums) after the erase line
wait what that still didn't work
wait nvm it did
I have 3 TIO windows open and all of them look too similar to me lol
nvm I got it now thanks tho :)
now, to figure out why adding 0, 1, 1024 8 times can possibly give 15...
 
Post TIO, again
 
https://tio.run/##jVJdb4IwFH2GX3HjXspAptmLUeCPGLMgVqiDwvrhki3@dnbbCm6TJUsgtLfnnnvOKUXXzYs652XfPwDjRa0PFBLWSiVo3mT@t2Jel61gqvpZPdNCteJHqclVFVeZ70t1WK8dIGFcZVBSJXUjCW4e4ZzXmsoI@5RZF63myu0Ua6gM4NP37hgElbpWcuN77AjEAiFNYWnR3rEVYMiBQQqLDX6SkRp3YRgMBHGnZfWyz4tX4nRs2S5A1gvQWtL/khnYvUap9yhqNDv4vHl0sueoemMIxkEnN@iEgwxHLNkHJQEWxlnevXyD3J52EAJzdBffvvgIqrTgt8wuvm/GNDnjxBJad7zT6Me6KBiHLLuW3LHRgLKMvgC69p3YQ3iCVQSLGHMPYXmFOqOwtS1Y3mF9IsTUcl4THMPHY8sewXJhfEyk2kylOgyLYDW0yVYoYkDxnpbGamSbY8oPJLAguxO5pMSO0Zy9afp3y@/@qT/DIoYLs9Zcoi2Glbhj4xKXM5jhVfT98@oL
 
You can use std::vector<int> values instead of int* values, int valcount.
 
2:41 PM
I guess
yeah I probably should
 
results.push_back(subs[j] + i);? What is i?
 
also I'm dumb
@user202729 yeah i is the index whoops
 
If you don't really need the index I suggest using range-based for loop (C++11 and upper)
 
how do you do that for TIO?
 
However the problem is that only works with std::vector or array that have not decayed into a pointer.
 
2:43 PM
ok
since I have no int* right now it should work (everything is a std::vector<int> now)
@user202729 thanks for the help; I think I got a solution! here :)
it's way less efficient than yours :P
 
I suggest using cmath instead. Is there any particular reason you included that?
 
which, math.h?
 
Yes
 
for pow I think
whoops lunchtime for me thanks for the help, cya!
anyway gtg o/
 
Indeed.
 
3:20 PM
God that was weird. Hyper left, then joined, then left, while wizz joined :P
 
3:40 PM
@cairdcoinheringaahing I didn't really "join" - more that my laptop finally decided to load sufficiently to run Firefox.
 
3
Q: Two First Names

MooseA person has two first names if their last name is also a common first name. You are tasked with determining which full names in a list are two first names. John Smith John Doe Luke Ryan Ryan Johnson Jenna Jackson Tom John Any name that occurs in the first name column is potentially a first na...

 
@NewMainPosts That's a falsehood programmers believe about names.
 
> Billy Dee Williams has done a masterful job in deflecting the fact that he's named William Williams.
 
4:24 PM
Anyone know why, in a C program, an fgets on stdin would cause a later fseek on a different stream to hang forever?
A successful fgets, not one that reads nothing
 
5:14 PM
Does anyone know how (in regex), you can make a character optional iff it is at the end of the line?
 
example?
 
For example, <regex> would match both abc(def and abc(def)ghi
(the ) is optional)
 
abc\(def(\)?$|\)ghi)?
(the question mark at the end is not part of the regex
 
@HyperNeutrino Yep, that works. Thanks!
 
@cairdcoinheringaahing (\)|$)? should do it, I think.
 
5:18 PM
oh yeah true
actually no just (\)|$) without the question mark
 
That's a point. I was being silly - ) or EOF, but optional is wrong.
 
oh wait
wait huh
 
@HyperNeutrino You already told me to wait, what do I do now? :P
 
@cairdcoinheringaahing exec("unwait();"*2)
 
@cairdcoinheringaahing Raise an exception.
 
5:23 PM
@wizzwizz4 raise WaitedTooLongAndIsImpatientError
 
@HyperNeutrino raise InvalidStateForOperation("You already told me to wait, what do I do now? :P").
 
@wizzwizz4 raise UnimplementedError("Operation 'wait' not defined")
 
@HyperNeutrino raise ExceptionException("Unknown Exception ExceptionException").
 
@wizzwizz4 raise self
 
@HyperNeutrino raze to the ground.
 
5:27 PM
lol
raise = !raze :P
RAISE TABLE STUDENTS;
RAISE TABLE; THROW TABLE (AT) STUDENTS; DROP TABLE STUDENTS
 
@HyperNeutrino raise == False?
 
@wizzwizz4 raise SyntaxError
 
raise CalculationError
I've made a mistake that I can't find - care to take a look at it?
 
I have a calculation error near the bottom of this post but I can't work out what I did wrong.
 
5:33 PM
maybe after french lol
which would be in like 1.5-2 hours
(that is, after i get home)
 
CMP: In your opinion, which SE site fits the SE model the best?
 
@cairdcoinheringaahing Stack Overflow.
Wait, no.
Erm... Probably a new beta.
@cairdcoinheringaahing Retrocomputing is the one I have the most experience with, so I'll choose that.
 
PPCG /s
 
mSE /s
Stack Apps fits the SE model even better.
 
Anonymous
@wizzwizz4 I'm hesitant to call the SE overlords experts, especially when it comes to UX & UI
 
5:44 PM
@user202729 nice :)
 
@Mego Are you referring to Stack Apps or my attempt at getting a magic link for Stack Apps?
 
Anonymous
@wizzwizz4 I'm referring to the abomination on top of every SE site
 
@Mego Regarding IPS, I just checked how may answers have "In my opinion" in them. It's too many: 190
 
Anonymous
@cairdcoinheringaahing Ooh, another close reason for the entire site: "Primarily opinion-based"
 
Anonymous
@cairdcoinheringaahing CMP: In your opinion, which SE site fits the SE model the worst?
 
5:46 PM
How many of them are the top/accepted answer?
 
@Mego I'm tempted to say PPCG because it's one of the few not help-sites but probably IPS as well
 
Anonymous
@cairdcoinheringaahing Agreed, though Parenting is a close second :P
 
maybe Parenting as well yeah
 
@HyperNeutrino Remind me how to search for that again
 
5:46 PM
@cairdcoinheringaahing SEDE
 
@Mego I think it's an improvement only for usability on a Kindle Paperwhite.
 
Anonymous
"Our kids are all special snowflakes, so let's try to come up with one-size-fits-all 'solutions' to our problems!"
 
@Mego Although, SO has "60,392 results" for a search of "in my opinion is:a"
 
However, the rest of the site doesn't work on a Kindle Paperwhite (esp. commenting, which means I can't review from it properly).
 
Anonymous
@cairdcoinheringaahing I'd imagine quite a few of those are things like "X and Y both solve the problem. IMO, X is the better solution because A, B, and C reasons."
 
6:01 PM
@wizzwizz4 You didn't do anything wrong, silly! The calculation is giving the overall temperature change per second!
 
CMC: Given a list of integers, check whether there is any contiguous sublist of length at least 2 that contains two consecutive, either ascending or descending numbers.
[1,2,3,4,5] -> True, [1, 3, 6, 7, 2] -> True, [13, 19, 18, 1] -> True, [1, 3, 5] -> False
 
@Mr.Xcoder lambda l:any(abs(x-y)==1 for(x,y)in zip(l,l[1:])) should do it.
 
Jelly: IAe@1
 
@wizzwizz4 lambda l:any(-1<x-y<1for x,y in zip(l,l[1:]))
 
@Mr.Xcoder 1for won't work and neither will for x,y (without parens).
 
6:05 PM
@wizzwizz4 I disagree...
 
@Mr.Xcoder ... This changes everything.
 
I'm pretty sure it will, at least for Python 3.
 
@wizzwizz4 Well but I need abs though... Right
So 48 bytes: lambda l:any(abs(x-y)==1for x,y in zip(l,l[1:]))
 
@HyperNeutrino IA1e
 
Although I'd use lambda l:all(abs(x-y)-1for x,y in zip(l,l[1:]))
 
6:07 PM
@Mr.Xcoder What's the difference between that and what I wrote apart from the for(x,y)in->for x,y in? I can't spot it.
 
@wizzwizz4 The space in ==1 for is removed.
 
@Mr.Xcoder Shouldn't that have a not?
 
@wizzwizz4 It returns reversed values.
 
@DJMcMayhem Dammit I forget that every single time. Nice.
 
6:10 PM
You had specific I/O requirements... mumble.
 
Did I?
 
@Mr.Xcoder No. That was just in your example. I was silly.
 
@ConorO'Brien Nice, is -/ deltas? Like, reduce by subtraction?
 
Although, that 1for trick changes lots of things. That's just for keywords, right?
 
6:11 PM
@Mr.Xcoder wait it is? where is the meta consensus?
 
@wizzwizz4 Yes.
 
@ConorO'Brien That text is blue. Ignore me.
 
@Mr.Xcoder Can we assume that 0 won't be given in the input?
 
@ConorO'Brien I am trying to find it rn
 
@wizzwizz4 no any letter after a number will be treated as a a new thingy
 
6:12 PM
@wizzwizz4 Although it links to Martin's answer
 
however, in python, it doesn't make sense to have an identifier after a number
 
@DJMcMayhem No.
 
@Mr.Xcoder insertion by subtraction, the delta bit is just 2-/"1\]
 
in proton, that can make a difference
 
@ConorO'Brien Oh I see.
 
6:12 PM
@Mr.Xcoder OK. Additionally, does it just have to be truthy falsy, or must we output two distinct values?
 
@HyperNeutrino What about e? :-p
 
@DJMcMayhem Two distinct consistent values.
 
Dang it
Well, ignoring those two requirements, there's an impressively short brain-flak answer: {(([{}()]({})<>)()())<>}<>{{}}([]<>)
 
which is:
2-/"1\]
2    \]   over each 2-sublist of the input list:
   "1     column-wise:
 -/       perform subtraction
 
oh ok it's clearer now
 
6:13 PM
@Mr.Xcoder that's not consensus :P
 
@ConorO'Brien I know :PPP
 
which means I have to amend my J answer
16 bytes: [:+./1=&|2-/"1\]
 
8
Q: What outputs should I allow for decision problems?

xnorI'm looking for opinions on what outputs to allow as the Yes and No outputs on decision-problem challenges. The goal isn't to make a policy, but to help with a decision I often have to make when writing challenges. One standard is Truthy/Falsey, which checks if the output satisfies the languag...

Consensus :P
 
@wizzwizz4 ok fine it's different for eobx :P
actually you can do 2if 3else 4 I think
 
Am I just slow at using computers or is everyone else having faster reaction times than me?
 
6:16 PM
in Proton I think you can do print(2if3else4) upon request for someone
@wizzwizz4 might have to do with internet connection
 
!/.aM.+Q1 (9 bytes!!! In Pyth) returns swapped truthy/falsy values
 
Oh wait Proton uses ?: :P (so print(3?2:4))
 
Or... .Amt.ad.+
 
Downgoat just left.
 
I'm also blind to room animations when I'm not paying attention.
A lot of weird things that don't make sense in Proton still don't error, they just give unexpected results
 
6:18 PM
@HyperNeutrino I can't be blind to room animations unless I'm in another tab.
 
huh ok
 
Anonymous
@Mr.Xcoder Haskell, 40 bytes: f x=elem 1$zipWith((abs.).(-))x$drop 1 x
 
by not paying attention I mean looking at a piece of paper or something :P but I usually forget seeing them about 5 seconds later because I don't pay attention
 
@Mr.Xcoder Brain-flak stupidly twice as long as it needs to be 66 bytes: Try it online!
([]){({}<(([{}()]({})<>)()())<>>[()])}{}{}<>{{}}([]){(<(()<>)>)}{}
 
I think Haskell has the weirdest syntax among the mainstream languages
 
6:19 PM
... It's that other people reply with shorter messages than me! That's why I'm comparatively slower.
Problem solved! :-)
 
@DJMcMayhem Woah well done
 
@Mr.Xcoder One word: APL.
 
Commas between function arguments in Proton are unnecessary so print((+)(1 2)) prints 3 because where each expression ends is unambiguous
 
@wizzwizz4 Does that count as "mainstream"?
 
6:20 PM
@wizzwizz4 I still think Haskell is weirder
 
@cairdcoinheringaahing Yes.
 
@Mr.Xcoder It's actually not that hard
But the algorithm is kinda cool
 
@wizzwizz4 one word: mainstream /s
 
@Mr.Xcoder Define "weird" objectively then we'll talk.
 
Pass.
 
Anonymous
6:21 PM
Actually, 11 bytes: ;pX♀-♂A1@cb
 
contact "bizzare"? :P
 
@Mr.Xcoder Aw. I wanted to know whether I was weird... :-)
Poll: Do I use ... too much?
 
@wizzwizz4 I can answer that :P You're a member of PPCG, so yes, you're weird :P
9
 
Anonymous
@wizzwizz4 Don't be a troll
 
6:22 PM
@Mego Ok. I just wanted to know the metric that was being used - it wasn't intentional trolling.
 
@Mr.Xcoder 6 bytes shorter: ([]){({}<(([{}()]({})<>)()())<>>[()])}{}<>{{}}([])({<>()}{})
 
Not like I understand what that mess of parenthesis means No offense Brain-flak!
 
:|
@JaneS what is particularly troublesome is it merely repeats prior answer that was posted 5 hours before. I could understand a repetition if it was somehow better presented or explained but this doesn't look like the case here. OP seems to completely ignore guidance to Back It Up and Don't Repeat Othersgnat yesterday
 
@Mr.Xcoder (Lisp lol)
 
101 rep user answers: gnat complains that he "ignores" the meta post
 
Anonymous
@H.PWiz Ooh nice, I was trying to find a way to write it pointfree
 
@Christopher2EZ4RTZ To be fair, that is standard site policy on every Q&A site on the network.
 
@Christopher2EZ4RTZ I have to say, I agree with him. Not all sites have the same attitude to duplicate answers as us, although the fact that the answer is deleted doesn't help. You could just elaborate on the answer like they suggested
 
for each in input:
    push_to_alternate_stack(
        push_to_alternate_stack(negative(pop() + 1) + push(pop())
        + 2
    )

while peek() != 0:
    pop()

push(height of alternate stack)

push(

    # Peek == (height of alternate stack)
    while peek() != 0:
        1
        change_stacks
)
 
@wizzwizz4 Good idea ill back up a removed post :P
 
6:27 PM
@Mr.Xcoder ^^
 
Wow
 
Anonymous
That reminds me - Workplace.SE is another primarily-opinion-based site
 
My spelling is horrible
 
@Mego Lets all get high rep and VTC everything
 
@Mego Most SE sites which have questions along the lines of "How should I do this" are like that
 
6:28 PM
@Mr.Xcoder I'm not sure if I made it more or less clear for you :P
 
@Christopher2EZ4RTZ I don't understand why that comment would have been posted if the situation is how I understand it from your message.
 
Anonymous
@Christopher2EZ4RTZ That would require posting on sites that I loathe
 
@Mego Good point
 
@DJMcMayhem Both.
 
Sweet
 
Anonymous
6:29 PM
I loathe them because they get a free pass for not following the SE model, but we can't even get a friggin design
 
@wizzwizz4 By the time I see the message the answer linked was removed and I cannot see it. So i am a dupe of a removed answer
 
@Mr.Xcoder The best way to sum up basically all golfing languages :P
 
It's kinda like 0 in [b-a+1, b-a-1, for a,b in input()]
 
@Mego <insert link to userscript here> This will take your mind off it :P
 
@Christopher2EZ4RTZ If the answer wasn't deleted when you posted your answer, gnat was right. If not, gnat evidently made a mistake, barring circumstances I am not privy to.
 
Anonymous
6:30 PM
@cairdcoinheringaahing That doesn't change site-wide privilege requirements to help with the epidemic of new users gaining privileges quickly before they understand the relevant policies that will help them use said privileges correctly (like CVs)
 
@wizzwizz4 The answer was different enough to not be a dupe. I also am coming from the dupe answers are ok SE
 
@Mr.Xcoder Husk, 7 bytes ±#1Ẋoa-: Ẋoa- - Get the absolute deltas, #1 - Count the 1s, ± - Sign.
 
@Mr.Xcoder Wait, absolute deltas is 3 bytes in Husk? Why?
 
@cairdcoinheringaahing 4 bytes
 
@Mr.Xcoder Oh yeah. That makes it even worse
 
6:33 PM
@Mr.Xcoder ±€1Ẋ≠
 
@Christopher2EZ4RTZ Ok. I'm not sure why I'm still talking about this! :-)
 
@Mr.Xcoder Feel free to ping me if you have any brian-flak questions :)
 
Husk does not have any built-in for deltas: - Map over pairs of adjacent values. - - Subtraction. a - absolute value, o - Function composition (to pair a with -).
 
> brian-flak
ffs
 
@DJMcMayhem Will (probably not) do.
 
6:34 PM
In Husk is absolute difference.
 
@DJMcMayhem Don't you dare edit that :P
 
@H.PWiz How does Ẋ≠?... Wh... Wow
 
@Mr.Xcoder d|1=a
 
> ≠ neq neq (Concrete x) -> x -> x -> TNum Not equal
 
@Mr.Xcoder That'd be 5 bytes in Levant if I ever finished it :P
 
6:35 PM
@H.PWiz Not documented?
@LuisMendo MATL is my guess.
 
And the link gives it away :-P
 
@LuisMendo No, I actually have Downgoat's userscript which makes every piece of code render with colors, and the links are not blue so I didn't notice it had a link attached to it.
 
@Mr.Xcoder No, but it tends to return some kind of information to describe how unequal things are.
 
@H.PWiz So just underdocumented.
 
@Mr.Xcoder Ah, good guess then :-D
 
6:50 PM
@Mr.Xcoder Perhaps the userscript should be tweaked to add underlines to code in <a>s.
 
Yes, Husk is missing some documentation, especially for combinators
 
Wow a reply in a reply :P
 
16 secs ago, by Mr. Xcoder
Wow a reply in a reply :P
 
@Mr.Xcoder It's not very hard to guess that Luis answered a CMC in MATL :P
 
Personally I think this is better, as you can nest it more easily.
 
6:51 PM
@DJMcMayhem Ik, hence the immediate guess
 
@Mr.Xcoder Might I suggest adding some transparency to that background of yours?
 
@wizzwizz4 Huh?
 
@Mr.Xcoder I meant the profile picture.
I need to draw better dependency graphs before trying to turn thoughts into sentences in future.
 
@wizzwizz4 Oh I see. Maybe in the future
@wizzwizz4 Btw congrats on 6k precisely on Retrocomputing!
 
I have some questions that I should really accept answers to but am waiting for consensus on before doing so - 5998 reputation is the perfect opportunity.
@Mr.Xcoder I'm glad that you noticed.
 
7:00 PM
@DJMcMayhem :-D
 
7:44 PM
@DJMcMayhem What, you're saying that some people only answer in one language?
 
(cough leaky) (:P)
 
Leaky hasn't been here for a while has he?
 
I don't think so... I haven't seen him on in a bit
 
Yeah, just check. He took a 4 day break from 14th to 18th
 
hm ok
where did you find that
 
7:49 PM
He's currently chatting in the Maths room though
 
hm ok
 
@HyperNeutrino Deduction. He posts at least once a day and had no posts on the 14, 15, 16 or 17th
 
hm ok :P
I didn't check his activity log lol
 
what the lol
lol a considerable portion of all hm oks is just me lol: chat.stackexchange.com/search?q=hm+ok&user=&room=240
 
7:51 PM
30/115
 
@cairdcoinheringaahing I keep thinking the mini version of your avatar is a Mickey Mouse face with some weird white splotch
 
at least recently a lot are mine, before I was active most were Riker or Downgoat I think
 
@Mr.Xcoder Dyalog APL, 8 bytes: 1∊∘|2-/⊢
 
@AdmBorkBork ಠ_ಠ My dog is greatly offended at that /s
Although, now you mention it, I can't unsee it :P
 
wait that's a quick?
huh I didn't even know that was a thing lol
 
7:56 PM
@HyperNeutrino It's the opposite of a slow
 
@HyperNeutrino A quick is a thing that is quick.
Nouning the adjective.
 
@HyperNeutrino An adverb.
 
@HyperNeutrino Yeah, it can be helpful sometimes (only in JHT :P)
 
facepalm. I answered a question on SO, and the OP replies It's not working, see my edit. In their edit, they posted the original (unchanged) code without trying my solution, complaining that it "still" doesn't work...
 
@DJMcMayhem That's SO for you :P
 

« first day (2455 days earlier)      last day (2387 days later) »