« first day (2193 days earlier)      last day (448 days later) » 

2:58 AM
It's so weird realising that was only added to standard dyalog APL in 2020, because it feels like something that's been around much longer (I understand extended APL had it for a while, but I more mean it feels like such a useful thing that I was surprised to find out it wasn't in vanilla for a long time)
 
3:14 AM
Where are you seeing this? aplwiki.com has this to say about Commute:

> The Commute operator was defined in Operators and Functions in 1978, and taken up by NARS as a result. Dyalog, influenced by NARS, included the operator early on. While it didn't appear in SHARP APL, it was included in J as "Reflex/Passive" (~).
Are you talking about Constant, perhaps?
Ah, yeah, aplwiki notes that Constant came out with 18.0 in 2020! That's crazy.
Also Atop and Over! Dang. 17 must have been a completely different language! :P
Are builds of these historical versions offered somewhere?
 
3:56 AM
@B.Wilson yeah, I'm talking about the Constant functionality
I forgot that it is also commute lol
 
4:35 AM
@B.Wilson tio.run/#apl-dyalog uses 17.1, but 17.x didn't feel like a completely different language. However, 13.2→14.0 basically was. It introduced trains, Rank, Tally, and Key!
 
you mean Dyalog APL didn't have the most iconic parts of APL until 2014?
 
Yes.
 
TIL
so how was tacit done in Dyalog APL before 14.0?
 
and
 
Wow. I can imagine how verbose that would have made things :p
 
4:44 AM
You could have written +⌿÷≢ as ÷∘⊃∘⍴⍨∘(+⌿)⍨ but why would you do that instead of {(+⌿⍵)÷⊃⍴⍵}?
 
ah yeah, I didn't think to realise that normal primitive parsing works.
 
But still, Dyalog is the only production APL that has all these features. All the APL2, APL+, and APLX systems out there have everything written as tradfns, and APL+ doesn't even allow tradops!
 
As much as I've really started loving tradfns lately, that sounds really painful not being able to express things as hooks and forks and other nice, terse formats :p
 
And no local helper functions. None of that {something}¨
 
wh...
now that's unironically painful
yikes
 
4:53 AM
Then you might reach for a :For loop, but APL2 has no control structures.
 
but you can map named dfns in APL2, right?
 
Named tradfns yes, but dfns don't exist there.
 
I'd reply with something witty or some sort of comment implying how horrible that sounds, but I just can't. No dfns sounds like torture
 
The above should give you some perspective and appreciation for what Dyalog has done for APL.
 
It does. I never knew just how different Dyalog APL is from how APL usually is
 
5:02 AM
@Ashy Welcome back. Has been a while.
 
5:22 AM
Wow! APL really is alive and evolving!
Other than J, are there any APLs that have tacit operator syntax?
 
@Adám thanks and hi!
 
@B.Wilson NARS2000?
(not sure what you mean by "tacit operator syntax")
ngn/apl, dzaima/APL?
 
does ngn have an apl too?
 
ah nice
 
5:36 AM
It's basically Dyalog 14.0 or something, right?
 
yes
 
 
6 hours later…
12:01 PM
Is there a way to return early from a tradfn? I see that there's a for branch, but that looks like it's just a label, not what one would consider a traditional "return" statement.
 
@lyxal →0 should work.
 
works wonderfully
thank you!
 
@lyxal Can I ask what you searched APLcart for?
 
I actually was searching the APL wiki
I looked at the branch page, as well as the control structures page and found nothing on return
Didn't think to look in the APLCart
 
It's not particularly obvious, but the doc page on Branch mentions this:
> If the line does not exist, then execution of the function is terminated. For this purpose, line 0 does not exist.
 
12:16 PM
The modern approach is :Return anyway.
@B.Wilson Interesting way to put it. I always thought it made sense to go to 0 because line 0 is the header, indicating the calling syntax, so going there means "go to complete the call"
 
Is it not possible to :Return a :Leave? I basically want to terminate a :For loop in a tradfns using another tradfns that is called in the loop
 
@sloorush No, you can't do that. They are not functions. You can however return a Boolean, which the caller then uses to decide to :Leave or not:
:For …
…
    :If SubFn
        :Leave
    :EndIf
…
:EndFor
 
@Adám Okayy! I'll try to implement it like this, but not sure if it'll fit my case, I need to do some processing on the result of the function as well
Maybe will have to hack my way through IF blocks somehow
 
You can return multiple things and pick out the Boolean for the :if
You can always submit your code to Code Review Stack Exchange…
 
@Adám yes. I'll try this, thank you!
@Adám Oooh, I will do that once I have my implementation complete for improvements
 
12:55 PM
@Richard I have a couple of extra problems ready for you.
 
:)
 
Want them now or during the event?
 
in 3 mins
 
ok
 
looking for what I prepared right now
 
12:57 PM
You can probably re-write it on the fly.
Welcome to APL Quest 2018-2! Today's quest is Number Splitting:
> Write an APL function that, given a scalar real non-negative number, will return a two-element vector of the integer and fractional parts of the number.
There are multiple trivial ways to do this.
 
{(⌊⍵),|⍵}
was looking for the tacit version however, somewhere lost in my notes
 
Hold on, something missing there. A 1, I presume.
 
ah yes, typo
 {(⌊⍵),1|⍵}
and I hoped this to be the tacit one I just made.
 
That's pretty easy to make tacit: Replace with and remove braces, then simplify.
 
⌊,1|⊢
 
1:04 PM
Indeed.
 
but it is not
 
Alternatively, you can do 1∘| instead of 1|⊢
Can you do it without |?
 
⌊,1∘| was my first try but it gives 0 for 1.23. So does
⌊,1|⊢
 
You're forgetting to isolate.
 
ah, fixed
forgot puting () around it
@Adám ⍵-n,n←⌈⍵
 
1:08 PM
but yes.
Also, you need ,⍨
No, wait, parens too.
Did you even try it? ;-)
 
too hasty, no sorry
just writing down my thoughts
 
If you don't worry about re-calculating the floor: ⌊,⊢-⌊
 
@Adám now I know the idea here is to figure out how to do it using "maths" and stuff like that, but hear me out:
{2↑⍎¨'.'(1↓¨,⊂⍨⊣=,)⍕⍵}
 
Ouch.
 
ouch? It's a work of art! String manipulation at it's finest
because who needs math anyway! :p
 
1:10 PM
Also, the result should be such that the sum matches the original.
 
I have the worst idea on how to implement that
one second
 
:)
 
@lyxal Why use manual string manipulation when you've got regex‽ (⍎'\.' '_'⎕R' .' '')34∘⍕
 
I took the worse thing and made it worse
{((⊂⍎'0.',{⍕⍵})@2)2↑⍎¨'.'(1↓¨,⊂⍨⊣=,)⍕⍵}
It now meets the sum requirement
by appending 0. to the fractional part and evaling that
 
@user14747991 I'll get you access to the room.
For all the fun that this is, who has the 5-character non-train solution?
 
ovs
1:16 PM
@Adám 0 1∘⊤
 
Yup.
Now, to understand how that works…
 
The docs for downtack state "If the first element of X is 0, the value will be fully represented." What does fully represented mean?
 
Meaning that there'll be no carry. This "digit" will just keep growing.
Compare: ⎕←10 10 10⊤123 ⋄ ⎕←10 10⊤123 ⋄ 0 10⊤123
 
@Adám
1 2 3
2 3
12 3
 
The first asks for 3 digits which happens to be enough.
The second asks for 2 digits, and the carry is lost.
The last lets the top digit keep going beyond 9.
 
1:21 PM
I see, and after some experimenting, a 1-element vector ⊂10 only asks for 1 digit
 
You mean ,10 — yes.
Unfortunately, treats a scalar as a 1-element vector too.
 
huh, so it does. Didn't think it'd do that
 
@Richard Can you handle complex numbers? They should give a matrix of
ReInt  ImInt
ReFrac ImFrac
 
@Adám yes I should
 
Anyone can try this extra challenge, but Richard asked me for it last week.
Another extra challenge is handling 0 and negative numbers: add a leading element which is the sign as ¯1/0/1.
And finally, for the really challenging one: Split numbers into mantissa and exponent instead, so 123.45 becomes 1.2345 2
 
1:27 PM
@Adám and you mean complex number as input?
 
Yes:
      MyFun 1.2j3
1   3
0.2 0
 
@Adám {(⍵÷10*e),e←⌊10⍟⍵}
 
Nice.
Well, I'll leave you all to this. See you next week for 2018-2:Rolling Along!
 
thanks
 
1:48 PM
@Adám Since nobody seems interested in poaching this: (×,0 1⊤|)
@Adám Guess we can use Circle for this: (11∘○,⍨9⍪⍤○⊢)∘(0 1∘⊤). However, the output is a bit funky when the input is an array.
 
@B.Wilson don't know exactly what poaching means in this context :) but I am still working on it.
@B.Wilson I should have started with this one. Nice and clean solution I think. I hoped the other one also to be so obvious
 
@Richard Ah, okay. Probably should have left that one aside. If you do find a pretty solution for the complex case, I'd definitely be interested.
Floor and Ceiling both round relative to the Gaussian integers in the complex case, it might be interesting to try replacing the base lattice with Eisenstein integers or something.
 
@B.Wilson no problem. I always like to be inspired and challenged :)
 
 
7 hours later…
9:35 PM
0
Q: How can I avoid a DOMAIN ERROR using matrix inversion ⌹ in Dyalog

MLSI have been porting old APLPLUS PC functions that run on DOS to Dyalog and have had great success. But one function runs fine on APLPLUS PC but gave me a DOMAIN ERROR on Dyalog. I traced the problem to a matrix invertion using ⌹. Here is an example of what I am seeing: F←6.91E9 5.655E9 I←¯0...

 

« first day (2193 days earlier)      last day (448 days later) »