« first day (1640 days earlier)      last day (1017 days later) » 

3:49 AM
Anyone have a shorter (or more idiomatic) way of determining whether a number is a power of two in APL? My solutions: github.com/codereport/LeetCode/blob/master/…
 
      f←(⊢=⌊)2∘⍟⋄f ⍳8
1 1 0 1 0 0 0 1
      f←0=1|2∘⍟⋄f ⍳8
1 1 0 1 0 0 0 1
that is 7 bytes
 
4:24 AM
For pure golfing purposes, ⊢∊2*⍳ works at 5 bytes, assuming ⎕IO←0
Since APL doesn't have bitwise ops (which are to be simulated with bit arrays, which involves 2∘⊥⍣¯1 anyway), seeing if the bit count is 1 is probably the most idiomatic way
Given the input range, I think you can do (33⍴2)⊤ instead of 2⊥⍣¯1 to avoid positiveness check
 
@Adám I can change those. I didn't use ] because those are not user commands in Dyalog. I have three commands - vegalite, markdown and multiline. Vegalite and markdown indicates how to render the following output.
 
@code_report Also your first solution 1=(+/2∘⊥⍣¯1)∧0∘< is logically weird (though technically correct). I think you meant 0∘<∧1=(+/2∘⊥⍣¯1) (and (+/...) can be golfed to 1⊥)
A solution using (33⍴2)⊤ would be 1=1⊥(33⍴2)⊤⊢
 
4:49 AM
Another one for creativity: (<\≡⊢)(33⍴2)⊤⊢
 
 
4 hours later…
8:42 AM
@Bubbler @code_report Fails on negative numbers.
@Razetime These fail on 0.
@kimmolinna 1) they could become (]html started out exactly like that, but was ported to the normal product). 2) they are certainly not keywords like :return.
 
@Adám I could live with the present .apla format if Dyalog editor would open it in a proper format.
 
@kimmolinna You mean the stand-alone Editor (on Windows)?
 
@Adám I already changed those. Now I have ]vegalite, ]markdown and ]multiline
@Adám Yep.
 
@kimmolinna Nice.
@kimmolinna Right, I understand. I think there's a better chance we'll start representing plain texts as normal text files. I'll take it up with the involved, and let you know when I have news.
 
9:00 AM
@Adám ah make sense
 
@code_report More idiomatic is, imo, {1=+⌿⍵⊤⍨33⍴2} because it handles a numeric array of any shape.
(This is equivalent to Bubbler's 1=1⊥(33⍴2)⊤⊢ but maybe easier to read.)
Also, Bubbler's is fastest, even on individual numbers.
      n←¯256+?1e3⍴512

      ]runtime -c (0∘<∧1=1⊥2∘⊥⍣¯1)¨n (1=1⊥(33⍴2)⊤⊢)¨n
  (0∘<∧1=1⊥2∘⊥⍣¯1)¨n → 1.6E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (1=1⊥(33⍴2)⊤⊢)¨n   → 5.1E¯4 | -68% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕

      ]runtime -c (1=1⊥(33⍴2)⊤⊢)¨n (1=1⊥(33⍴2)⊤⊢)n
  (1=1⊥(33⍴2)⊤⊢)¨n → 5.1E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (1=1⊥(33⍴2)⊤⊢)n  → 5.1E¯6 | -99%
 
9:55 AM
Hm, I really want (reverse-compose or before), so things using the pattern (f/g⊢) can be written as f/⍛g
 
wouldn't the full version there be (f/⍤⊣g⊢)?
 
I had monadic application in mind.
 
oh, so f/⍛g⍨
 
Yes, typo.
 
also the very similar-looking f⍛/⍨ is awesome
 
10:00 AM
Oh yes, that's "filter by function".
Probably many such constructs we don't think of because is missing.
f⍛⊂⍨ partition by.
 
/ is the primary one that comes to mind in BQN (where filter by function is of course F⊸/)
 
Right.
With sane indexing as , f⍛⊇⍨ is another filter, for functions that give indices.
 
yeah, was about to mention that
 
But even without that, ⊂⍤f⍛⌷⍨ works.
 
fwiw, mlochbaum/BQN contains 1862 s and 902 s. But many of those are with array operands, which would both translate to in APL
 
 
2 hours later…
12:28 PM
@Adám i've been pondering a (f)! dict creation overload to enable this kind of thing in k (defined as {y!x y})
so partition by length would be =(#')!
 
I don't understand how that can parse right.
How wouldn't it end up applying monadic !?
 
@Adám which bit?
(f)! would be noun verb which is ok
 
So parenthesised verb is a noun?
 
like 3+
@Adám yep
 
Ugh.
 
12:32 PM
@Adám that's a core k thing
 
I don't have to like it.
 
(also i meant 'group by' in my message earlier)
 
 
1 hour later…
1:52 PM
did some grep.app-ing of APL chars, and apparently this is the most common APL expression on GitHub
 
2:04 PM
@dzaima What in the world is ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈?
 
something in a library common to all those repositories
 
Yeah, seems to be a font or encoding test .
((V⍳V)=⍳⍴V)/V←,V is a classic idiomatic expression, though.
But today, people would use ∪V if they have it available.
I guess it is good that many systems check to make sure they support APL chars.
 
 
1 hour later…
3:26 PM
Where can I find the documentation for Dyalog ⎕S and ⎕R?
Never mind. Found it.
 
@EliasMårtenson ]help ⎕R
@hyper-neutrino Bot died?
 
⎕←42
 
@hyper-neutrino 42
 
since it appears most of the time the bot goes down, the program itself actually crashes, i can probably just surround this in a while loop
 
 
3:29 PM
something about websocket unexpectedly closing
alright hopefully this shouldn't happen again, unless some other strange error causes it to stop working but doesn't crash the program
 
I demand `⎕IO←1.2
Or ○1
 
If that was possible, how would one use fractional indices for things like laminate and mix?
 
@Adám Thank you. It was an answer like that that I would have hoped for. I need something to think about that is not so serious :-)
 
I wish 1 2 3 ⍪ 4 5 6 was 1 2 3 ,[⎕IO-.5] 4 5 6, is there any sensible reason why this couldn't be the case?
 
Also, complex IO
 
3:40 PM
⍉⍤,⍥⍪ is really ugly
 
@rak1507 Do you mean + rather than there?
 
@Adám oops, meant -
 
@rak1507 Well, you wouldn't want to lose but BQN has for exactly this.
 
@rak1507 hmm, isn't that question kind of similar to the question of whether 1,2 should error?
 
@dzaima similar
 
3:42 PM
@Adám you'd still have , it'd just do something different for rank 1, like , does for rank 0
 
^
 
Anyone else fancy reading my APL-book? Caveat: it contains the solution to one Dyalog comp part 1 problem.
 
@xpqz if I can prove to you that I've solved that problem can I read it?
 
@dzaima That'd make it really hard to write rank-agnostic code.
 
(and then if I submit your solution they tell me off)
 
3:42 PM
I take your word for it...
@rak1507 can you msg me an email address?
 
@Adám I have a hard time imagining it'd be more of a problem than many other things. (and, as you may know, i don't particularly like suggesting writing rank-agnostic code)
 
@Adám I think the laminate question is easy to answer though. If ⎕IO←1.2, then you would do A ,[0.6] B
 
@xpqz how? I don't really want to post my email publicly here, maybe I can email you?
 
(that's assuming that the stride length is always 1. Clearly we need a ⎕SL←N setting that allows you to configure this)
 
@xpqz @rak1507 I can connect you by email.
 
3:45 PM
alright, thanks
 
@Adám Sure works for me
 
@dzaima It'd be awful for things like PDI etc.
No, the real problem is that , is last-axis. In a fresh APL, , should be first-axis, and then could do this coupling.
I.e. , and could be BQN's and (everything dyadic here).
 
@EliasMårtenson so A ,[1.2] B would be a non-laminate, and A ,[¯1+1+1.2] B would be laminate?
(not that that can't work, it's just a fun consequence (of course it won't practically be usable but that's not the goal here))
 
@dzaima well, laminate would be if the index is ⎕SL÷2 less than some index.
 
i assume ⎕SL is like ⎕CT?
 
3:49 PM
So with ⎕IO←1.5 and ⎕SL←10, then the indexes would be 1.5, 11.5, 21.5, ... And to laminate you'd have a value half-way in between, such as 16.5.
 
so a me who always wants precise comparisons won't be able to use ⎕IO←1.2 without rounding errors messing with things :'(
 
@dzaima You're right. Clearly we need decimal arithmetic now.
 
⎕IO←÷3 :P
 
Now... what about ⎕IO←3J1
 
⎕IO←○¯1j1 for complex irrational numbers.
Anyhow, I want ⎕IO←' ' – deal with it! ;-)
 
3:55 PM
⎕IO←⎕NS⍬
⎕IO←3⍴⎕NS⍬
 
Can we all agree on ⎕EX'⎕IO'?
 
@Adám You do realise I will now spend far too much time (i.e. more than zero) thinking about what that would look like?
 
@EliasMårtenson with BQN-like char arith, it's not even too impossible
 
@dzaima Tell me more about BQN char arith
 
if you had ⎕IO←⎕UCS 0, you'd even have the nice side-effect of negative indices being literally impossible
 
@EliasMårtenson "BQN" ≡ "APL"+1‿1‿2
 
Oh nice
 
@EliasMårtenson It'd be awesome: ⍳95 for printable ASCII.
 
but you're limited to arrays of length 1114112 :/
 
@Adám You know, it's not too far from how COBOL handles numbers :-)
 
3:59 PM
@dzaima That should be plenty for most purposes.
 
Oh wait... there is a ring of complex numbers defined for + and ×, no? That suggests that ⎕IO for a complex number is OK as long you you limit yourself to those two operations.
 
you generally need just + for indexes, no?
 
Well yeah
I mean, I'm not that great at math. I only know enough to pretend to understand basic classical mechanics and beginner QM :-)
In other words, I know enough to be practical, but number theory and that stuff is way beyond me.
 
@EliasMårtenson i wouldn't even pretend to understand those
 
indexing should clearly be based on points on an elliptic curve
 
4:04 PM
@dzaima You could. Classical mechanics is mostly calculus, and basic QM is matrices, complex numbers and a few derivatives.
@rak1507 I think you're on to something there. An array lookup is basically the same operation as performing an EC encryption operation.
Let' call it Crypto-APL, or CRAPL for short.
Throw in a few blockchains as well and there is money to be made.
 
lol
 
I had a potential customer ask me (in all seriousness): What do you think of blockchains?
 
Hang on a minute, surely someone must have marketed a "native blockchain programming language"
@Adám Hah, I've had colleagues ask that :-)
What did you answer?
 
I think blockchains are great for some specific problems, but certainly not for everything.
 
@Adám in an APL context?!
@EliasMårtenson solidity is probably the closest thing
although I did see one the other day... hang on
 
4:13 PM
@rak1507 Well, in the context of him wanting to create a startup and make money fast.
 
startup and APL don't sound like they'd go together
 
OK, can we please not do another APL-bashing session now? I have other things I want to do.
 
@rak1507 I did a DDG search for "blockchain programming language", and while I expected some absolutely garbage articles... This was the number one hit. Warning, there is a rish of losing quite a few braincells after reading this... In fact, I suspected it was written by an AI, but even AI are better at generating actual words: mobcoder.com/blog/blockchain-programming-languages
 
Fine :P
1. C++
oh no
 
@Adám I mean, was this recent? A couple of years ago you could make money by just starting a company with blockchain in the name.
 
4:16 PM
@EliasMårtenson Yes, this spring.
 
Now, I'm no so sure.
@Adám Do people still think blockains is a "world changing" technology?
 
¯\_(⍨)_/¯
 
doesn't have to be world changing to get dumb investors to throw money at it
 
Fair enough.
Sometime I wish I wasn't such an honest person. I'd be rich.
 
@EliasMårtenson did they just like, list 10 popular languages and make up some BS connection to blockchain...
 
4:19 PM
I could probably plan some pretty spectacular crime if I put my head into it. I could probably be a successful (‽) terrorist too.
 
Not one for the CV I think...
 
@hyper-neutrino Pretty much, yes. Combine that with terrible grasp of English and absolutely no knowledge of the actual subject matter, and that's what you get :-)
The article is almost a work of art
 
RGS
“The only problem we encounter.”
I see.
 
 
1 hour later…
5:43 PM
@Adám getting NONCE ERROR: __session_input__ is in use when I try and use :Section
oh it's when I try and re-enter a section
 
@rak1507 So, you solved it?
 
no
I don't know how to run a section again
 
Just press Enter anywhere inside it.
@rak1507 What exactly did you do to provoke the error?
 
hang on, will try again in a sec, for now a niladic tradfn will do
 
5:59 PM
oh, got it, it's when you hit enter from inside a dfn
      :Section
       f←{1}
       :EndSection
      :Section
       f←{1}
       :EndSection
NONCE ERROR: __session_input__ is in use
hit enter when the cursor is in front of the 1 in the dfn
 
6:15 PM
@rak1507 I can repro in 18.0, but has been fixed in 18.1. That's OK, since it was very experimental in 18.0.
 
 
2 hours later…
8:06 PM
@Adám Alright great, what's the behaviour in 18.1? Do you get to edit the dfn, or does it re-enter the section?
 

« first day (1640 days earlier)      last day (1017 days later) »