mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,4 Tsd.
aktive Profile

#apl

2 Beiträge2 Beteiligte0 Beiträge heute

Kap marketing post

So, I saw Leetcode question 73, whose description is as follows:

Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's.

In most popular programming languages, something like this is somewhat annoying, forcing you to write some loops that kind of hides what you really want to do.

Even in Excel, I think this will be frustrating, but I'm not an Excel expert.

But if you think about it, if you create a new matrix that contains a bitmask where every cell is 1 where the original matrix contains a nonzeoro value, you can simply check if each row contains all ones, and then do the same check on each column.

Finally, we'll just multiply the new mask with the original matrix, which gives us the result we need:

{
mask ← 0≠⍵
rows ← ∧/mask
cols ← ∧⌿mask
sel ← rows ∧⌻ cols
sel × ⍵
}

Of course, the above is written out with temporary variables. In practice, I'd write it as a single expression like so:

{ ⍵ × (∧/)«∧⌻»(∧⌿) 0≠⍵ }

And of course, people will complain that it's unreadable and whatnot, but these two versions are equivalent, and the latter just takes advantage of the « and » symbols to combine functions.

If anyone has a problem they would otherwise use Excel or some python program to solve, share it with me to see if I can use it to show that Kap can be a better solution. 🙂

(and if I can't, that's even better, because then I have a reason to improve the software)

The 2026 round of the APL Forge is now open! See forge.dyalog.com for more information and to enter this annual competition, which aims to enhance awareness and usage of APL in the community at large by challenging participants to create innovative open-source libraries and commercial applications using Dyalog APL. The deadline for submissions is Monday 22 June 2026.

#aplforge#apl#dyalog

It's the final week to enter your submission to the APL Forge – the deadline is Monday 23 June 2024 at 12:00 UTC. This annual competition enhances awareness and usage of APL in the community at large by challenging participants to create innovative open-source libraries and commercial applications using Dyalog APL. For more information and to enter, see forge.dyalog.com

#aplforge#apl#dyalog

A brilliant talk from Aaron Hsu (not on Fedi, AFAICT) youtu.be/V8sACAhg4vM

I'm left wondering though, is his lack of satisfaction in types due to #APL having so few of them? I absolutely see the benefits of typing things more strictly, and at the same time fully appreciate the simplicities which come from abandoning them and working dynamically.

#lambdaconf is one of those confs I have massive FOMO over, so recordings are a must watch.