9:02 AM
@Qwerp-Derp Hm, getting an error message `cannot def list`. Should the `(d (s num den) den)` in `div?` be a recursive call `(div? (s num den) den)`?

Oh yeah
Does it work if I change it?

`div?` seems to work. `(prime? 2)` gives me `0`, though.
Actually, looks like everything but 1 will give 0.

I think this should work
```(d div?
(q (
(num den)
(i (l num den)
(i num 0 1)
(div? (s num den) den)))))

(d prm-help
(q (
(n orig)
(i (e n 1) 1
(i (div? orig n) 0
(prm-help (s n 1) orig))))))

(d prime?
(q (
(n)
(prm-help (s n 1) n))))```
I just subtracted 1 from orig
No wait that won't work

I assume you want to return `0` for "not a prime" and `1` for "prime"?

Yup
I'm still fixing it hang on
Fixed it probably
I edited the snippet above

9:09 AM
Make sure you handle the corner case for `1`. I think It leads to an infinite loop in this version. Might have to test for it in `prime?` itself.
Other than that, looks good. Nice job on using tail recursion.

Yeah, I've programmed a bit in Clojure before, so I think it helped.
I don't have Python 3, so I can't use the thing at all.

Ah. Yeah, that would be a problem.
Though, of course, there is also a Python 2 implementation, as well as C and Ceylon (though I don't recall if I tested those).

9:57 AM
1

Knit me an ASCII-Sock Introduction Long story short: a few days ago i accidently started knitting a sock and the pretty logical structure of the plain stitches lead me to the idea: Why don't we just ASCII-knit a sock? Input The input is an even integer N in the range [2,30]. Output The ou...

0

Using a language's lack of features to trivialize a challenge This is in the same vein as this other loophole. Consider this challenge. Using a language that cannot access an Internet connection would be a violation of this loophole - it could simply output a falsey output all the time, because...

I think I've verified it @DLosc
Yes I cracked it!
```(d div?
(q (
(num den)
(i (l num den)
(i num 0 1)
(div? (s num den) den)))))

(d prm-help
(q (
(n orig)
(i (e n orig) 1
(i (div? orig n) 0
(prm-help (s 1 (s 0 n)) orig))))))

(d prime?
(q (
(n)
(prm-help 2 n))))```
Here is a prime checker in tinylisp!

1 hour later…
11:20 AM
0

I started working in a company where me and another developer are working on one foxpro project. we both used to copy our entire project folder to make backups on our local machines using a simple batch file wich copies into a folder named with the date/time of the instant and a commentary after...

12:15 PM
0

One of the lesser known programming paradigms which seems rather fitting for code golfing is Overlapping Oriented Programming (OOP) *. When writing partly identical code, many bytes can be saved by simply overlapping the identical parts and remembering in some way where the two original code line...

12:56 PM
Scheduled restart

@Dennis @MartinEnder In view of this CW answer, should I delete my answer and merge it with that CW? Same for the other answers that use STDERR output. (I'm pinging you two because you seem to be more active in chat than the other two mods)

Seems like a good idea to me.

Do we have an official policy for that? Dennis' and xnor's meta answers here are somewhat contradictory, and both are upvoted

1:45 PM
0

Introduction Some of you may have heard of Hilbert's Grand Hotel. The manager there has lost his list of where the guests are staying but he still has the order in which they checked in. Each guest can not stay in a room with a room number less than their value and if a guest is added to a lower...

2:08 PM
@LuisMendo we don't; it's a case where the meta post has two highly popular answers which contradict each other, which makes it hard to say that there's an official policy

The drama that happens in here sometimes is reminiscent of old AOL chatrooms... lulz

Gah, school finished and I have to stay here for 2 more hours...

2:29 PM
@ais523 In that case I'm leaning towards keeping the rep :-P

hmm, it'd solve a lot of problems if CW answers just gave rep (most likely based on the percentage of a post the user owned at the time of the upvote)
it'd be unfair and mildly arbitrary, but less so than just denying all rep from everyone
unfortunately, it might also be abusable
(but it'd solve the issue of people being pressured to CW a post so that they don't gain rep, which we've decided is an abuse of the CW system, and preserve CW for cases where it's actually helpful)

hi all

2:53 PM
Hello

any C coding/low level geniuses in?

well.. I have this loop bpaste.net/show/c53b7ab4e8a6 where everything is complex.Well delta is +-1 and M is an n by n matrix of complex numbers
and I want it to be lightning fast
so I need it vectorize using avx
but gcc can't do it for me
I was wondering if anyone could help me vectorize it

3:14 PM
@Sherlock9 it's tempting to pose a challenge along these lines but I don't know how many low level coders we have
at least 2 but is it also at most 2?

I'm certainly not one of them
Also restricting to low level languages may not be popular

well it's not restricted but it is fastest code
so you can do it in perl if you like :)

3:41 PM
@Lembik first
don't use builtin complex numbers
convert it into manual real part/imag part
@Lembik and how large is n?

Hello

@TuxCopter Hi

@orlp n is 30 to 40
shame about the builtin complex. It looks so convenient
@orlp the issue is that the loop will be repeated with different j values about 2^n times

```      vr[i] -= 2. * (dr[j]*Mr[j][i] - di[j]*Mi[j][i]);
vi[i] -= 2. * (dr[j]*Mi[j][i] - di[j]*Mr[j][i]);```
you get something like this
@Lembik you and your matrices :P
always matrices
when you close your eyes, do you see matrices?

@orlp :)
what else is there? Except for matrices in different numbers of dimensions ;)

3:55 PM
@Lembik hey, scalars are just one by one matrices!

exactly!

calculus is just zero-dimensional linear algebra
they're just confused :P

:) now that's confused me
I will grant you calculus is also interesting.
I haven't worked out any good ppcg calculus questions yet

0

Enthusiastically Russianify a String Greetings Comrades, Many of you may have interacted with people from Russia on the internet at some point, and a subset of you may have noticed the slightly odd method they have of expressing themselves. e.g. деинсталляция игра нуб))) - (forgive the google ...

4:18 PM
Does anyone here have experience with programming android apps?

It's a great question .. but no
@orlp if I do that what is the advantage?

@Lembik that it's the first step for manual vectorizing :)

@orlp ah.. ok so my understanding is that I would convert the arrays into arrays of structs? But then I don't really see how to use them in that loop

@Lembik no, not arrays of structs
you separate them into arrays of real parts and imaginary parts

@orlp right but that won't vectorize yet. How do you do the manual vectorization?

4:45 PM
@Lembik eh that's a bit long to explain if you've never done it before

Woot! Just got the association bonus!

@orlp :(
@orlp is it really complicated?

On the other hand still trying to figure jelly out

@Lembik it's not complicated
it's just a lot of knowledge
@Lembik the first step is basically to unroll the loop
```for (int i = 0; i < n; ++i) {
a[i] += b[i];
}```
as an example
you'd write
```for (int i = 0; i < n; i += 4) {
a[i+0] += b[i+0];
a[i+1] += b[i+1];
a[i+2] += b[i+2];
a[i+3] += b[i+3];
}```
where you ensure that n is a multiple of 4

ok that seems harmless so far

4:52 PM
now the unrolled body you can change into vectorized instructions

but there are two lines my loop
v[i] -= 2.*delta[j]*M[j][i];
prod *= v[i];

@Lembik just do it separately

prod will just be the product of the values in v in the end

@flawr I once programmed one, but I'm very rusty at that

@Lembik for example for prod you can keep 4 parallel products
initialize them to 1
and at the end you do `tot_prod = prod[0] * ... * prod[3]`

4:53 PM
got you
doesn't this all seem like something a compiler should do for you? Otherwise you are writing different C code for different targets
avx versus sse for example

@Lembik eh
if you've written it in unrolled form
maybe the compiler does it
or maybe you can massage the compiler otherwise

the number 4 comes from the size of the avx registers doesn't it?

in theory it can do it
but it doesn't always happen

gcc can't cope with complex numbers sadly
I did try
and even reported a bug :)

@Lembik that's why I told you to change it to real/imag parts first :)
if you want to manually vectorize you have to do that anyway

4:55 PM
yes :) but then it can't cope with the cross product either

there are no complex vector instructions, afaik

so you really have to do it by hand

@Lembik huh?

vr[i] -= 2. * (dr[j]*Mr[j][i] - di[j]*Mi[j][i]);
vi[i] -= 2. * (dr[j]*Mi[j][i] - di[j]*Mr[j][i]);
it can't vectorize that

^ this by the way is your bible
when doing intrinsics

4:57 PM
ah yes
I have sadly discovered over the last week that gcc isn't a very good optimizer
that webpage godbolt casts a brutal light on the weaknesses of optimizing compilers
and sadly I don't have a copy of icc and its very expensive
also gcc exists on a geological time frame

@Lembik but you really don't want to do `complex` for vectorized operations
the memory layout is suboptimal

I submitted a small optimization bug, they immediately found the problem and cure and said they would it to gcc 8 :)

@Lembik What do you mean by this?

@orlp oh why is the memory suboptimal?

when doing complex operations

5:01 PM
@wizzwizz4 sorry what is "this"?

```      vr[i] -= 2. * (dr[j]*Mr[j][i] - di[j]*Mi[j][i]);
vi[i] -= 2. * (dr[j]*Mi[j][i] - di[j]*Mr[j][i]);```

@Lembik The message. "Geological time frame".

@wizzwizz4 oh I gave an example where they said they would add the fix to gcc 8

right now what you have in memory is this: `drdrdrdr` and `didididi` and `MiMiMiMi` etc
is simply a read from memory

5:02 PM
@Lembik Ah...

but if you use `complex`, the memory layout you get is
`drdidrdidrdidrdi`

@wizzwizz4 you can guess when that will appear in your favourite distribution :)

which means it has to load and separate

Then compile `gcc` with that build again, just so it's optimised.

5:03 PM
@flawr I used Eclipse because Android Studio was unavailable or still a beta. But that's probably a better choice

@orlp that's very interesting. thank you

@Lembik is that gcc's fault or your distribution?
2
@Lembik vectorization is all about memory layout

@orlp I feel an expert should be doing this!

@Lembik huh

@orlp well.. not really a matter of fault but another option would have been to target 7.1
@orlp I mean instead of me :)
in fact I am not sure why they didn't. I assume they don't like to change much in major versions

5:06 PM
@flawr I even got a gold badge :-)

@LuisMendo Well you sure got some fancy charts!

From the official doc :-P

hi @Dennis

Hi!

5:12 PM
```complex prod(double* r, double* i, int n) {
double pr[4] = {1., 1., 1., 1.};
double pi[4] = {0., 0., 0., 0.};
for (int k = 0; k < n; k += 4) {
double t[4];
t[0] = pr[k+0]*r[k+0] - pi[k+0]*i[k+0];
t[1] = pr[k+1]*r[k+1] - pi[k+1]*i[k+1];
t[2] = pr[k+2]*r[k+2] - pi[k+2]*i[k+2];
t[3] = pr[k+3]*r[k+3] - pi[k+3]*i[k+3];
pi[k+0] = pr[k+0]*i[k+0] - pi[k+0]*r[k+0];
pi[k+1] = pr[k+1]*i[k+1] - pi[k+1]*r[k+1];
pi[k+2] = pr[k+2]*i[k+2] - pi[k+2]*r[k+2];```
@Lembik that's an unrolled prod function
eh
except `pi` should be initialized to `0s`

@Dennis Very fascinating conversation you two just had. Have you looked some more at Mathics?

Bleh, it's too early for sarcasm.

@orlp is that the whole loop in one go?

this is an example
given two arrays
one of real parts
and one of imaginary parts
this calculates the product of all of them

@Dennis Too early? It's 2:15 PM! (iirc)

5:17 PM
@orlp got you. So I just need to combine this with the other half of the loop

@Lembik but notice that if you look by columns
it's basically doing the same thing
4 times, but with just one different offset
so you could see it as doing it as a vector

@orlp that's very interesting

@Lembik now the vector type we're interested in is
`__256d`
that is, 256 bits containing 4 double precision floats
now in pseudocode you get something like this:
```complex prod(double* r, double* i, int n) {
__m256d vpr = constant_vector(1., 1., 1., 1.);
__m256d vpi = constant_vector(0., 0., 0., 0.);

for (int k = 0; k < n; k += 4) {
__m256d t, vr, vi;
t = vpr*vr - vpi*vi;
vpi = vpr*vi - vpi*vr;
vpr = t;
}

double pr[4], pi[4];
store_vector(pr, vpr);
store_vector(pi, vpi);

return pr[0]*pr[1]*pr[2]*pr[3] + I*pi[0]*pi[1]*pi[2]*pi[3];```
up until now it's been quite basic
but now the knowledge requirement shoots up

That looks remarkably like C and not like pseudocode.

@Pavel it's valid c in a way
but `load_vector` is a placeholder, and the arithmetic is assuming overloaded operators, which is not the case
you need to find the appropriate intrinsic functions

5:25 PM
Well, I don't C, so can't really tell. (I should learn C)

@orlp this is getting more and more interesting!
but I am slightly confused by something

@Pavel yes

@Pavel There are some great tutorials online... What's @zyabin101's GH account?

Should M ideally be stored as 256 bit vectors too?

Learning at least the basics of C should be mandatory for programmers.

5:28 PM
I tried to learn C++ a few year ago, learned about pointers, got scared, and have Java'd since.

@Pavel C++ is scary.

@Pavel you can do C++ without pointersw

Luckily, C isn't.

nuke request?
0

all in 1.89Kb((bad)html) We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand Never gonna give you up Never gonna let you down Never gonna run a...

5:28 PM
Don't bother with pointers until you have a good grasp on the basis

and you can do C++ without templates or objects pretty much too :)

@Lembik That's basically C.

@Riker I don't know if it's off-topic, it's just boring and low quality

so C but a bit better

5:29 PM
@DJMcMayhem it's not an answer though

and no pointers!

Oh I guess that's true

```complex prod(double* r, double* i, int n) {
__m256d vpr = _mm256_set_pd(1., 1., 1., 1.);
__m256d vpi = _mm256_set_pd(0., 0., 0., 0.);

for (int k = 0; k < n; k += 4) {
__m256d t, vr, vi;
t = _mm256_sub_pd(_mm256_mul_pd(vpr, vr), _mm256_mul_pd(vpi, vi));
vpi = _mm256_sub_pd(_mm256_mul_pd(vpr, vi), _mm256_mul_pd(vpi, vr));
vpr = t;
}

__attribute__((aligned(32))) double pr[4], pi[4];```
@Lembik I haven't tested this code

Ugh. Getting sick is the worst. :(

@Lembik you basically need to learn to grok the intrinsic names

5:31 PM
@DJMcMayhem Are you unwell?
I have never experienced this, being a bot having a good immune system.

`_mm256_sub_pd` means 256 bits vector, subtraction, packed doubles (so 4 doubles in 256 bits)
if you want to do more complex operations you basically need to scour the intrinsics guide / the internet to even know if the operation exists
stuff like doing operations within the same vector

@Riker it's a terrible post but I'm not sure it's actually breaking any rules

@Pavel Early depends on when you woke up, not the time of the day. I'm sure it's early in the morning somewhere.

@ais523 It's gone now.

looks like it got deleted anyway though

5:34 PM
@Lembik and there are a lot of things that you just need to... learn
for example, how do you multiply a vector by a scalar (like 2 in your example)
2 is a special case where you can add the vector to itself

@Dennis it's 12:34 am in hawaii

but otherwise you gotta make a vector that contains n copies of that element, and do a regular vector multiply

SE annoyances: you learn about people upvoting your posts via a `+10` or `+5` notification on every page until you've hit the rep cap from the day; from then on, you have to go into a specific tab of your profile to get the summary

@ais523 SE annoyances: you don't learn about people downvoting your meta posts.

So is Calesyta officially dead or what?

5:35 PM
@Fatalize Yeah, I haven't heard anything about it

@wizzwizz4 or upvoting, that's a problem too
@quartata I haven't heard from CALESYTA either

@orlp where does M appear in all this?

and the website has nothing but a favicon
which is zero bytes long, although available in GIF and ICO formats

it seems to have disappeared :)

@Lembik it doesn't appear

5:36 PM
it'd be nice to make the CALESYTA submissions public somehow/somewhere

this was just the example

I put mine up on Esolang, as did someone else
but I suspect there are lots I haven't seen

Well mine was Brachylog so it's already public

wait, Brachylog was a CALESYTA submission? wow
I didn't realise something that large would be submitted

5:38 PM
@wizzwizz4 unfortunately, yeah

I assumed you'd just done it over a long period of time as a golfing language

@ais523 It wasn't created for Calesyta

@DJMcMayhem :-( Do you know what the cause is?

ah, OK, that makes a bit more sense :-)

But nothing said it had to be created specifically for that

5:38 PM
I presume that you know the symtoms

indeed, but I decided to create one specifically, because it was actually a motivation to create a large spec, examples, a compiler, etc.
normally I don't bother with the examples or compiler, and often just write the minimum needed for the specification to be unambiguous

@ais523 The first version was in August 2015 (though it was terrible and the transpiler was in Java). The first full-Prolog version was in March 2016

@Pavel should've called your team `Team'); DROP TABLE Teams;--`
2

Something something Bobby tables

hmm, something I've noticed is that my Prolog answers (and presumably other peoples' too) tend to attract more upvotes than an answer of comparable difficulty/quality in another language (whether golfing or practical)
my guess is that it's because Prolog clearly wasn't created as a golfing language (it's crazy verbose), is fairly easy to read, and yet still somehow manages to look like magic

5:46 PM
It's also because it's not often used so it has a novelty factor

yes, answering first gives an early rush of upvotes but the effect doesn't normally persist past a few hours
the exception is if the post hits HNQ, in that case being the top answer at that point gives a post a lot of visibility, and thus a lot of drive-by upvotes
it doesn't necessarily have to be first but it does have to get an early run of upvotes

@orlp For people reading the transcript in future, this is the message being replied to.

It's on the starboard

@orlp ok.. should I convert M into this new structure do then?

For "Do X without Y", is it generally ok if those restrictions apply to command line arguments too? This challenge is generally what I'm referring to. See my comment for more context

5:55 PM
@ATaco At first I thought your avatar was a waffle-taco. lol

@Pavel But still... It won't be forever; like I AM BOT FEED ME BUTTER these things require context.

You know how they have waffle cones for ice cream?
Do that with a taco.
@Pavel Nice one. So there is an `i` in team.

Should I delete my post? codegolf.stackexchange.com/a/108109/61613 I didn't realize it wasn't a code-golf challenge when I submitted my answer.

Probably
Otherwise, work on making a fastest-code submission and edit your answer to be that.
But delete it until it's competitive.

@mbomb007 Ok, thank you.
What is the grace period to un-delete a post?

6:00 PM
@orlp But that'd remove your own team. You'd want a name where it truncates the table then inserts your team's name into it, leaving your team as the sole entrant.
2
@obarakon Forever.

@obarakon if you don't have enough rep to see deleted posts, the interface will only have an obvious way to do it for 60 days, but you can still undelete it any length of time later if you save a URL to the post directly; if you have enough rep to see deleted posts, then the interface will let you undelete your own post no matter how long you've waited

@ais523 Ah ok, thank you!

@MistahFiggins I guess where I'd draw the line is that if the command-line argument is interpreted as data or as executable code, it's cheating; if it's interpreted as options, it's OK. However I don't know if everyone would agree with me on that.

And if you can't find it, you could always ask someone in here to find it for you

@obarakon You'll be able to see deleted posts at 2K rep

6:04 PM
oh, this applies to self-deleted posts
if your post got deleted by someone else, then you need the help of two other high-rep users or one diamond moderator to undelete it

Yeah, but it will say that on the post.

(this is just to stop people just repeatedly undeleting their own terrible post, and it doesn't come up very often)
(because most deletions are self-deletions)

There *is* an operation that pushes it onto the stack backwards, but that's not generally used for printing. With a different string, It wouldn't be worth it, but my language name is "Del|m|t", and because of the "|"s, I can use "m" as a token separator. I think that the main point is that the argument serves a distinctly different purpose from what I'm using it for, and only works in this way because of the name of my language in particular (i.e. this method is extremely situational).
It does still feel iffy to use it in that way though...

@mbomb007 It's my own post. I was asking because I wanted to make sure I can un-delete it several hours later.

@MistahFiggins with really-close-to-the-rules situations like this one, normally I just end up posting them; the post nearly always ends up either heavily upvoted, or downvoted and deleted
and it can be really hard to guess which
however, it might be riskier to do that unless you have a bunch of positively voted posts, because otherwise there's a chance the SE software could misidentify you as a troll

6:10 PM
@ais523 FYI, you can change your esolangs user page to have a lowercase title. The "technical limitations" aren't there (anymore?). See esolangs.org/wiki/Huh%3F

Second question: I have another potential solution, should I include both in one answer? or make them separate posts?

@mbomb007 my username still starts with a capital letter, though; I could recapitalise the page but it wouldn't count
@MistahFiggins if the answers are related in some way (beyond same language), put them in the same post; if they're entirely different, put them in different posts even if they're in the same language

Hmm... They use the same method for printing, but other than that, they should be separate

that's different enough, then, I think

Yeah

6:14 PM
in fact, there have been a few cases recently where closely related answers have been in the same post despite being in different languages
5

Brachylog 1, 14 bytes :{\$pp~c:*ao}fd Try it online! Brachylog 2, 11 bytes, language postdates challenge {ḋp~c×ᵐo}ᶠd Try it online! Maltysen answered this question in 17 bytes of Pyth, so I came up with a 16-byte Brachylog solution that worked by translating the specification of the questi...

this is a good example, the two programs there are literal translations of each other, one in Brachylog 1, the other in Brachylog 2
I also have a different answer in Brachylog 1 on the same post, that uses a different algorithm

@ais523 Oh wait... I can't use "m" as a separator because it's in my language name :P

yeah, that challenge has a lot of random coincidences of letters going on
this sort of challenge is a good reason to golf the names of golfing languages in addition to the syntax :-D

@orlp thanks for all this

@ais523 The problem with that is that when you google "V" or "J" or even "'Jelly" you find everything but the language

@ais523 that's my challenge!

6:19 PM
I have another solution that pushes all the letters shifted a certain number (e.g. D -> A) that also uses the string as a command

@orlp it's a good challenge (and I was reminded of it when I ended up needing a list of multiplicative partitions on an entirely different challenge)
that said, my code there was rather shorter because I didn't need to limit them to occuring once each (it would have been more efficient if I did, but that'd have cost bytes, so…)

> does its best Jelly impression instead
:-D