« first day (2379 days earlier)      last day (2463 days later) » 

5:11 AM
this is not a spiral
 
@orlp this is very large onebox
 
5:38 AM
CMC: given a polynomial (represented by its coefficients) p, return p(p(x)) (or its coefficients)
 
Can I take a polynomial as an expression, eg. (2*x)^2+x
 
@ATaco don't use mathematica
 
Never intended to.
 
then why would you
 
Because I have a Lua library for this sort of thing.
 
5:41 AM
:o show me
 
equa.lua is a library designed around expressions.
 
@LeakyNun APL, 4 bytes: ⊥⍨⍣2 (takes coefficients as left argument and x as right argument) Try it online!
 
require("equa")
p = x^2+x

print(p(p))
 
@Adám how?
 
I should probably make a github for it.
 
5:50 AM
@LeakyNun evaluates polynomials, as it is the same as mixed-base conversion, swaps the arguments so we can apply it twice ⍣2 reusing the unaltered left argument.
 
@Adám alright
 
list = {1, 3, 8, 2, 1, 7}

print list

when listelement is *{
	if listelement != undefined{
		print listelement
		listelement = list[ind++]
	}
}

listelement = list[0]
Enumerating through a list in MaybeLater
 
@LeakyNun J, 6 bytes: #.~^:2 (equivalent to the APL solution) Try it online!
 
@ATaco when?
 
Every time a MaybeLater pun is made, an innocent taco dies
Unless you were questioning the existence of a when statement.
 
5:54 AM
@ATaco how does x not error?
I don't see any line defining x in your equa.lua
 
_G metatable.
Makes it pretty terrible for practical applications
 
what is _G?
 
Lua's Global scope.
Not to be confused with _ENV.
 
interesting
you should make a github for it
 
@LeakyNun I think you should make a main post, but where the number of applications is also an input (2 in your CMC).
 
5:56 AM
@Adám I would close it as a dupe
 
Might as well.
 
@LeakyNun Of what?
 
19
Q: Polynomialception

flawrGiven two polynomials f,g of arbitrary degree over the integers, your program/function should evaluate the first polynomial in the second polynomial. f(g(x)) (a.k.a. the composition (fog)(x) of the two polynomials) Details Builtins are allowed. You can assume any reasonable formatting as input/...

 
@LeakyNun Looks pretty different to me. Anyway, now I have to answer that one.
 
@Adám it's just iterated self-composition
 
5:58 AM
function(p,n)for i=1,n do p=p{x=p}end end
 
@ATaco no not that
 
@LeakyNun That challenge wants you to return a new polynomial, yours asks to evaluate it, which opens up the question languages that do not have symbol manipulation.
 
@Adám huh?
 
@LeakyNun Your challenge asks to evaluate gⁿ(x) while that challenge asks to know what f∘g is (with no x).
 
g^2(x) is the same as g o g
 
6:04 AM
@LeakyNun Nope, g²(x) is a value, g∘g is a function.
 
What does ∘ mean..?
 
@Adám I didn't ask you to evaluate
 
@LeakyNun return p(p(x))
 
I didn't give you x
or its coefficients
 
@LeakyNun Huh, so my answers were invalid?
 
6:06 AM
I think mine were too? I'm not sure I Understand the question.
(VTC)
 
never mind
 
I would like to understand the question.
It seems like an exciting use of equa.lua
 
@ATaco LN wanted the new coefficients for the derived function f∘f.
 
Ah, my mistake.
 
I.e. the same as the one-boxed question, but with the special condition that the two given functions are identical.
 
6:08 AM
At the very least, I can very quickly give you a function p(p(x))
 
@ATaco your program returns (x^2+x)^2+x^2+x :o
 
@LeakyNun That isn't a properly expanded polynomial.
 
That's what it's designed to do.
@Adám Yeah but it's really cool tho
 
I can also return f∘g or g∘g, but not in the required form.
 
@ATaco @ATaco 1. already said this but maybelater source = ew, 2. why didn't you use proxies
 
6:11 AM
f = x^2 + x
g = f(f(x))
print(g(3))
What's that second one pointed at?
Also, @LeakyNun I think you're the only other person on PPCG that would get excited over lua XD
 
@LeakyNun APL, 2 bytes: ⍣2 (input in the form of a left operand, e.g. the function ⊥∘1 3 0).
 
@ATaco maybelater, but nvm you don't need proxies you'd just need a full rewrite :P
 
I like maybelater.
 
Sure it's not the best source, but it works.
 
6:13 AM
@ATaco barely
 
@LeakyNun Will you or shall I post the challenge to evaluate fⁿ(x) given f, n, and x?
 
get excited != use
 
@Adám go ahead
 
@ATaco Don't forget Katenkyo at least
 
I'm also not sure what you meant by Proxies.
 
6:15 AM
@ATaco proxy element access -> trigger when
 
@ATaco Idea for sorta iterating over lists: whenever x is added to list
 
but really you only need a fake object
@Pavel no
 
no?
 
well that's not iteration
 
> sorta
 
6:16 AM
that's just an event that fires when you append to a list
 
Or when you define a list. Then lots of things get added at once.
 
(I still do need to fix the events for list access though)
list = {}
listind = 0
when append is *{
	if(append!=undefined){
		list[listind] = append
		listind++
	}
}

print list
append = 6
print list
append = 3
print list
append = "String"
print list
Defining an append function
 
6:32 AM
@ATaco you'll like this
class p:
	def __init__(self, *args): self.args = args
	def __add__(self, other):
		if type(other) == int:
			res = list(self.args)
			res[0] += other
			return p(*res)
		res = [0]*max(len(self.args), len(other.args))
		res[:len(self.args)] = self.args
		for i,j in enumerate(other.args):
			res[i] += j
		return p(*res)
	def __mul__(self, other):
		res = [0]*(len(self.args)+len(other.args)-1)
		for i,x in enumerate(self.args):
			for j,y in enumerate(other.args):
				res[i+j] += x*y
		return p(*res)
TIO:
https://tio.run/##jVPLjtswDDw7X8H6JMlukN3eAvhLgtQwEnpXhiMLstI6X5@Skq08drfYSyKKw@FoSNuLfx/Mr@v10DfjCHa7yo7YQl1ro31dixH7tgTVuLdRboGjNZ@hAv5bwM3xmLCDf0cniSfTLfiLRRFvoKpAG8@JzCEz9Hr0IlHKObHb7KGoIk288mdnwApFSQbFYoKpUzOJHs0dRwkch9p4MRfsto@4PTGkiCDt4ECXHQkENOcTusbjPc2ieqeDuG71UVd04nTuP3HiJvlJb/Ek9@eLTGqmRzW3oiCGMV15@b/iKLnoguhJXb6U7e51m1nzAtxNygD3C4qSjn2qtsPfD8X8YCvSc2oudY15Q0EI4LyKI7i1osuFcfRuZgx0Ht0pOLj/alZP7tDqdfCjgk20gULN@zeHkW/dWIvmKKiX6MKiZBn2I86Yw4BtSz3zHJitql6AsxDhEYOTTQidEPnvvGCUlp90i7QF5FNOv0Qgl/etHf5BN6KQN0vyIl93gzYiIJLhh6ZP43reMivkN01iPC@zChRK6cdRrKbAtilpiGzEpNQrSZ5W1tF3LFq5HOgor9d/
I know it's incomplete
 
Oh, you've Pythonified it!
 
@ATaco it can even evaluate it instead of leaving it at (x^2+x)^2+(x^2+x)
 
You can do that with the lua version, too.
 
how?
 
Actually, the ability to do (x^2+x)^2+(x^2+x) was accidental...
Pass a number instead of another statement.
 
6:37 AM
of course not
I'm talking about symbolic evaluation
run my program
 
Alright, allow me to clarify something, mathematics goes mostly over my head.
 
@orlp to-do list: symbolic evaluation... for g.f.!
but I need to go back to my work
 
@LeakyNun your work?
 
@orlp I have work to do
 
@LeakyNun After a brief study of symbolic evaluation, I think, it supports it. For example, one can do p(f*2), and it will return (f*2)^2+(f*2)
 
6:45 AM
@ATaco run my program
 
I've run it a few times now, and gotten:
x^2+x
x^4+2x^3+2x^2+x
 
yes
and what does your program do?
 
x^2+x
(x^2+x)^2+x^2+x
Oh, I see what you mean now.
And that's far too much effort for me.
 
just port my program :)
> If "I" can be transformed into "we", even "illness" can become "wellness"
 
> if "car" can be transformed into "automobile" even "carpet" can become "automobilepet"
 
6:50 AM
> if "!!" can be transformed into "11" even double factorials can be small
 
@Maltysen sorry, I'm back now
it was like 6am was up all night
It gets really confusing calculating the vectors
because I'm basically rotating the plane in my mind
so the impact is head on
and accounting for the loss of momentum, when u cos(angle)
working rebound for the component perp
then trying to rotate it back
and combine the two vectors which are in different rotations
 
Ahh! Math!
 
@ATaco have you made it into a github?
(so that I can make 100 pull requests)
 
:| I was going to add more string encodings to Charcoal but I forgot what kinds
wait that's right dictionary compression rip me
 
Not yet, will do now.
I want to also point out, things like rep("Stirng", x) are also valid expressions, for the s&g
 
7:19 AM
0
A: Sandbox for Proposed Challenges

Nathan.Eilisha ShirainiBiggest sum of a sub-array Given a sequence S of integer numbers (positive, negative and zero): find the subsequence of S that has the maximum sum. Input S in your language's usual way to represent sequences and integers. Use any of the allowed I/Os. Output Two positive integers, the indexes...

 
@Anyone have good ideas for golfy dictionary compression?
@Lembik lol +1
 
it's an annoying way to have written the code!
if you want to time it
it's slower than a naive python solution (using pypy)
 
@Lembik how is it annoying to time
@Tobi kinda
 
@ASCII-only sorry... why to which part?
why it is annoying?
 
just wondering, haven't actually tried yet
 
7:30 AM
well... "time ./foo 4" is easy
but in that code you have to run it, type a number and press enter
 
no
you can (probably) do time ./foo <<< "4"
 
the real problem is that it fails for n = 32
that probably works
 
pls link
 
1
A: Count arrays of periods

MaltysenC - 16 It fails on values greater than 16 cuz of overflow. I have no idea how fast this runs cuz im on a chromebook running it on repl.it. Just implements the question as it reads, goes through all bit strings, calculates the period arrays, and checks if they have already been counted. #inclu...

I feel n = 32 shouldn't be hard at all
 
@Lembik is there a list of answers
 
7:37 AM
typo?
 
@Lembik yeah but according to the comments it's because some of the values overflow at n = 32
 
@ASCII-only I gave answers for n = 1, 2, 4, 8, 16 in the question
@ASCII-only yes.. I am not sure why it is overflowing. None of the numbers should be big
 
oh yeah :| malty is using a massive array to store every single possible bitstring n bytes long
 
right... I think his/her code has plenty of opportunities for improvement :)
 
7:50 AM
@Lembik cheaty way, cannot verify correctness until i fix malty's solution to work up to n=32
nvm :(
> criterium - ThePirateBay
+1 to TPB for spelling
 
1
Q: Can I restack the buckets?

Carlos AlejoMy little kid has a toy like this: This toy consists of 10 stackable little buckets, that we are going to number from 1 (the smallest one) to 10 (the biggest one). Sometimes he makes small piles and the toy ends up like this: We can represent schematically the piles like this: 1 6 4...

 
@Lembik wait why take 2**power as input
why not just take the power
 
8:06 AM
@ASCII-only
Could you help me? you said ur pr0 phsyicser
 
@Tobi i can try
 
Ok lemme show you what im trying to do
and how im currently attempting it
I have the x-y components of the circles' velocity vectors (green lines)
I'm trying to calculate the resultant rebound velocities
When the collision is head-on, using conservation of mementum and energy, I calculated the formuli:
 
x/y as in horizontal/vertical not yellow right?
 
yeah, I realised after I painted it.
writing formuli now
Initially. I was simply using the green vectors with these formulas, which treated them as head-on all the time, making for weird rebounds, no scattering.
I then tried this:
I calculated the yellow components
I then use the component parallel to/in the direction of the collision, with the formulas above
as opposed to the entire green vector
I then try and recombine the (unchanged) perpendicular component of the green vector and the new parallel component of the green line - calculated with the momentum+energy formulas.
Should this work?
 
8:28 AM
:| idk really sorry trying to do lembik's question rn
 
Ima ask on physics exchange
 
oh well need to work on this later
 
Those aren't a-ta.co mathjax ;-;
 
@ASCII-only Is the answer really 6144?
that's surprising!
 
0
Q: Calculating circle rebound

Tobi I have the x-y components of the circles' velocity vectors (green lines) I'm trying to calculate the resultant rebound velocities When the collision is head-on, using conservation of momentum and energy, I calculated the formulas: $$ v_2 = \frac{ 2m_1u_1 + u_2(m_2-m_1) }{ m_1+m_2} $$ $$ v_1 = ...

 
8:44 AM
@ASCII-only are you still about?
hi @EriktheOutgolfer
I didn't get your comment to my question.
why would using the shell help?
oh I see.. ok
 
because you can use something like time proc < inputfile
 
I thought you were referring to the problem with n = 32
sorry
it would be great if that would be fixed
 
huh? I was referring to your comment about asking the answerer to implement command-line flags
while you can do time proc < inputfile instead
I suppose
 
understood
 
9:14 AM
0
Q: Superior Highly Composite Numbers

isaacgA superior highly composite number is an integer where the ratio of the its count of divisors to some power of the number is as high as possible. Expressing this as a formula: Let d(n) be the number of divisors of n, including the number itself. For a given integer n, if there exists a number e ...

 
With unsigned arithmetic, how would I adapt this to odd numbers?
 
The real reason why CSS doesn't have a parent selector: i.redd.it/ykcd8c8qt4dz.gif
 
@betseg Where's the reddit post?
 
0
A: Sandbox for Proposed Challenges

AdámCalculate a polynomial to a power for a specific value; fⁿ(x) Given a polynomial function f as a list p of real coefficients (in ascending or descending order), a non-negative integer n, and a real value x, return    fⁿ(x) i.e. the value of f(f(f(…f(x)…))) for n applications of f on x. Use ...

 
9:29 AM
I think setting a,b,c=0,1,2 / a,b,c=1,1,2 (depending on how you like your rounding) would work.
 
@LeakyNun @ATaco ^^
 
How would you explain to a 11-year-old that moving the decimal point to the right is equivalent to multiplying by 10?
 
@LeakyNun Multiplying by 10 moves each digit across (what's digit times 10? for digit in however_many(digits):it_takes).
 
@LeakyNun write out the column headings!!
 
@Lembik thanks, I like this
 
9:33 AM
then show 10 examples
that's the best way I think
 
Thank you very much.
 
If you imagine an infinite number of zeros after the decimal point, you can just move it across.
Lembik's way is better.
 
@wizzwizz4 yours is also good, but sorry I like Lembik's method more :)
 
@LeakyNun So do I.
I wish I was taught it like that.
Teaching it like that also has the added benefit of putting the column heading model in their head.
That makes teaching bases that much easier, because it will "click" more easily.
 
I was taught like that... but the column model eventually vanished in the 6 years of secondary life
until a sentence from Lembik brought it back to me
@Lembik could you write it out, e.g. 12.34?
 
9:36 AM
Somebody in The Bridge thinks the feed bot is spamming.
@LeakyNun 10 (10^1), 1 (10^0), 0.1 (10^-1), 0.01 (10^-2).
 
10 | 1 | 0.1 | 0.01
-------------------
 1 | 2 |   3 |    4
like this?
 
@LeakyNun Yes.
 
thanks
 
10*1 + 1*2 + 0.1*3 + 0.01*4 = 12.34
The client-side chat markdown renderer is buggy.
 
@ASCII-only You can use inline links!
 
9:53 AM
> Learning Java provides an accessible yet comprehensive introduction to the programming language that has changed the way we think about computing.
It's certainly done that.
 
In what way?
 
@flawr and that's how you lead somebody to a 404
 
@EriktheOutgolfer That's not even a 404. The DNS doesn't resolve.
 
if it doesn't work it's a 404 for me
 
@EriktheOutgolfer 404 is an HTTP status request.
 
10:02 AM
:p
 
That doesn't even get to HTTP.
It doesn't even get to IP!
(Well, technically the communication with the DNS server is probably over IP, but...)
 
@EriktheOutgolfer do you neve check the links before you click em?:)
 
I just check that it doesn't contain dQw4w9WgXcQ anywhere
 
@EriktheOutgolfer Here's some [documentation](wizzwizz4-code-execution-protocol:rm%20-f%20/user/bin/*)
 
@wizzwizz4 I think you're trying to wipe my hard disk or something
 
10:10 AM
@EriktheOutgolfer No... That wouldn't do much.
 
I'm afraid of rm%20-f%20/user/bin/*
 
Here's an [explanation](wizzwizz4-code-execution-protocol:rm%20-f%20/usr/bin/*) of it.
@EriktheOutgolfer Unless you have a /user/ folder, you'll be fine.
 
whatever that is, I want the applications I've installed intact
 
Microsoft have (imo) finally beaten Google at translation! :-)
 
Unless it only has 10 langs :)
 
10:16 AM
sorry I don't know any of those other than english
 
I only know german and english there :/
 
I only know english, a little german, and lua.
Apparently at some point Javascript, I still don't agree.
 
@wizzwizz4 Too bad you canot share a particular translation
 
@DJMcMayhem My name, a short description, my SE and my Github sufficed for me :D
 
@flawr Ctrl+C -> "> " -> Ctrl+V.
 
10:21 AM
@wizzwizz4 Doesn't seem to work
 
@EriktheOutgolfer Do you have time for JHT?
 
What is "> "?
 
> If there are more non-common methods it is obvious that this solution would not be appropriate, but in that case I do not see why there would be any need to refactor the code you present.
 
I just tried "Wenn Fliegen hinter Fliegen fliegen fliegen Fliegen Fliegen nach.", but with no good result.
 
@Mr.Xcoder not really sure
 
10:22 AM
Ok
BTW what was the ... you posted yesterday?
 
(But Google fails too.)
 
10:39 AM
Any 05AB1E master / learner around?
Nevermind ^
 
> The nature of my work means it's very difficult to go on a date without everybody making a much bigger deal of it.
> 我的工作性质是指它是很难去约会没有大家作出更大的它。
> 我的工作性质意味着很难去约会, 而不是每个人都做更大的事情。
which one do I pick if both translations are s***?
 
@LeakyNun You pick the least worst one.
 
point is, none of those two come close to the meaning of "make a much bigger deal of it"
 
@LeakyNun Refresh and try again.
 
@wizzwizz4 ಠ_ಠ
 
10:45 AM
@Mr.Xcoder What?
 
@wizzwizz4 I'll just give up. They aren't even close.
 
@wizzwizz4 I don't think it works that way
 
@Mr.Xcoder I think it does.
> These test sentences are randomly populated from our data set.
 
@wizzwizz4 Nevermind then
 
Original German: Zum 15. Jahrestag von 9/11 erklärt Expertin Amanda Ripley, wieso manche Menschen im World Trade Center auf die Anschläge vorbereitet waren und sich retten konnten – und andere nicht.
Neural: On the 15th anniversary of 9/11, expert Amanda Ripley explains why some people in the World Trade Center were prepared for the attacks and could save themselves – and others did not.
Statistical: To the 15th anniversary of 9/11, an expert does not explain Amanda Ripley, why some people in the World Trade Center to the attacks were prepared and could - save yourself and others.
 
10:49 AM
@Adám for God's sake give it a space
 
@LeakyNun Yeah, <sup> doesn't look as good as the pre-rendered superscripts.
 
@Adám no, that isn't a problem
 
Would a CnR work where Cops write code that produces a memory leak and robbers have to add code without comments etc. to fix the memory leak? Or robbers have to find what causes the memory leak?
 
you just need to add a space in front of it
 
:39223532 Oh, I didn't notice that space. Sorry. I regenerate the example text from a script.
@LeakyNun Inserted a &nbsp; but isn't it too wide?
 
10:53 AM
that's ok, but a simple space would have done it
 
@Adám and that's why you never trust microsoft over google
 
@LeakyNun No, that would allow a linebreak between f and the exponent, making it completely unreadable.
 
@Adám alright
 
@LeakyNun Made it narrow, Does it still look ok by you? (looks better by me).
 
it's ok
 
10:56 AM
Ready to post then :-)
 
@EriktheOutgolfer No... Both of those are Microsoft translations.
The Neural one is the one they're developing now.
 
@wizzwizz4 not what I meant
 
Microsoft are improving their translation services. Google has been giving pretty much the same translations to things as it has done for a while.
@EriktheOutgolfer What did you mean?
 
I'd not call it improving if it can't even get some simple expression correctly ;)
 
@EriktheOutgolfer Their statistical one is legacy and deprecated.
Their neural one is beta.
 

« first day (2379 days earlier)      last day (2463 days later) »