5:01 AM
@rak1507 While a neat exercise, be aware that that isn't a good practice. It won't work with a non-scalar function, and the solution is bad. Look at the (long) conversation that follows this message.

5 hours later…
10:00 AM
Alright thanks
They seem to be discussing F¨ though, which is not what I was doing
{(⍺⍺¨ ⍵) / ⍵} is what they were arguing against, {(⍺⍺ ⍵) / ⍵} is what I had

@rak1507 Sure, but then what happens if you use a non-scalar decision function?

Why would I do that though

10:17 AM
For context, the problem was to try and find a 6 digit square number so the last 3 digits were 1 more than the first 3 (like 183184)
my solution was digit ← 1=1000∘|-⌊÷∘1000 ⋄ square ← 0=1|*∘0.5 ⋄ filter ← {(⍺⍺ ⍵)/⍵} ⋄ (digit∧square) filter 100000↓⍳1000000

10:28 AM
@rak1507 Sure, but someone might write a naive `filter←{((6=≢)∧(⍎3∘↓)=1+∘⍎3∘↑)⍕⍵}¨`

@Adám they could just as easily do that with using plain `/` though

@dzaima Yes, but then you see the `¨`

@Adám i see an `¨` in your filter definition too :|
@Adám (fwiw i think i do filter-by-function enough that it'd be worth some usability; `⌿` being usable in a train of `(f⌿⊢)` probably competes with my usage of `⍬2⍴` (and, respectively, annoyance of unusability in Dyalog); BQNs `f⊸/` is very nice)

@dzaima Yes, but (and I was using the wrong function name) that was to indicate that for an un-`¨`d function to work, the utility `filter` operator has to have a built-in `¨`.
@dzaima If we add `⍛` then `f⍛⌿⍨` isn't so bad.

@Adám (i assumed you were) if there were a filter built-in, it should not have the implicit `¨`. And when that's the case (assuming a single symbol for filter), there should be no case the `¨` is less noticable with it than with the corresponding `/`

10:34 AM
OK, that's acceptable.
Maybe I'd say filter (let's call it `⍁` for now) should be defined as `{⍺←⊢ ⋄ ⍵⌿⍨⍺⍺ ⍺}` so `X f⍁ Y` is filter Y by X and `f⍁ Y` is filter Y by Y.
Although, then it'd make sense to allow a constant instead of `f`, and then we have compress (as an operator ― that's what APL2 does) again :-)

@Adám well, if that still handled a function operand as filter, that'd be just fine :p

Having a maximum of two arguments seems quite limiting, for example, if I wanted to implement modular exponentiation, that would need 3 arguments. How should I go about doing this?

@rak1507 Normally, you'd take a vector of arguments. Alternatively, you can use an array operand.
Btw, tradfns can auto-enforce that their right argument is a vector of a specific number of arguments.

Alright cool

10:52 AM
@rak1507 E.g.:
```      ∇ r←PowMod(x y z)
r←x|y*z
∇
PowMod 3 1 4
1
PowMod 3 1 4 0
LENGTH ERROR: Right argument must be a vector of correct length
PowMod 3 1 4 0
∧```

11:06 AM
Ah nice
{(⊢×2*≢-⍳∘≢)2(⊥⍣¯1)⍵}
Is there a better way to get the binary components?
I feel like I'm overlooking something
Also can you increase the precision? Floating points are ruining my life
powmod←{(b e m)←⍵ ⋄ m|×/m|b*0~⍨(⊢×2*≢-⍳∘≢)2(⊥⍣¯1)e} well this sorta works

@rak1507 you can do `⎕FR←1287` to double the precision, but that's still floating point, just bigger
(you can use `123x` in NARS2000 (but it doesn't have `⊥⍣¯1`) or `123L` in dzaima/APL:)

11:26 AM

I saw, but it was a bit complicated and I thought it would be good practice to make my own anyway

Right, I figured.

12:18 PM
@rak1507 I'm not saying it is the best PowerMod ever, but you can take a look at what I wrote for the competition:
```PowerMod ← {
⍝ For integers (a b)←⍵ computes a*b mod ⍺.
(base exp) ← ⍵
0=exp: 1
m ← ⍺
bin ← ⌽2∘⊥⍣¯1⊢ exp
l ← ≢bin
powers ← l↑ {l≤≢⍵:⍵ ⋄ ⍵,m|2*⍨¯1↑⍵}⍣≡ base ⍝ extend the vector of powers to include all (base*2*k) needed.
{m|⍺×⍵}/ bin/powers
}```

12:40 PM
I am writing some code that is heavily matrix oriented
and involves plenty of linear algebra
and I need to keep track of plenty of matrices and column vectors to do maths with them... and I wanted to store them in efficient ways, but they all have varying shapes, so I don't really know what is the best way to handle them...

1:06 PM
Oh, this was a competition problem? Cool

@rak1507 under disguise, but yeah, pretty much

Phase 1 or 2? and which year?

@rak1507 this year's phase 2 had a problem on combinatorics
if you stripped it of unnecessary prose, it reduced to powermod
it is originally from rosalind.info
The "sset" problem, with the same name in the website above and the coding competition

1:25 PM
Oh cool, thanks, I'll have a look

1 hour later…
2:27 PM
the gamma function of n+1 is `!`
the gamma function of n is (!-∘1)n
26

Given a vector of n values (x1,x2,x3,...,xn) return the determinant of the corresponding Vandermonde matrix \\$V(x_1, x_2, \ldots, x_n)\\$. This determinant can be written as: \\$\det V(x_1, x_2, \ldots x_n) = \prod_\limits{1 \leqslant i < j \leqslant n} (x_j - x_i)\\$ Details Your program/function h...

how does the gamma function defined here work in APL?

@Razetime I don't understand. In the question you linked they don't talk about the gamma function

the pi function is a version of the gamma function right
This is what I got from a google: en.wikipedia.org/wiki/Gamma_function#Pi_function

Announcement: BAA Webinar Using SVG from Dyalog APL for animated visualisation begins in 25 mins. See details here.

@Razetime that "pi function" is actually a product
the set of indices under the pi gives it away
it is to the multiplication what Sigma is to the sum

ohhhhh
product of each

2:37 PM
@Razetime It should go to britishaplassociation.org/webinar-schedule-2020/

This site can’t be reached
britishaplassociation.org’s server IP address could not be found.
thats what im getting.
it's going to the right link

OK, the zoom link is zoom.us/j/858532665

@Razetime works for me :/

2:39 PM
haha nice
this ite aint coming up either

Have you tried turning it off and on again?

@Razetime something's definitely getting blocked on your end (but you are somehow here)

India blocks porn sites and the like
but i don't know why they'd do that with the british apl association

Well, there is something we call "APL pornography"…

Uhhhhhhhhhhhhhhhhhhhhhh
side note: it opened now
Ray's ant orld looks really cool

2:52 PM
We should have an APL Wiki article on pornography.

I'm willing to help write that
but what does it even mean
how does it work?!

It means completely unreadable APL code.

Outsiders have a lot of acess to it then

acess?

access

2:57 PM
@Razetime E.g. in the classic “APL – an Interactive Approach” by Gilman and Rose, the authors call `r←(+/x×y)÷((+/(x←x-(+/x)÷⍴x)*2)×+/(y←y-(+/y)÷⍴y)*2)×.5` “almost pornographic”.

why not just call it obfuscated APL?

Dunno, it has just become the normal lingo among APLers. Similarly, we traditionally call the dual function/operator nature of `/` "schizophrenia" instead of "hybrid".

@Razetime that's no fun

Ah I see
pornography it is then

Nearly missed the webinar, glad I just was able to join

3:07 PM
@Razetime :-D I'm beginning a new article on APL Wiki. MediaWiki shows the heading: "Creating Pornography"

how nice
Never seen any apl written like this
tbf I've never bothered to see any apl programs outside of code golf

I suspect a lot of people who reject APL for its "unreadable symbols" don't even know it has block structures and multiline functions, and only ever see "r←(+/x×y)÷((+/(x←x-(+/x)÷⍴x)*2)×+/(y←y-(+/y)÷⍴y)*2)×.5" because that's all that's put on the internet

How can I take an array like 1 2 3 4 and return 2-1 4-3
not quite n wise reduce

@rak1507 `-⍨/⍤⊢⌺(⍪2 2)`

3:26 PM
thanks

So I tried out the vandermonde thing
`{w←⍵ ⋄ ∊∘.-⍨⍉↑{w*⍵}¨⍳⍴⍵}`
is this a correct method of getting the matrix?

@Adám why don't i see it when i search for e.g. "creating"?

{×/-∊(⍳≢⍵)↓¨↓∘.-⍨⍵} computes the determinant @Razetime

Gotcha

can probably be golfed more

3:36 PM
but I'm tryna get the other formula instead of determinant
thats why theres inner product with subtraction

@matt 1) I've not saved it yet, 2) The page is called "Pornography" ― MediaWiki adds "Creating".

the question asks for the determinant though

@Adám 1) ah ok 2) interesting

brb gonna tell my friends I'm making APL porn

@razetime yesss

3:39 PM
@rak1507 which is equal to the product of the differences

Yeah, which is what I've done

also @Adám might i suggest changing it to "pomography" with an M just to confuse people

@rak1507 wow how does that work

outer product differences, and then drop the first 1, 2, 3... to get the unique pairs
then ∊ and ×/

cmc: scrape the APL orchard chat history for every time Adám has said "<primitive> is defined as <code>" and pull them all into a reference page >_>

3:43 PM
I thought the poers were needed for geometric prograssion
guess I was wrong

as soon as I saw the jelly answer I thought of outer product difference

Anyway, you can submit that

I have, but I bet it can be golfed more
doesn't work on TIO for some reason

@Adám sadly my goguardian system wont let me see the page >:(

3:46 PM
maybe I'm using some dyalog 18 only feature that I'm unaware of

because of the p**********

Oh, maybe I should rename the page. Any suggestions?

@Adám change the RN to M

Ah cool

3:48 PM
@matt a clbuttic problem with poorly designed censorship software.

maybe Adám knows a way to shorten it, looks pretty condensed so far

4:42 PM

not matt but I can

@all Feel free to add an "ungolfed" version of the first example.

@Adám One-liner is still redlinked in two places. Should be a different page from Readability, I think.

@Marshall Maybe it can be an entry on that page?

@Adám I don't think readability is the only interesting aspect of the APL one-liner phenomenon.

4:58 PM
Good point.

Was looking back through the stars and found this dyalog.com/2017-code-golf-challenge.htm, has anyone thought of doing something this again?

@rak1507 Do you have any ideas?
I thought of "the least amount of primitives to transform one given array into another given array".

That sounds good, or going with the previous one's style, 'least unique primitives to do insert given task here'

@Adám primitives as in distinct primitives or tokens?

could even do a scoring thing like number of primitives used × code length
lowest score wins

5:02 PM
@rak1507 that'd make more sense, otherwise the max score is 7

can everything be done in 7 characters?

@dzaima Probably primitives.

@rak1507 yep (and, more recently, golfed)

@dzaima Oh, no, I didn't mean unique.

I was thinking of some sort of ⍎ thing
⍎ with ⎕UCS and ⍴⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬⍬ maybe

5:05 PM
@rak1507 that gets you to 8

@dzaima Yes, with a restriction that you can't make assignments.

@Adám (and `⍎` obviously)

@dzaima Right, or simply prohibit character arrays (except as intermediary values).

still has a max score by writing some interpreter taking in a number array as a constant, but that'd prooooobably not be an actual problem

also how does mediawiki know how to syntax highlight apl?! that is amazing

5:09 PM
@dzaima (fwiw i think distinct×length is a pretty interesting idea, if not a bit too hard and giving too much advantage to brute-forcing)

is it just me or is dyalog.com/uploads/files/2017yeargame.txt corrupted or something?

so it does, thank you

You may be able to tell your browser it is Unicode. In Firefox, do Alt,v,c,u

(heh, `⎕` is misinterpreted there as `•` (sshhh ignore that `Ž` before it) - BQNs equivalent of `⎕`)

5:37 PM
Okay I showed APL to two of my co-workers today. Initially I asked if they have been doing code golf, then showed them the classic average function in APL (+/÷⍴) and challenged them to do it in shorter code
They haven't heard of APL (which was expected) but when they see (+/÷⍴) I was asked what programming language it is

@rak1507 Oh yea I should

That's cool that you showed APL to your co workers

@jimfan "apl, i just said that"

what did they think

5:40 PM
also... are the APLs here red or green?

@matt Red, green?

?

@matt How can APL be red or green?

it is a pun. "apl" --> "apple"

@rak1507 They weren't particularly interested by APL, so I teased them further with the classic V~V∘.×V←1↓⍳20
Via an email though, gonna chat with them again on Monday

5:44 PM
why not ∘.×⍨

@matt ;-)

the more funny symbols the better

@rak1507 yes

@rak1507 And I just found that ((+/∘∊)÷(≢∘∊)) can average arrays of arbitrary size / nesting!

(⊢~∘.×⍨)1↓⍳20

5:45 PM
Regardless of their shape, depth
@rak1507 By the way, the name "A Programming Language" seems to be interesting to them

@rak1507 we should really invent code anti-golf where you have to use a super long implementation

Why not (+⌿÷≢)∘∊?

@rak1507 Even better, golfer's spirit

@jimfan Traditionally both red (scroll way down) and green, but lately, Dyalog has added orange.

@rak1507 nice

5:47 PM
@matt code bowling?

@dzaima Bug (maybe regression?) in dzaima/BQN Select:
```   0‿¯1 ⊏ "abcde"
ae
0‿¯1 ⊏ ↕5
ImplementationError: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 5
0‿¯1 ⊏ ↕5
^```

@jimfan `(+/÷≢)∊` is enough.

@Adám I should have pointed them to this

ah yeah forgot you can just stick stuff next to each other

5:50 PM
@rak1507 YES exactly. lets think of an example challenge right quick just to see

longest expression to generate the number 1

But what's the upper limit? You can always just spam `⊢`s

without using 1 obviously
needs to be not trivially reduce-able

@rak1507 `≢≢≢≢≢≢≢``≢≢≢≢≢≡⍬`
@rak1507 Oh. I think there's such a challenge here somewhere.

What about to use all APL symbols in some way
or lots of them

5:54 PM
@rak1507 Like in the style of the traditional idiom for the meaning of life?

Don't think I've seen that one

Wow that's amazing
Yeah exactly like that

My father taught me that one when I was a little boy :-D

@Marshall specialization for integers forgetting about needing handling negative args. will fix

5:57 PM
Although, to make the challenge potentially harder, I'd say that ⍴⍋⍒,⍟?⍳0 evaluating to 0 is no better than just using lots of ⊢⊢⊢s, and therefore shouldn't be allowed
It would be a lot harder to come up with something with that restriction, but it would also be better in the end as well I think

@rak1507 How about requiring that no substring evaluates the same?

Yeah, every operation has to return a different result
And no intermediate results can be the final result

@rak1507 it is more than that. Otherwise `--------≡⍬` works.
@rak1507 Not only that, no intermediary result can appear more than once.

Yeah exactly

It is almost the same as the substring rule, but the substring rule is much easier state, and allows more interesting solutions.

6:03 PM
@Marshall pushed fix

@rak1507 otoh, it is easier to verify adherence to the intermediary results rule.

@dzaima That works.

I would say it should be fairly clear if someone's trying to bend the rules, and even if someone does something 'technically' allowed, it isn't in the spirit of the challenge

@dzaima (with that, there's minimal runtime benefit, at the cost of double the compile time)

43

Create a program that outputs Hello, World! The winner is the source code that is the biggest, subject to the constraint that it is irreducible For this challenge, irreducible means there does not exist a program that outputs Hello, World! that can be constructed by removing characters from the...

6:11 PM
@rak1507 Yup, that's the one. APL has a respectable score there.

Wow, bubblers answer there is absolutely mindblowing

2 hours later…
7:49 PM
<moon-child> @Adám multiline code blocks: yes, but won't be able to work on it for a few days due to unforeseen circumstances
@Razetime `# # # #`

moon-child: if you pull dyalog-safe-exec then the bot will gain a little capability.

About half way through a line by line transliteration of the BQN "old JS interpreter" into PowerShell. It's going to be fun to debug when it totally doesn't work.

@TessellatingHeckler That part is obnoxious. You just have to be patient though. There aren't that many components so pretty soon you'll fix the last bug and be done.

```⋄t←{×\⍳⍵}
t 5```

@Moonchild `1 2 6 24 120`

8:03 PM
`⋄ ⍎'1+2'`

@Adám `3`

`⋄ ⍎'⎕SH'`

@Moonchild Did you just add multi-line support a few minutes after saying you wouldn't be able to work on it for a few days‽ ;-)

hmm

8:05 PM
@Marshall Here's hoping!

@Adám . . . hmmm. I thought I sent that message two days ago, but it only shows up in the transcript 15m ago
the culprit was just a missing character, though; nothing major

8:25 PM
We'll be using dyalog-safe-exec in Try APL 3.0 ― it is almost ready. Just polishing content, and maybe adding a few niceties.

@Adám has there ever been an idea of a "Dyalog J" or K or other array language?

8:40 PM
anyone here have experience with kdb+ and q?

8:51 PM
@rak1507 you will probably have better luck asking that here

Ah cool thank you