« first day (2362 days earlier)      last day (2480 days later) » 

8:02 AM
@LeakyNun It's not.
 
@Mr.Xcoder just dissect my pyth answer to that challenge
 
@LeakyNun What Pyth answer?
 
@Challenger5 you can't expand an array right? so the size must be stored somewhere?
@Mr.Xcoder the partition challenge on main
 
Ok
3
A: How many partitions contain only perfect squares?

Leaky NunPyth, 16 bytes lf!f!sI@sjkY2T./ Test suite.

This one?
 
@LeakyNun It's known at compile time, but not runtime
Accessing out of bounds is UB
 
8:06 AM
@Challenger5 oh, interesting!
so malloc is done at compile time?
@Mr.Xcoder yes
 
@LeakyNun Arrays are stored on the stack. The size of anything on the stack must be known at compile time, otherwise you can't get the return address, etc.
 
@Challenger5 quite interesting...
how does sizeof work then?
also, is the array pointer constant, i.e. cannot be changed?
 
@LeakyNun You should consider every different array length as its own type. sizeof expressions are replaced at compile time.
 
@Challenger5 is there anything done at runtime?
is 1+1 done at runtime?
 
@LeakyNun Any sort of local-variable stuff is handled on the stack for efficiency.
@LeakyNun No, it's a constant expression so it will be replaced.
 
8:11 AM
@Challenger5 can you name anything done at runtime?
 
(This is all assuming a standard compiler; the C spec does not guarantee it.)
 
let's say i have int a[99] and int b[9], and i do sizeof(expression?a:b), then what would happen?
 
@LeakyNun Calls to printf and I/O functions are done at runtime, of course. Function bodies will sometimes be inlined if they are sufficiently small, but generally they are called at runtime as well. C optimization in most compilers is pretty aggressive.
 
let's say the expression is done at runtime
 
@LeakyNun I'm pretty sure that wouldn't be allowed. Let me test it real quick
 
8:13 AM
@Challenger5 thanks
if it works, then probably it would be compiled to expression?396:36, i guess
 
@LeakyNun Also, you can't allocate an array with a size that's not known at compile time
 
@Challenger5 so nothing like int a[i]?
if i is determined at runtime?
maybe I should grab a book about C
 
@LeakyNun Nope.
You can fill it with constexprs like a[48 + 65535 + 1] though.
 
have you tested the 99 or 9 one?
 
8:19 AM
@Challenger5 wild guess: it's the size of that expression somehow
 
Yeah, that's what I was thinking
 
try disassembly?
 
OK, apparently actually you can have variable-length arrays, but I think they would have to be allocated on the heap.
 
I'm on mobile now so you might be more convenient
 
Wikipedia says, "although the feature is considered an optional implementation in later versions of the C standard"
 
8:21 AM
Strangely, if you assign a variable k to 0 ? a : b, you get another result.
 
Which basically means that it you do it your program is no longer compatible and compilers will optimize it into smithereens.
@LeakyNun Oh, I know - it's the size of the pointer.
 
@Mr.Xcoder someone forgot to press save
@Challenger5 but sizeof(b) returns 36?
@Challenger5 UB?
 
@LeakyNun Fixed.
 
@LeakyNun No, but it's "optional implementation" which means that your code is no longer portable across compilers/versions.
Not that C was portable anyways.
@LeakyNun Because "[sizeof] is one of the few exceptions to the rule that the name of an array is converted to a pointer to the first element of the array".
So if you use the array variables in an expression, they just mean pointers.
But if you use the names in sizeof, it means something different.
 
@Challenger5 but pointers have size 4?
 
8:24 AM
On 32 bit systems they do.
On 64 bit they're size 8.
 
if *k is a pointer, then what is k?
can you test TIO is 32 or 64?
 
sizeof(long) is 8, which makes me think it's 64.
But I think Dennis would be a more trustworthy source.
 
can you test a pointer?
@Challenger5 sizeof long is 8 even on 32...
 
OK. I just tested, and long* is also 8.
 
That's the reason I avoid C ^
 
8:28 AM
im a big confused about $(0+1) \ ^ {*}$ meaning. is $010 $ is in that language ?
(is this the right chat to ask this question ? :P )
 
@Liad dont use latex for regex
 
What language?
 
(0+1)*
no, it doesn't match 010.
 
alright
 
Because (0+1) matches one or more zeroes, followed by a one.
 
8:29 AM
i read somewhere that the language of (0+1)*bb(0+1)* is all the words that contains bb
 
If you want a character class, you can use [0+1].
 
@Challenger5 no it doesn't
 
Oh, whoops. I forgot about +.
 
@Liad then it is wrong
 
they used union instead of +
 
8:31 AM
what?
 
im learning computability theory and it is a just shown that regex are equivalent to regular languages
 
[01]* matches 010.
 
If bb is a bitstring, then .*bb.* matches any string that contains bb.
 
if + is union then in regex it is [01]*.
 
and they gave as an example that $(a \cup b) \ ^{ *} bb(a \cup b) \ ^{ *}$ is the language of all words that contains $bb$
 
8:32 AM
sorry for the confusion
@Liad that is true
 
So how come $aba \in (a \cup b )\ ^ {*} $
 
By the way, have you read Regular Expression Matching can be Simple and Fast? The first part of it was very instructive to me.
 
isn't it a* union b* ?
 
The second part describes a C algorithm for matching regex, which isn't quite as useful theoretically
 
@Liad no
 
8:34 AM
can you explain ?
i could have guessed it is not :P
 
In regular expression notation, a* means "zero or more of a".
 
@Liad a in [ab], b in [ab], a in [ab]
 
@Challenger5 Quantifier, in other words.
 
@Liad I'm on mobile. I'm typing.
 
@Mr.Xcoder Yes.
 
8:35 AM
@Liad where [ab] is a union b
so aba in [ab]*
 
Have we changed the subject from C to regex?
 
I think so.
 
in each * you can choose a different choice
I'm done @Liad
 
got it , thanks @LeakyNun
 
a* union b* is (a*|b*) in regex
 
8:36 AM
Can we now changed the subject to Pyth training? :P
 
@Mr.Xcoder just ask
 
I don't have anything to ask :p
But will have once I give myself a task
 
@Mr.Xcoder given [3,1,4,1], return [[1,4,1],[3,4,1],[3,1,1],[3,1,4]]
 
@LeakyNun All contiguous permutations of length len(list-1)?
 
not contiguous at all
 
8:40 AM
I don't get it
I think I got it
 
remove the first element
remove the second element
remove the third element
remove the fourth element
 
Yeah, I got it
 
@LeakyNun CMC it
 
@LeakyNun just realized , $(0\cup 1) \ ^ {}$ is just $\{ 0,1 \} \ ^ {} $ in regex, right?
 
@Liad in regex it is (0|1)*.
 
8:42 AM
@LeakyNun For a list of any length, right?
 
@Mr.Xcoder yes
 
@LeakyNun the left one is in regex, the right in "regular languages" form, that is what i meant
@LeakyNun never mind
 
regex doesn't use union either
but I get what you mean
and I'll answer yes @Liad
 
@LeakyNun alright :P
 
@LeakyNun Golfing hint?
 
8:47 AM
@Mr.Xcoder no hint
 
@LeakyNun Good
Found one but does not work if the list has duplicate elements :( too Naïve
@LeakyNun (this one works for duplicate elements) 13 bytes: m+<Qd>QhdtMSl
 
try harder
 
@LeakyNun To golf it?
Sorry, forgot to press permalink
 
yes
 
Good link version: m+<Qd>QhdtMSl (To be golfed)
 
8:55 AM
oh dang how did I not know that MySQL can do regex
 
I have an idea, I just have to search through the built-ins. May take bit
 
@Mayube do my challenge in braingolf?
@Mr.Xcoder if you haven't scrolled through the list of built-ins, then there is some problem
 
@LeakyNun which one? The remove each element one?
 
yes
 
I'll give it a shot
 
8:58 AM
@LeakyNun That's a nice one, I have it in 5 bytes
 
@LeakyNun I know it's not yet good, but I have 11 bytes: m+<Qd>QhdUl
 
Sure, sorry.
 
Then, 10 bytes: m+<Qd>QhdU
@isaacg Let me solve it myself pls
 
Ul is the same as U, by the way.
Ugh, chat is unintuitive
 
And sorry for the crappy issue I raised on Github yesterday
I closed it in the meanwhile
 
9:01 AM
I saw. Don't worry about it - there's no harm in such things.
 
@isaacg Great
 
:) It's nice to have people who appreciate the language and want to improve it.
 
I found something that might be of great use: .( - Is it relevant here?
 
@isaacg 5 bytes... can you post a spoiler?
 
>!Test spoiler
Apparently no, I can't post a spoiler.
 
9:03 AM
@isaacg link
 
Oh, sure.
 
[spoiler](link to that)
 
@LeakyNun Not even a small hint to golf it?
What's your byte count, then?
 
Spoiler gone.
 
I haven't tried it
 
9:04 AM
Now I am struggling to golf it and struggling to not look at the spoiler either, thanks :)
 
@isaacg you can just link to the compiler...
 
I could. But that would put the code in the link URL.
 
you can use [spoiler](...) to cover the link
 
Both ways work.
 
interestingly you used a built-in that I don't know
 
9:07 AM
@LeakyNun if you haven't scrolled through the list of built-ins, then there is some problem
 
Ok, here's another way to do it with no weird builtins: spoiler, same length.
 
@Mr.Xcoder yes, I have some problem.
@isaacg that's clever
 
:) Wrong order though, it would make it longer to fix it.
 
@LeakyNun Does the order matter?
NVM
 
yes
 
9:11 AM
@LeakyNun *Faceplam*
@LeakyNun 6 bytes: m.DQdU
 
Nice!
 
Took me a long time to find .D
> .D <seq> <num> Returns A with the element at index B removed.
I was searching for "ommited","index" but I found it when I searched for "removed"...
@LeakyNun Next? (or should I golf further?)
 
use L
 
@LeakyNun Ok....
> L <pfn> <n-1:any> <col> Left map. n>=2. Map A(B, ..., _) over C, where _ is the lambda variable. Map uses m underneath, and B may refer to its lambda variable.
This one ^?
 
yes
 
9:17 AM
Ok, I first gotta play around with L and see how it works
@isaacg I would give you a bounty for the beautiful language you created... I am upset that I can't.
 
@Mr.Xcoder I appreciate the thought. And I have plenty of rep as it is.
 
BTW What's <pfn>?
I know <pf1> means I should put sth in front, but n?
 
Click on the link at the top to see the key.
n is used again in the text. It says n >= 2.
 
Preceding function of arity n. *F, for instance.
So I must put at least two things in front.
 
No, you must put one function of arity at least 2 in front.
 
9:21 AM
@isaacg Oh, I must put a dyad or something with more parameters in front of it
 
Exactly.
 
Should I still use .D?
 
Yep
CMC: Reduce by ternary. Given an odd length sequence of 0s and 1s, replace the first 3 numbers by the second one if the first is 1, and the third one if the first is 0. Repeat until there is one number, then return that number. For instance, [0, 0, 1, 1, 0] -> [1, 1, 0] -> 0.
 
@isaacg Wait for me to finish this plsss
 
It's not going anywhere
 
9:25 AM
What's the variable for L? I think It is something like .DQ<something>L
Oh, I'm completely wrong.
I have to put the dyad in front and I have to loop on something, it should start with .DL, right?
 
@isaacg Shouldn't that be [0,0,1,1,0] -> [1,1,0] -> 1?
 
@Mayube Yes, you're right.
 
6 bytes again: .DLQUl
Oh, no, Ul is U
5 bytes: .DLQU
 
@isaacg Braingolf, 22 bytes: &,1>[?>$_<:$_|<$_l1->]
 
Good ^^?
 
9:30 AM
Yes! Correct.
 
I shall move on to your CMC, shall I?
 
Sounds good. I'll try to solve it too, now.
 
@isaacg I don't get you CMC: I have [0, 0, 1, 1, 0]. The first 3 numbers are 0,0,1. The first is 0, so I replace them all with the third: 1,1,1. I get [1,1,1,1,0].
Ahh, I got It.
The first and the second after the first three.
 
@Mr.Xcoder not 1,1,1, just 1
 
@Mayube I misunderstood formerly
How does [1, 1, 0] become 0?
 
9:36 AM
That was a typo, sorry.
It should become 1
 
@isaacg But how, anyway?
 
First is 1, so we take the second number, which is 1.
 
Same length as what I had, and essentially the same code. Nice!
 
thanks
 
9:45 AM
Sorry for my absence, I had a netfall
Another CMC?
 
Feel free to come up with one, if you want. Those are just as fun to solve.
 
still isaac's one
 
@LeakyNun Nah, I personally wouldn't like solving that one
And I've looked at your solution anyway, so...
CMC: Given two lists of numbers of the same length, return the product of their corresponding elements
[1,2,3,4], [5,6,7,8] -> [5,12,21,32]
 
three bytes in pyth
 
Okay
@isaacg Does Pyth have a zip?
 
9:51 AM
C
 
It has C which is n-wise zip, and it has V, which is 2 wise zip as a pfn
 
> zip argument #1 must support iteration
 
@LeakyNun I can do 3 bytes three different ways
@Mr.Xcoder What's your code?
 
@isaacg NVM
 
@isaacg do you want a cookie?
 
9:55 AM
Was that a "well done" or a "calm down, you're getting too competitive"? I'm not good at reading tone of voice.
 
Do you have Q and E in your code?
 
that was a question
 
I like cookies, especially the kind I can eat.
 
> Do you have Q and E in your code?
 
@Mr.Xcoder In one version, I have one of those.
 
9:56 AM
And how do you read two lists, then?
 
In the other versions, I take a tuple of two lists, like you originally framed it
[1,2,3,4], [5,6,7,8]
In the version using E, they're newline separated.
 
Is there a built-in I don't know?
 
All of them use only common characters, no strange builtins
 
@isaacg Then I guess I can solve it
IDk
@isaacg How should I use C to get (1,5),(2,6)...? Or V?
 
If you start with [1,2,3,4], [5,6,7,8] and use C, it's very easy.
 
10:06 AM
@isaacg That didn't really help That did help
 
The code is C.
 
@isaacg Figured that in the meanwhile. Thanks!
 
Ah
You're welcome.
 
Perfect!
 
10:08 AM
I should really scroll more through that list of built-ins
 
My favorite way to solve this is *VF
 
@isaacg What's the strong point of Pyth? I mean, in what type of challenges does it excel?
I see it's good with list manipulation
And String manipulation
 
In my opinion, its strong point is understandability. It's much easier to write a long (e.g. 80 byte) program in Pyth than other golfing languages
But to be honest, Jelly and 05AB1E are typically a bit shorter at just about everything.
And that's even after compensating for the larger range of characters.
It's natural for that to happen over time - Pyth is basically only beaten than newer languages than it.
 
That issue I opened yesterday was a matter of winning to Leaky's Jelly solution by 1 byte and losing to JonathanAllan's Jelly solution by 1 byte
 
It only would have saved 1 byte per use. Were you using it twice?
 
10:13 AM
Now I am tied with Leaky's Jelly one and 2 bytes behind Jonathan
@isaacg Wait...
 
4
A: Randomly select a character, plinko-style

Mr. XcoderPyth, 10 8 bytes O+<Q2*2t Uses the exact same algorithm as is @JonathanAllan's Python answer. Try it online! (I have the same test case multiple times such that you can see it's random) Explanation O - Takes a random element of the String made by appending (with +): <Q2 - The first tw...

No, just once.
 
So if *2 was a 1 byte builtin, it would be 7 bytes long.
 
The jelly solutions were 8 and 6 bytes respectively. And I had 8 too
@isaacg Yep, Not really useful though
 
I get it, I misunderstood the first time.
@DestructibleLemon Hi
 
10:15 AM
@DestructibleLemon Hi
 
@Mr.Xcoder ninja'd :P
 
@DestructibleLemon Can't multiple people say "HI"?
Now we have greeting rules too?
 
hence the ":P"
 
@isaacg Pyth assignment?
 
I was just working on golfing your plinko code. It can be shortened by at least one byte.
 
10:18 AM
@isaacg Really?
Thanks BTW
 
Well, the code looks completely different, so I'm not sure it's really golfing your code, but: @Q|O8 1
 
What's |?
 
Logical or
 
Logical or?
How is that random?
 
The O
 
10:20 AM
I don't understand your code >_>
I actually do
But I doubt that's valid
 
Why not?
 
@isaacg You must pick a random character from a string that has the first char repeated once, the second repeated thrice and the other two repeated twice each
How does your code do that?
 
No, that's not a requirement of the challenge. It just specifies the probabilities, not how you select the character.
 
@isaacg ?
How does the second character have a 3/8 probability?
With you code?
 
If O8 outputs 0, 1 or 5, the second character will be picked.
Because |O8 1 will be 1, 1 or 5 respectively.
 
10:24 AM
@isaacg How does the first have 1/8?
 
It is only output if 4 is generated by O8.
 
Oh, I didn't see the <space>1
 
Yeah, that's crucial.
 
I thought your code was @Q|O8, sorry, my mistake
Cool
Can I use @isaacg ?
 
I think it should probably be a separate answer, to be honest.
There's no overlap with your code.
 
10:26 AM
@isaacg Go ahead and post it, then
 
Will do.
 
@isaacg Consider making it a test suite with the same string multiple times, such that people can see it's random. And because it's a brilliant idea, consider adding a good explanation to it.
Ping me when you post it
 
1
A: Randomly select a character, plinko-style

isaacgPyth, 7 bytes @z|O8 1 Test suite O8 generates a random number from 0 to 7. | ... 1 applies a logical or with 1, converting the 0 to a 1 and leaving everything else the same. The number at this stage is 1 2/8th of the time, and 2, 3, 4, 5, 6, 7 or 8 1/8 of the time. @z indexes into the input ...

 
@isaacg Already upvoted before you first comment
 
And now, I need to sleep. Good night, everyone.
 
10:34 AM
GN
 
:)
 
10:45 AM
Huh, surprised we don't have a catalog tag
 
11:20 AM
What's the gofiest way to generate a string / array containing all lowercase letters in the alphabet in JS ES6?
 
there was a main post about that
14
Q: Generating the alphabet in JavaScript

Charlie WynnI'm pretty sure there's not a better way to do this but figured it couldn't hurt to ask. I'm tired of typing out a='abcdefghijklmnopqrstuvwxyz'. Cool languages have Range('a'..'z') or similar What can we come up with with JS that's as short as possible?? for(i=97,a='';i<123;){a+=String.fromCh...

 
@programmer5000 "abcdefghijklmnopqrstuvwxyz"
 
:( I wish there was something shorter.
 
@programmer5000 There ain't
 
Python has a nice short way :3
map(chr,range(65,91))
 
11:30 AM
@totallyhuman That's uppercase
 
@ASCII-only I don't know how it's supposed to look, but grey text on green is very bork to me
@Mr.Xcoder map(chr,range(97,123))
 
@totallyhuman Pyth has a nice, short way:3
G
Oh, a new ascii art challenge
 
1
Q: ASCII 2D game-map

LiefdeWenProblem Given input a where a is a grid of characters in any input format as long as it has only one element for each 'block' of the output. And input b where b is a grid of numbers the same size as input a. There are two types of road, a 1 represents a stone road marked by @ and a 2 represent...

 
0
A: Sandbox for Proposed Challenges

Carlos AlejoThe answer to life, the universe, and ASCII-art Simple challenge: try to output the following text in as few bytes as you can: the answer toli fetheuniv ersea nde ver ything the ans wer tol ife the uni ver sean dev ery...

 
11:50 AM
CMC: Given Two Arrays, turn them into sets and return their union and their intersection.
 
Can we take inputs as sets? :P
 
@totallyhuman No
 
->a,b{[a&b,a|b]}
 
wait what's the difference between an array and a set?
that seems like language-specific terminology
 
@Mayube an array is collection of items, that can be duplicate. Sets are unoredered collections that do not contain duplicates
 
@Mr.Xcoder and, union is the 2 sets combined into one set, while intersection is elements present in both?
 
Yes
And that is not language specific
 

« first day (2362 days earlier)      last day (2480 days later) »