« first day (1273 days earlier)      last day (1371 days later) » 
03:00 - 14:0014:00 - 00:00

2:00 PM
@KrzysztofSzewczyk that does powers of 2?
2^N not N^2
 
@AndyS I installed the latest ride release from github. Works nicely
 
fn←+/2*⍨⍳
this should do
 
Nice!
 
@KrzysztofSzewczyk Right, or +/⍳*2⍨
@KrzysztofSzewczyk Do you know how comparisons like = and > work in J?
 
2:05 PM
yes
how does your version work?
> X (f g) Y is f X g Y
I can't see it happening there
 
      2 (- ×)3
¯6
      - 2 × 3
¯6
 
so due to this rule I get *(⍳2)⍨
but I still can't see how it works
 
@KrzysztofSzewczyk No, f←⍳ and g←* and h←2⍨
Remember that operators bind stronger than functions, so the first thing that happens is that binds 2 to become a function. Now the three rightmost functions are ⍳ * 2⍨ which becomes a function, and then we have the functions +/ (⍳*2⍨)
 
I still don't understand how does this ⍳ * 2⍨ bit work
reverses operands, but for which operator?
 
No, here has an array as operand, which produces a constant function. Compare to ⍳*{2}
Operators determine their behaviour by the type of their operand(s).
 
2:12 PM
I still don't get how does it work
so, obviously iota has to execute first
to get the stream of numbers
 
2⍨ is a constant function, i.e. a function that ignores its argument(s) and returns 2.
 
how does it get it's parameter when it's at the end
and iota is at the front
 
(f g h)Y is (f Y) g (h Y)
So (⍳ * 2⍨)Y is (⍳Y) * (2⍨Y)
 
oh damn ok
I now see it
 
@AndyS It would be a great help if this was documented somewhere.
 
2:22 PM
@KrzysztofSzewczyk Can you think of how to get the average of a numeric vector using only arithmetic?
 
yeah
this seems simple
 
@xpqz The RIDE User Guide is something I want to attack in the not too distant future (along with parts of the macOS User Guide). By default there's no security with RIDE, but at the other end of the scale you can use certificates at both ends to limit access .. and there's various other stages between.
 
f←+/÷≢
 
So I want to alter the guide so it shows the different options.
 
@AndyS let me know if I can help at all.
 
2:29 PM
@KrzysztofSzewczyk But if you couldn't use ?
 
In other words, define (for numeric vectors) in terms of arithmetic.
 
@xpqz Thanks for that .. I shall bear that in mind !
 
no clue
I don't know vector primitives for APL
do I know enough primitives already to pull that off?
I can't see it
possibly trying some form of an operator to turn the vector into sequence of ones and then sum it
but it makes zero to little sense
 
@KrzysztofSzewczyk Yes, exactly.
 
2:34 PM
You got it
 
what's the advantage of doing this over simply using a tally?
 
Oh, none. You should use normally. This is just an exercise.
 
ah, okay
I wonder what kind of operation can it be
 
There are a few options.
 
I don't think there's a single operation that can do it
 
2:38 PM
Correct.
 
at first I thought about i.e. >= 1 and then < 1
 
@KrzysztofSzewczyk Can you define a function f(x)=0 ?
 
z←{0×⍵}
not a tacit one
can't find a tacit version of this
 
That's good. Tacit would be 0×⊢
 
ah, alright
 
2:44 PM
Now can you modify that to return 1 instead?
 
well, that's just 1+0x(omega)
 
Yes.
 
how can I clean my environ
without restarting
 
)clear
OK, can you put it all together?
 
I'm not done yet
avg←{+/÷(+/((1+0×⊢)⍵))⍵} why no work.
      +/((1+0×⊢)1 2 3 4 5)
5
does
 
2:59 PM
Hang on.
 
tally←+/(1+0×⊢)
avg←+/÷ tally
this works
avg←+/÷(+/(1+0×⊢))
this works
avg←+/÷(+/1+0×⊢)
paren can be skipped
 
Good job!
 
so, what do I do now?
 
OK, so there's a built-in vector called ⎕AVU (don't worry about what it is for). You can type with APL-key+L. How many elements in `⎕AVU are greater than 100?
 
RGS
@Adám I remember doing this exercise :P
 
3:08 PM
it looks like code points of some sort
idk
maybe random data
 
Nic
tally←+/1⍨¨
tally←+.(⊢¨)∘1
 
@KrzysztofSzewczyk Indeed. But don't worry about it, you'll never need it for anything else than as semi-random test data.
 
     +/⎕AVU≥100
172
idk how do that tallys work
I don't know the builtins
 
Very good. What I wanted to demonstrate here is the APL way of using Boolean values for computations and other processing.
@KrzysztofSzewczyk The First one is very simple. It uses the "each" operator which takes a single function and applies it separately to each element of the argument(s).
 
ahhhhh I see
 
RGS
3:11 PM
@Nic +.(1⍨)∘1 is also interesting
 
damn
this one is so smart
 
The other ones are pretty crazy. Don't worry about those.
 
so, have you got something more for me
 
RGS
@Adám what about tally ← (+/=⍨) this one is worth caring about, no?
 
or do I find some excercises online
I think I may try solving some CGCC challenges with APL once I'm feeling more confident with it
 
3:13 PM
@RGS Yes.
 
ah, this one is smart too
because a = a is always 1
 
RGS
@KrzysztofSzewczyk :)
 
@KrzysztofSzewczyk Let's teach you "filtering". Given a Boolean vector B and a vector of values V, B/V removes all the elements of V corresponding to 0s and leaves those corresponding to 1s.
 
Nic
tally←+.*∘0
 
3:15 PM
hehe
 
I wonder how does that one work
 
RGS
@Nic this one assumes numeric vectors
 
hot take: n^0 = 1?
 
Yup. Same as +/*∘0
 
ah yes
 
3:16 PM
0^0 is still 1 in APL?
 
Any more, @Nic?
 
@KrzysztofSzewczyk here binds (or Curries) an argument to a dyadic function making it monadic.
 
I see
nice
reminds me of functional
 
@xpqz Tally←+.=⍨
 
what does this dot do
 
Nic
3:17 PM
@xpqz I'm trying to get rid of the + but I'm failing
 
@KrzysztofSzewczyk It is the dot product.
@Nic 1⊥=⍨?
 
I see
damn
that one is evil, how does it work
 
@KrzysztofSzewczyk Which one?
 
the one without +
 
=⍨ is the same as before, while 1⊥ evaluates to a normal number by treating it as digits in base-1.
Hey, even better: Tally←⊥⍨=⍨
 
Nic
3:19 PM
in ⎕IO←0 :
tally←⍳∘'a' ⍝ for numeric vectors again
 
ah! so it's like dyadic tally in J
 
@KrzysztofSzewczyk You mean / is?
 
no, the base thing
 
No, that's #. in J.
 
yeah
this one
so far I enjoyed APL
now I'm going to do this vector thing
 
Nic
3:21 PM
tally←⌈/⍳⍨ ⍝ ⎕IO←1
 
@Nic ,⍳⊂
 
@KrzysztofSzewczyk It's nice to see how quickly you're picking up the language used when talking about APL ! "evil" "beautiful", "dog's dinner" .. and you know when you've got a bit of code right because it just looks right !
 
Nic
@Adám nice one !
 
@Nic No, that's not right.
 
Nic
@Adám the Russel paradox idiom !!! worth a one-liner wednesday
 
3:23 PM
@Adám @AndyS - I just got a crash again, and this time I can see some more details, as using standalone RIDE
/Applications/Dyalog-18.0.app/Contents/Resources/Dyalog/mapl: line 126: 78154 Segmentation fault: 11  "${DYALOG}/dyalog" ${OPTS}
 
@AndyS I happen to like weird stuff
I find x86 enjoyable, sometimes I program Malbolge
 
@KrzysztofSzewczyk Can you extract all the elements from ⎕AVU that are less than 32?
 
I consider both languages quite beautiful on their own
@Adám Q: how do I filter stuff from vectors
 
10 mins ago, by Adám
@KrzysztofSzewczyk Let's teach you "filtering". Given a Boolean vector B and a vector of values V, B/V removes all the elements of V corresponding to 0s and leaves those corresponding to 1s.
 
3:25 PM
You should stay explicit for this one. Trying tacit will hurt.
 
(⎕AVU<32)/(⎕AVU)
that's it, isn't it?
 
It is. No need for that parenthesis on the right, though.
Announcement: Informal APL meet-up at meet.jit.si/APLOrchard in 2 minutes. Password is the result of +/3 8 1 8 in APL/J/K.
 
can I join just to listen?
 
Of course.
 
so, what do I do now?
 
3:30 PM
@xpqz Can you set the env var APLCORENAME=$HOME/myaplcore. Then try again. It might also be worth taking a look in /cores - that is if you have core file generation enabled. If you get a core file or an aplcore, we can take a look. Sorry .. been rather busy today - did you install the new 18.0 for macOS ?
 
@KrzysztofSzewczyk Let me give you two more functions: ⌈Y is Y rounded up, and X⌈Y is the maximum of X and Y.
 
I may try the APL competition or CGCC tasks later on
most probably I'm not solving a single task
but it may be interesting
 
@KrzysztofSzewczyk You know about the competition? Great.
@KrzysztofSzewczyk Can you write an IsDivisibleBy function?
 
@Adám Sure. I personally know some winners
 
@AndyS Hmm, I think my coredump setting wasn't persisted across reboots -- fixed. Will keep an eye out and let you know.
@AndyS Not yet upgraded to the SE version that @Adám notified us about today.
 
3:39 PM
f←{(⌊⍺÷⍵)=(⍺÷⍵)}
possibly not the greatest solution
 
That's good.
 
there's no modulus builtin?
 
There is: | (but it has the opposite argument order of ÷)
 
      f←{⍵|⍺}
      2 f 2
0
need to invert the output too
 
@KrzysztofSzewczyk Remember !
 
3:44 PM
but... it's impossible to make this one tacit
because it's not a monad
f←{0=⍺|⍨⍵} this one works
 
@xpqz Umm .. SE is Adam's name for what I released today - Issue 2. Once installed you should be running 18.0.38756.
 
but I see no point in doing so
 
@KrzysztofSzewczyk f←0=|⍨
 
OH so you can have tacit dyads?
I didn't know
 
@AndyS Roger that: Dyalog APL/S-64 Version 18.0.38756
 
3:51 PM
3 hours ago, by Adám
So, APL's rules for 3-trains are exactly like J's: (f g h) Y is (f Y) g (h Y) and X (f g h) Y is (X f Y) g (X h Y)
 
well, okay
I may need to memorize these
 
@KrzysztofSzewczyk If you know the monadic one, the dyadic one is simply with X on the left of the functions that take Y.
 
4:20 PM
Given a 3x3x3 cube (say), I'd like to generate a 3x3 matrix where each element is the z-index of the layer holding the lowest number for that point.

For example, given
v←{3 3⍴10?10}
m←↑(v⍬)(v⍬)(v⍬)
      m
┌┌→──────┐
↓↓ 4 2  8│
││10 1  3│
││ 7 5  9│
││       │
││ 9 2  3│
││10 7  6│
││ 1 8  4│
││       │
││ 7 1  2│
││ 8 6  4│
││ 3 9 10│
└└~──────┘
I'd be looking for
┌→────┐
↓1 3 3│
│3 1 3│
│2 1 3│
└~────┘
Finding the values is ⌊⌿m, but how can I find the indices?
⌊⌿m
┌→────┐
↓4 1 2│
│8 1 3│
│1 5 4│
└~────┘
A sort of grade-up for each point along major axis
 
ngn
@xpqz so you want ⊃⍋ for each column (vector along first dim)?
(⊃⍋)¨↓[0]a should do it. (⎕io←0, always!)
 
@ngn yes! Exactly that. APL <3 Thanks!
 
4:51 PM
@xpqz (⊢⍳⌊/)⍤1⊢3 1 2⍉m or ⊃∘⍋⍤1⊢3 1 2⍉m i.e. move the leading axis to the end, then apply on vectors.
 
Ah, my old friend dyadic transpose.
 
Hm, interesting. ⊃⍤⍋ seems much faster than ⊃∘⍋
 
5:18 PM
I need help: ⍳ 2 2 will produce me a matrix
 
@KrzysztofSzewczyk Yes, not like in J.
 
now, I want the contents of this matrix to be divided
like ((1 1) (1 2) (2 1) (2 2)) => (1 0.5 2 1)
I tried twiddling the ranks but it doesn't seem to help much
 
@KrzysztofSzewczyk I don't get the pattern.
 
it just seems to divide distinct elements inside the matrix by one
fixed with parens
I'm very close to answering a CGCC challenge
but I can't figure this one out
 
@KrzysztofSzewczyk Ah, you want to "insert" ÷ into each pair.
 
5:20 PM
yes
 
Translate "divide-insertion on each"
 
÷/
idk about insertion
 
How do you insert + between the elements of a vector?
 
I.e. how do you go from 3 1 4 1 5 to 3+1+4+1+5?
 
5:23 PM
+/
 
Right, so now you just need to do that on each. Remember the each operator ¨ ?
 
ohhhhhh
I forgot about it
nice cool thanks
 
Alternatively, you can increase the rank (at the cost of depth ― nestedness) using monadic : ÷/↑⍳2 2.
 
5:38 PM
this may be stupid: how do I take first element of a matrix
 
@KrzysztofSzewczyk First element meaning the top-left corner, or the first row?
 
topleft corner
 
There's a function literally called "first": ⊃m
 
oh damn
I'm blind
behold, worst APL code you will ever see: f←{⊃((0=|⍵-÷/¨(∘.,⍨⍳⍺*⌈⍵))(/⍤1)(∘.,⍨⍳⍺*⌈⍵))}
I think I can pull off ∘.,⍨⍳⍺*⌈⍵ to another symbol
 
@KrzysztofSzewczyk This may be a good time to introduce you to APLcart.
 
5:40 PM
to save some space
 
@KrzysztofSzewczyk I think you can get rid of a lot of parentheses.
 
what to do with ∘.,⍨⍳⍺*⌈⍵?
 
Well, yes, you could give it a name.
 
is it the only option?
 
No.
 
5:43 PM
f←{⊃(0=|⍵-÷/¨∘.,⍨⍳⍺*⌈⍵)(/⍤1)∘.,⍨⍳⍺*⌈⍵}
parens dropped
ah crap, doesn't work
 
I think f←{⊃⍺/⍤1⍨∘(0=∘|⍵-÷/¨)⍨∘.,⍨⍳⍺*⌈⍵} can work too, but I really need a test case to confirm.
@KrzysztofSzewczyk Can you give me a pair of non-trivial argument?
 
10 f 0.25 works
8 f 1.21 doesn't
 
@KrzysztofSzewczyk f←{⊃(/⍤1)⍨∘(0=∘|⍵-÷/¨)⍨∘.,⍨⍳⍺*⌈⍵} is equivalent, but f←{⊃t/⍤1⍨0=|⍵-÷/¨t←∘.,⍨⍳⍺*⌈⍵} is much shorter.
 
no point in golfing this one
because it's broken
and I have zero idea why
lmao
 
@KrzysztofSzewczyk Sure; as an exercise.
May I suggest the competition's phase 1 (also from previous years) as training problems?
 
6:05 PM
I will take on them
I can't really read APL so I guess all I have left is starting from scratch
again
 
@KrzysztofSzewczyk Reading golfed code isn't really normal. Try to keep your code clean. Maybe adopt a style guide. Here's my personal one.
 
@KrzysztofSzewczyk - If you're learning APL from scratch, talk to @Adám (who is very helpful), and look into getting copies of Mastering Dyalog APL by Bernard Legrand, and possibly APL: An Interactive Approach by Leonard Gilman and Handbook of APL Programming by Clark Wiedmann. The Gilman and Wiedmann books focus on older versions of APL, but are still valid for basic language information (they also include information about using systems, which is definitely outdated).
 
@JeffZeitlin Um, he's already talking to me.
 
:)
Yeah, after doing a refresh, I see that - your icon/avatar wasn't showing up, so I sorta missed that he was talking to you.
 
 
1 hour later…
RGS
7:23 PM
@KrzysztofSzewczyk A thing I can recommend is Rosalind's problems, APL suits them nicely
 
@dzaima/BQN overtake on multiple axes seems to be reversing the input shape. Take a look at 6‿7↑↕4‿3.
 
@Marshall the result of me doing weird stuff to allow for short left argument. fixing
..i could just use the result shape instead of dealing with the raw 𝕨 ah right, negative numbers. still probably easier to extend
eh, fixed by removing pointless reverse. ¯\_(ツ)_/¯
 
7:39 PM
@dzaima Now the rank extension is failing, for example 1‿4↑↕3.
 
ಠ_ಠ
right, that's proobably why the reverse was there
maybe fixed?
 
@dzaima Works well enough if I add some s. Here's a page with my new array formatting style. And one with a rank-3 array.
@dzaima Yeah, that fixes the formatter.
 
@Marshall reusing the proper ⟨⟩ for non-syntactically-correct array notation doesn't feel very nice
 
7:56 PM
@dzaima Yeah. I guess I could use ⌜ 1 2 3 ⌟ but the corners don't seem to be big enough.
 
(still find the corner formatting a bit weird)
 
⌈ 12 15 18 ⌋ makes it too hard to distinguish opening from closing.
 
@Marshall (plus containing the function would be weird)
 
The main idea is just to be consistent about never putting dividers between elements, instead of having them in general but just using spaces for all-number or all-character arrays.
Oh, there are big versions of floor/ceiling. ⎡ 12 15 18 ⎦ looks pretty good.
 
@Marshall Just be careful as they touch the bottom and top edge (they are multi-line bracket segments).
 
8:08 PM
┌─
╵ ⎡ ⎡ 0 1 ⎦ ⎡ 2 3 ⎦ ⎦     ⎡ ⎡ 4 5 ⎦ ⎡ 6 7 ⎦ ⎦     ⎡ ⎡ 8 9 ⎦ ⎡ 10 11 ⎦ ⎦
  ⎡ ⎡ 12 13 ⎦ ⎡ 14 15 ⎦ ⎦ ⎡ ⎡ 16 17 ⎦ ⎡ 18 19 ⎦ ⎦ ⎡ ⎡ 20 21 ⎦ ⎡ 22 23 ⎦ ⎦
  ⎡ ⎡ 24 25 ⎦ ⎡ 26 27 ⎦ ⎦ ⎡ ⎡ 28 29 ⎦ ⎡ 30 31 ⎦ ⎦ ⎡ ⎡ 32 33 ⎦ ⎡ 34 35 ⎦ ⎦
  ⎡ ⎡ 36 37 ⎦ ⎡ 38 39 ⎦ ⎦ ⎡ ⎡ 40 41 ⎦ ⎡ 42 43 ⎦ ⎦ ⎡ ⎡ 44 45 ⎦ ⎡ 46 47 ⎦ ⎦
                                                                          ┘
Here there's some spacing, but it might be hard to read without any (which is how the docs display). Not sure.
 
Care to explain the "dripping" top left corners?
 
@Adám The number of extra segments is the number of axes displayed vertically (rank minus 1). A dot indicates no axes.
 
Ah, so like the s of ]display
How would you show 1 1 1 1⥊1?
 
┌─
┆ 1
    ┘
It goes up to 5 that way. After that you get a number at the top:
┌─6
┊ 1
    ┘
 
I see.
 
8:17 PM
Should probably be one over to the left, but it doesn't appear in any docs so I haven't worried about it.
 
@Marshall With all my goodwill, I have no idea what that array is.
 
@Adám a matrix of 2-item vectors of 2-item vectors of numbers?
 
@dzaima That one.
 
Hm, maybe I'm just not used to seeing ⌈⌋ as an enclosing pair like [] and () and {}.
 
@Adám it's just like the outer corners, just that the |s overlap in vertical space
 
8:23 PM
@Marshall What if the elements of the matrix were 1-by-2 matrices?
 
@Adám Then you'd get the full corners, so each one would be three lines.
There's also a nesting depth limit of 2 for the one-line representation.
 
@Marshall visually any improvement is only at depth 3, 2 just gets some funky corners
(also the fact that precisely every other character is a space doesn't help at all)
 
@dzaima 2 is a little too high, but I think 1 is much too low. I'll see if I can figure out where to put ligatures as they're definitely better in this case.
Another BQN thing is a new keyboard layout I'm working on:
 
8:38 PM
@Marshall aa ¯ pushed more to the right
(not that i have any clue where better to put it)
 
@dzaima aa?
 
@Marshall weak screams of pain
(though i guess it's now right enough for my right hand to be able to click it together with altgr comfortably, which is probably better than on 7)
 
Yeah, this layout should be easier to type with because I vacated a lot of the middle keys.
I find the middle keys hard to remember too, so 9 is much better than 7 for me.
on the space bar; that isn't shown.
Definitely adding ˝; ↙↖ are characters I might use for load/store in the compiler, and ⍎⍕ are just there for dzaima/BQN but I'm sure I'll probably have some primitives for that sort of functionality.
Wonder if I should swap ¨⚇ and ˘⎉? Then "one curve, two dots" would be a mnemonic.
 
(i had completely forgotten i put · on space, and have always just copy-pasted it..)
@dzaima (space because is <space><tab> in canvas)
 
 
2 hours later…
RGS
10:37 PM
Just to be sure, is it safe to assume the things whose weights we need to compute are always uppercase latin letters? i.e. ⎕A?
(Lol, I forgot the context. I am talking about the last problem of the APL competition, the mobile problem.)
 
10:59 PM
I'm making BQN's monadic = be Rank (i.e. returns the rank of the argument, or 0 if it's not an array). Obvious choice of symbol, and something that's more basic than the shape should really have its own primitive.
 
11:49 PM
Rank (=) and Insert (˝) are now added!
 
03:00 - 14:0014:00 - 00:00

« first day (1273 days earlier)      last day (1371 days later) »