« first day (1286 days earlier)      last day (1351 days later) » 

6:33 AM
@Bubbler Nice, but there aren't actually any posts containing APL code, are there?
 
@Adám No posts yet, but Michael Baas has many comments using APL.
 
 
3 hours later…
9:05 AM
@dzaima - What are the benefits of starting with zero (a) in the real world, and (b) in writing code to solve real-world problems? So far, the only advantages I've ever seen are for lazy language implementors.
 
@JeffZeitlin Some algorithms do become simpler with ⎕IO←0, especially involving abse conversions and selecting between to choices based on a condition. E.g. it is nice to be able to write condition⊃'false' 'true'
 
ngn
@JeffZeitlin not having to subtract 1 from indices means simpler code and better performance. laziness is a virtue here.
 
OK, that's a partial answer to b - and [most implementations of] APL offers me the option to set ⎕IO, whereas there seems to be a segment of the community that believes that it should not be an option, and ⎕IO should be forced to 0.
@ngn - I said real-world problems, not working around implementation dependencies.
 
ngn
@JeffZeitlin is performance not a real-world problem? and software complexity?
 
@Adám not that I disagree in the general case, but a proper conditional syntax would take care of that easily. (or even allowing guards inside parentheses, which is not difficult)
 
9:14 AM
One of my biggest beefs about zero-origin languages is that if I want the last element of the array, I can't just use array[array.count] to get that last element, I have to compensate for the zero origin.
 
Performance and complexity are not real-world problems in themselves; they are the result of using tools that are suboptimal for the problem that they are being used to solve.
 
ngn
@JeffZeitlin well.. yes. exactly. apl is supposed to be fast. why do the suboptimal ¯1+ on indices then?
 
@ngn apl is supposed to be expressive. Speed is a happy accident, but I wouldn't begrudge it slowness if I had to choose.
 
9:22 AM
Most agree that a globally settable ⎕IO is a bad thing. Maybe it would have been better to keep the original Iverson Notation, ⍳₀/⍳₁, ?₀/?₁, ⊃₀/⊃₁,…
 
so ⍳_1, ⍳_0 is nice and all, but imo a general solution should allow for ⍳_0.5, and maybe even ⍳_⎕io... :)
 
@ngn - I note that most implementations of APL allow me to set ⎕IO to whatever happens to be the most sensible for the particular problem at hand.
@Adám - I agree that global setting of ⎕IO is ... unwise. I thoroughly approve of being able to localize setting it to a function.
 
@JeffZeitlin A.k.a. most APLs allow functions calling each other, each using their own ⎕IO. Tell me, which ⎕IO is used if a ⎕IO←0 function calls a function that's defined in a ⎕IO←1 namespace, but doesn't set its own ⎕IO?
@JeffZeitlin Well, it is a matter of scope. Dyalog gives ⎕IO namespace scope. Alternatives include function scope and primitive scope.
 
ngn
@Moonchild is ⎕io←1 more expressive?
@JeffZeitlin now that's an interesting argument. do you also think that (+)←{...} should be possible? like change the definition of + to whatever makes sense for the problem at hand?
 
@ngn I don't think so. But I also don't think 'it gets you more performant code' is justification for a design choice in a language such as apl. Especially since the performance hit isn't pathological or algorithmic
 
9:32 AM
@ngn Right, essentially ⎕IO lets you redefine a bunch of primitives. You have to change them all at once, and in a consistent manner, but still. ⎕ML is the same.
 
@Adám ⎕ml is also a mess :)
 
ngn
@Moonchild performance is very much a consideration when designing primitives. ask dyalog.
 
@Adám - I believe in what I guess is best called "block scope" - that is, if I were writing in Pascal, anywhere the language defines a 'block', I can localize variables. If I don't localize variables, they are inherited from the enclosing block - but libraries are not considered enclosed by the calling block.
@Adám - In a Dyalog-like context, if I'm )COPYing functions from a workspace where ⎕IO is set differently from my current workspace, I would want the )COPYed functions to carry their own ⎕IO setting - and any other relevant system variable settings.
 
@ngn dyalog implemented a language that lets you set ⎕io←1, though
 
ngn
@Moonchild they had no choice in the beginning. they were following a spec.
 
9:36 AM
@Moonchild Heh:
      _0←{⍺←⊢ ⋄ ⎕IO←0 ⋄ ⍺ ⍺⍺ ⍵}
      ⍳_0 6
0 1 2 3 4 5
      ?_0⍨ 6
4 5 1 2 0 3
 
@ngn - There is a difference between system variables, like APL's ⎕IO, and primitive functions, like +. Changing the definition of language primitives is less defensible than being allowed to change system variables.
 
@JeffZeitlin System variables are exactly that; changing primitives.
 
ngn
@JeffZeitlin "less defensible" - how so? i've just used the exact same argument for both situations. have i missed some important detail?
 
@ngn - That is, in fact, one of the things that I don't like about operator overloading in languages like C++; there are no limitations on what you can make the operators do.
@Adám - I disagree: At best, you are changing a parameter to function primitives.
 
@JeffZeitlin Well, a parameter can change everything. See ⎕ML!
 
9:45 AM
IIRC, ⎕ML is the one that makes Dyalog act like APL2 in various contexts, correct? While syntactically it's a system variable, semantically, I think it's more like a metacommand, like FreePascal's $MODE.
 
Sure. I guess even HTML and Perl7 have that.
 
Now, admittedly, APL seems to blur the line between 'system variable' and 'metacommand' somewhat, and that may contribute in a small way to the 'APL is hard/confusing' mentality. I don't find it so; I am willing to admit that (a) my perceptions are not necessarily 'normal', and (b) I have a trick memory that gives me a better shot at 'keeping things straight'.
And I do not like the color of the sky in my immediate vicinity. It has no business carrying the slightest tint of green at 0555 when there is no reported storm activity in the area.
 
@JeffZeitlin Can you not simply change ⎕SM?
 
@Adám - It would be nice to be able to do that, wouldn't it? :)
 
ngn
fun fact: in japan the sky is always green because they use the same word for blue and green :)
 
9:59 AM
Getting back to the question of ⎕IO... I actually think that it matters less in APL than it does in other languages; in other languages, zero vs one origin confuses the issue in iterating (generally over an array); APL allows me to perform operations on every element of an array without explicitly iterating. Where it is more likely to matter in APL is in slicing an array.
Part of that is because the way the human mind tends to work confuses cardinal indices with ordinals.
@ngn - So is the sky really green? Or is it blue? Or perhaps bleen, or grue?
(It is pitch dark. You are likely to be eaten by a grue...)
 
ngn
@JeffZeitlin a japanese person would say "what's the difference?"
 
@ngn Not true. Japanese does have word for the "shade of blue-green" we call "green" in English.
 
ngn
@Adám bleen-grellow? :)
 
@Adám - I was actually doing some conlanging with some friends a while back, and he found a reference which actually discusses which terms for colors a language typically has, if it has n color terms.
 
@ngn No, 緑 (leaf-colour) and グリーン (lit. English "green").
 
10:06 AM
It was interesting. You "start out" with two, essentially "light" and "dark"; the third term is almost invariably "red", and I don't remember the progression from there. Blue/green is a fairly late distinction; I don't remember whether it comes before distinguishing red/yellow/orange or after.
 
@JeffZeitlin Maybe the third would be "coloured" as opposed to on the neutral white-grey-black line.
 
@Adám - No, it was definitely focussed on "red"; at that stage, blues and greens were still (usually) "dark".
 
 
@Adám - Yes, that looks about right.
 
I was about to say that I think Hebrew has a lot of colour distinction. Well, colour me (un)surprised:
> Today every natural language that has words for colors is considered to have from two to twelve basic color terms. All other colors are considered by most speakers of that language to be variants of these basic color terms. English contains eleven basic color terms: 'black', 'white', 'red', 'green', 'yellow', 'blue', 'brown', 'orange', 'pink', 'purple', and 'grey'. Italian, Russian and Hebrew have twelve, distinguishing blue and light blue.
 
10:12 AM
So in Hebrew, light blue is not considered to be a variation on blue? Interesting.
 
ngn
"cyan"
 
BBIAFM; I just realized I left something in my car over the weekend, so I'm going to go bring it in now.
Retrieved
 
 
1 hour later…
11:32 AM
@JeffZeitlin Do you know the name for a musical interval made up of two octaves? Do you know the number of the decade we're currently in?
 
Two octaves is a fifteenth; the decade is the third decade of the twentieth century. Yes, it's counterintuitive because there's no year zero.
Excuse me. Twenty-first century
 
Haha
 
@JeffZeitlin I rest my case.
 
If I work from day 2 of the week (Monday) until day 6 of the week (Friday), how many days do I work per week?
 
Actually, we're in the second decade of the twenty-first. The third starts next year.
 
11:36 AM
Point taken, Marshall
@Adám - Five - numbers 2, 3, 4, 5, and 6.
Which, as I recall, are their actual names in Hebrew...
 
@Adám BQN, 1 byte: ¬
 
11:51 AM
@JeffZeitlin my personal reason is mostly that multiplication, division, and modulo by a number (also occasionally adding & subtracting two indexes) are meaningful operations, which allow for doing math with indexes (without pain). No array[array.count] is probably the most annoying thing about it, but that's easily fixable by just having a function to get the last item of the array (contrary to 3+ new functions for index-sane ÷×|)
(i'd want a function for last item either way; nth item from end is ugly in both ⎕IOs)
 
… but not in ⎕IO←0.5
 
@dzaima - This is where I like a hack that's built into PowerShell (which is a zero-origin language) - if you index into an array with a negative number, it's the same as one-origin indexing from the end of the array - that is, array[-1] is the last item in the array, array[-2] is the next-to-last, usw.
 
@JeffZeitlin They snuck it into BQN too somehow.
 
That doesn't work in Pascal-family languages, where I can define the index range arbitrarily, though.
 
@JeffZeitlin While that makes sense in the modulus sense, it sure is confusing.
 
11:57 AM
@JeffZeitlin i wouldn't call it a hack, since it's pretty much the only sane way that could work due to modulo being sane and useful, and keeping those qualities with that extension
 
@dzaima - If it was symmetrical with "forward" indexing, I wouldn't call it a hack - although that would require the alternative hack of zero being signed.
(And it still wouldn't work in Pascal-family languages)
 
@JeffZeitlin right, not being able to negate the index for indexing from the reverse is unfortunate. (and of course it won't work with variable arbitrary ⎕IO) You can't have both modulo sanity and negating sanity outside of ⎕IO←0.5, but 1-x isn't that bad (plus, that's equal to bitwise negate if you're feeling like that needs to be shorter)
(personally i'd still prefer a separate function to get the nth element from end instead of negative indexes, regardless of ⎕IO)
 
@dzaima Especially if you have a built-in for 1-x: ¬
 
@dzaima whoops, 1-x there should be ¯1-x (yay for off-by-sign errors)
 
@dzaima :-D There goes the primitive too.
 
12:07 PM
@Adám yep. logical and bitwise not can't be the same char (unless ¯1 is a the truthy value)
 
@dzaima In ⎕IO←1 with wrap-around indices, you can swap direction with ¬.
@dzaima Ah right, I remember the horrors of BASIC.
 
 
2 hours later…
2:01 PM
one of my answers to the competition Phase I questions, number 5 (stepping) is:
{⎕IO←0 ⋄ ⌽⍣(>/⍵)⊢(⌊/⍵)+⍳1+(⌈/-⌊/)⍵}

and it uses reverse with power (>/⍵) which should return 0 or 1 to know whether it's counting up or down, and that works
but if it says
{⎕IO←0 ⋄ ⌽⍣>/⍵⊢(⌊/⍵)+⍳1+(⌈/-⌊/)⍵}
without the parens around the test function, then Dyalog 17.1 goes into an infinite loop and locks up.
it must be being parsed differently, but I thought the use of ⊢ would separate the "power parts" from the rest?
 
@TessellatingHeckler that's parsed as ((⌽⍣>)/) ⍵⊢ … (i.e. reverse-until-current-greater-than-previous reduce)
 
@dzaima hooo okay, a surprise parse out of left field, presumably ⍣ binds more strongly than /
 
@TessellatingHeckler Operators bind from the left.
 
the right operand of a dyadic operator is always a single token or parenthesized thing, and as you've removed the parenthesis, > is the token immediately to the right of and becomes the operand. isn't some magic thing that separates things, it's just a predefined function equivalent to {⍵}
 
ngn
can anyone shorten? p1←(0>⊣)⌽↑,⍥⊂↓⋄p2←⊢⊂⍨2≠∘⌊÷∘64⋄p3←26⊥1+⎕a⍳⊢⋄p4←80∘∨>50∘∨⋄p5←⊃+(⍳1+∘|-/)ׯ1*>/⋄p6←∩⍨,~⍨⋄p7←(×/≤/)2⊥⍣¯1,⋄p8←×/0>2×/2-/10⊥⍣¯1⊢⋄p9←⊢≡⌈\⌊∘⌽⌈\∘⌽⋄p10←↑∘⊃,.{↓⍉⍪⍉⍕⍵}⍨
 
2:11 PM
that all makes sense, thanks :)
 
@TessellatingHeckler when trying to parse deriving operators (and only operators), adding parenthesis from the left always works (keeping in mind the single-token-or-parenthesis rule) - e.g. f∘g/¨∘h¨ is (((((f∘g)/)¨)∘h)¨)
 
ngn
@dzaima you missed a pair around f∘
 
Also around (((f∘g)/)¨)∘ then.
However, then the code won't run.
 
ngn
@Adám is that a bug?
 
@ngn f∘ isn't valid syntax; it's why i mention the need to include the token to the right of dyadic operators
@ngn (+∘) just isn't APL syntax
 
2:14 PM
@ngn No, it was a conscious decision. However, Roger has lately questioned it.
 
ngn
ah.. ∘g works, not f∘
 
@dzaima Sure it is, but the problem is that if we allow it, the secondary operand needs to move to the left. Compare to (+∘2)3
 
@Adám ok, isn't valid current APL syntax :p
 
@dzaima Is isn't currently allowed by any interpreter I know of.
 
2:20 PM
@dzaima single token to the right, right! keeping that in mind will help
I was a bit surprised @ngn's "move to front" answer yesterday works, the one based on set intersection; the surprise is that the output of 1 2 2 3 ∩ 1 2 3 has duplicates in it (and so isn't a set)
the tooltip for ∩ doesn't explicitly say set intersection, that was my assumption
 
@TessellatingHeckler i think of it as ~ but with "negated"
it happens to also be usable as set intersection on sets, but it can be quite useful outside of sets too
 
@TessellatingHeckler is defined as {(⍺∊⍵)/⍺}
 
ngn
@user41805 right, first i had doubts about its correctness, but looks ok according to the way dyalog have phrased the problem
 
@dzaima i think of ~ as boolean-not; haven't seen as many uses of "without".
 
@TessellatingHeckler Dyadic ~ is "[but] not" i.e. without.
 
2:28 PM
cmc: golf phase 2
 
!
 
@Adám but⍛not (with ⍛←{(𝔽𝕨) 𝔾 𝕩} and BQNs handling of nothings) :p
 
ngn
@user41805 hm.. hang on
 
@user21911 Hi. If you want to participate here, email me: adam@ with the same domain as www.dyalog.com
 
@Adám a neat mnemonic
 
2:31 PM
@dzaima What are but and not?
 
ngn
is 'ab' a vector of simple arrays?
 
@Adám english words, what else?
 
Don't get it.
@ngn In APL? Yes.
 
ngn
@Adám @user41805 so @Ada's solution is wrong because it renders it differently from {⎕←⍵}¨'ab'?
 
Ada
What?
 
2:35 PM
@ngn Ah man, how did I miss that edge case‽
 
ngn
@Ada this
 
SE chat trying and failing to be helpful:
 
Ada
Yikes.
 
Don't worry about it. It doesn't actually ping me. Just a formatting bug.
 
Ada
Ah, okay.
I have no clue why it would do that, though.
 
2:41 PM
Software has been known to have bugs.
 
@Ada first 3 letters of a name matching in an @ is enough for SE to consider it a ping. Apparently there's a discrepancy between the highlighter and notifier though
 
@dzaima If a current user has an exact match, it doesn't ping the others. I didn't know it ignored diacritics, though.
 
ngn
but i meant to ping both of you (the three of you, actually)
 
@ngn Not here:
8 mins ago, by ngn
@Ada this
 
ngn
ah.. i see
 
Ada
2:45 PM
It might have been because it's a reply?
Wait, never mind.
I misread
 
3:18 PM
@ngn Oh well, we never promised that the test cases where exhaustive. This will be a nice tie-breaker.
 
ngn
@Adám as far as i'm concerned, this edge case is not something significant
 
@dzaima Uh oh, that sounds like Marshall's new "non-array simple scalar" mindset had undue influence. Will fix.
 
(i'm more leaning towards simple scalars being simple arrays, but the term is mostly pointless anyways)
 
@Adám That would be an anachronism. The only problem is that it should say "1 or less", right?
 
3:25 PM
@Marshall I've inserted a link to "simple scalar".
 
@Adám There's already a link to simple scalar.
 
Oh, right, but I still think the paren is warranted.
 
@Adám - Really? I never would have guessed ... :)
 
@ngn Right, I'm only using it as a last tie-breaker, after everything else.
 
Ada
3:43 PM
Good luck to everyone who competed in the competition!
 
@Ada That's a bit late now, isn't it?
 
Ada
Whoops.
 
 
3 hours later…
RGS
6:23 PM
@Adám for P1 prizes? Is that what you mean?
 
Ada
Hopefully for P1 prizes.
 
RGS, Ada, did you share your competition answers?
 
RGS
6:40 PM
@TessellatingHeckler not yet; I'm currently on a short vacation. In ~48h I'll get to it, took a peek in here just because
 
@RGS Right.
 
@Adám thinking of ngn's suggestion of collecting people's shared competition answers into a web page, would Dyalog be OK with that, or are they now copyright of Dyalog or etc.?
(not that I'm asking for an official legal answer, but "we're planning to publish them on our blog" could be a good reason not to)
 
Ada
7:06 PM
I've shared one of my answers.
 
@TessellatingHeckler We are going to publish something. Not sure exactly what, yet.
 
7:29 PM
@Adám fair enough
 

« first day (1286 days earlier)      last day (1351 days later) »