3 ms·
You can write APL or J in a way that is readable. Part of the problem is that most people's exposure to array languages is in the context of code golf or leetc
by moeris 5y ago
You can write APL or J in a way that is readable. Part of the problem is that most people's exposure to array languages is in the context of code golf or leetcode-style problems.
In some areas, if you're familiar with the language, it's much more readable than other languages due to being more concise.
For example, if you wanted to calculate the sample standard deviation
```
mean =: +/ % #
sum_of_squares =: +/@:*:@:(] - mean)
stdev =: %: @: (sum_of_squares % <:@:#)
```
Is pretty readable, I think. Of course, of you don't know the primitives, then it doesn't look like it's readable.
(I'm on my phone, so I may have typed something wrong.)
- Jtsummers 5y agoTwo spaces in front of each line of code to make a code block, HN does not use markdown. (_ as spaces): __mean =: +/ % # Becomes: mean =: +/ % # Don't use the surrounding ```...``` because it just becomes noise, and you don't need extra newlines, two lines of code can be adjacent to each other if you prefix each with two spaces: line 1 line 2, no extra newline was used https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc - a very short document describing all the formatting options for HN comments. There aren't many.
- kragen 5y agoAlso, Markdown doesn't support ``` fenced code blocks; that's a common misconception. I don't know which Markdown derivative originated them (maybe GFM?) but they ended up in CommonMark.
- Jtsummers 5y agoNew Reddit (aka, Really Obnoxious Interface Reddit) uses that as well. Since Old Reddit is the only useable version of Reddit (IMHO), it's really annoying to see people make such extensive use of it as it gets butchered for Old Reddit users.
- moeris 5y ago> Markdown doesn't sorry ``` fenced code blocks There isn't a single markdown. There are many different flavors, and all of them are markdown. Many include ``` (GitHub, Kdoc, pandoc, reddit, commonmark), especially as it allows you to specify the language if you want. I actually don't know if any tool I use that doesn't support them.
- moeris 5y agoI appreciate the hint about code blocks. However, the point of markdown is to be readable without special rendering, so I really don't care that much. I also disagree about not using ```. It's useful when writing markdown in an interface that swallows whitespace.
- Jtsummers 5y agoExcept markdown is not easier to read if you clutter your comment (as I've seen other commenters here do) with something like: ``` foo bar baz ``` ``` note all the extra vertical whitespace because regular paragraphs get a slight gap ``` ``` let's throw in a third block for some reason ``` As code blocks: foo bar baz note all the extra vertical whitespace because regular paragraphs get a slight gap let's throw in a third block for some reason The former becomes a problem in the discussion because it clutters the space and is harder to read than the latter, especially when you have multiple blocks around the discussion (in one comment or spread out across comments). You may not care, but using code blocks that offer a more compact and clear expression is certainly more courteous.
- moeris 5y ago> You may not care, but using code blocks that offer a note compact and clear expression is certainly more courteous. I disagree, and so it's not likely "certain". I do think that nitpicking over formatting is rather unproductive and rude, though. And it had wasted considerably more space than a format that you happen to dislike, but that others are fine with. Like I said, I don't care. If you do, then that's on you.