« first day (1302 days earlier)      last day (1342 days later) » 

3:50 AM
Why does it give me an error at the star diaresis?
It works on the IDE
is this a safe executor thing?
 
4:02 AM
⋄{(⌽≡⊢)2(⊥⍣¯1)⍵:'YES'⋄'NO'} 5
 
@Razetime DOMAIN ERROR
 
lol
 
 
2 hours later…
5:53 AM
@Razetime You're using "Extended" which doesn't need that construct: Try it online! If you use "vanilla", then it works: Try it online!
 
6:22 AM
Is there a cheat sheet for what symbol I should use where?
tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@/… Classic seems to be less bytes, I'll post this
 
@Razetime No, don't use Classic, which lacks a few symbols like (IIRC) and . Instead, use Unicode and include the link to APL SBCS which justifies scoring 1 byte per APL symbol.
Relevant info is here.
 
hm, so I need to use unicode, but change the byte count.
 
6:39 AM
@Razetime One obvious improvement is to remove parens around ⊥⍣¯1 and separate ¯1 and using (TIO).
 
@Razetime Yeah, but TIO does show you the character count, so that's pretty easy. If you're golfing, you can also use Extended which is usually shorter, and then TIO does put the character count into its generated posts.
@Razetime Golfed a little: Try it online!
 
@Razetime 24 bytes with ⎕IO←0 (system setting is free) if you understand tacit programming, and 17 on Extended using monadic (which is the synonym for 2∘⊥⍣¯1).
Ninja'd
 
@Adám are you sure thats "a little"?
 
@Bubbler GMTA
 
:)
 
6:44 AM
lmao
@Adám so as usual, I don't understand the structure of this
how does the conditional work here?
 
@Razetime Basic idea is that the booleans are 0 and 1, which can be used to index into a 2-element array (with the help of 0-based indexing ⎕IO←0).
 
(I'll rely on Bubbler to explain. Time to study with my son…)
 
well I don't think I should be posting that, it's like a completely different answer
but it's good to learn
so you select either 0th or first element based on a condition
bind the match operator with the binary conversion plus reverse and get the result
thanks @Bubbler
 
7:49 AM
@Razetime I'd say it is an exact equivalent, just replacing a conditional return with a picking from a list of return values, doing a substitution of a phrase with Extended's built-in, and "unpacking" the (⌽≡⊢) fork. Same answer, just golfed a little.
 
8:06 AM
Oh well
 
 
2 hours later…
10:01 AM
How can I split a 6x6 matrix into 9 2x2s?
 
ngn
@rak1507 ⊂[1 3]3 2 3 2⍴a
 
Whoa, how does that work?
 
ngn
@rak1507 which part don't you understand? :)
 
Ah I get it now, hadn't seen ⊂[1 3] before
 
ngn
@rak1507 there's also: ⊢∘⊂⌺(2 2⍴2)⊢a
 
10:17 AM
Anything smarter on offer for:
Xs∘{⍺,⊂⍵}¨Ys
 
{⍺,⊂⍵} can be a train
⊣,⊂⍤⊢ I think idk
 
I expect the whole thing could be a product ∘.something.
Just can't see it.
 
ngn
@xpqz (⊂Xs),¨⊂¨Ys ?
 
@xpqz Wait, what are Xs and Ys? Scalars?
 
I wanted Xs,¨Ys to work. But it doesn't.
 
10:23 AM
@xpqz I think you want {⍺⍵}¨ instead of
 
Xs←(1 2)(1 3)(1 4)
Ys←(1 5)(2 4)
@ngn yes
 
@xpqz Consider using ,⍤1 0
@xpqz Xs∘,∘⊂¨Ys
 
That does it.
 
Which one?
 
Xs∘,∘⊂¨Ys
 
10:28 AM
Right. But it isn't a function. ↓,⍤1 0 is a proper function (a train).
 
That use of rank is beyond me right now...
 
It simply says pair each vector from the left (i.e. the entire left argument) with each scalar from the right.
 
ngn
apl needs eachleft and eachright
 
It wouldn't really help here, would it?
I guess you could write ,∘⊂ᑈ
Where is {⍺∘⍺⍺¨⍵}
 
ngn
@Adám what's that? it says "invalid token"
 
10:36 AM
 
@ngn's (⊂Xs),¨⊂¨Ys is basically also saying pair the entire left argument with each scalar from the right.
 
ngn
@Adám yep, there you go, eachleft does help
actually.. eachright
 
@ngn That's my issue with those. Confusing which is which.
 
ngn
@Adám lol :)
 
@ngn What we really need is a depth operator.
 
10:44 AM
How does Dyalog decide which suggested new features should make it into next release?
 
Good question.
 
Good to know that it's not just where I work where that is a 'good question' :)
 
@xpqz Depends on what kind of feature. Anything in particular you have in mind?
 
11:00 AM
@Adám Not really, just that there are a lot of ideas here -- like the depth operator you just mentioned. Just piqued my curiosity on how/if such things are captured and championed.
But I obviously understand that piling on new features is likely counter-productive in many cases.
 
ngn
especially if you don't have the option to remove them later
 
And weighed against performance and stability work.
 
@xpqz Yeah, it isn't enough to decide to add them. We actually need a C programmer that can do the grunt work. And of course, design needs to be done very carefully, since we can't make incompatible changes to primitives. Generally, a primitive will have a proponent (can be a customer) who tries to gather the support of the language team and especially the CTO. We often model things in APL (e.g. dfns's Depth) or C (e.g. 819⌶) for a few release cycles, before making things permanent.
@xpqz System functions are much easier. Only the most interested parties make a proposed design, others review, and we rewrite and tweak until everyone is as happy as possible. We may leave out contended features for later. Eventually, there may be small compromises, but generally we all agree on the design in the end. E.g. I wanted ⎕DT to be called ⎕T and for 1200⌶ to use H/h and t for 24/12-hour and AM/PM instead of the final h/t and p.
But before ⎕DT/1200⌶ became what it is today, it went through a few cycles, and the end product looks nothing like what we began with.
@xpqz Changes to user commands and extensions to system commands are basically up to the individual implementers that are in charge of those, respectively. s are very often added, usually not with public documentation, but some eventually become promoted to official ones.
@xpqz Changes to the dfns workspace was entirely up to John Scholes, but we're working on putting together a committee to fill that role.
@xpqz Changes to the IDE are basically up to John Daintree, though often inspired by feedback from users and developers.
 
11:40 AM
CMC:
-3
Q: Remove duplicates from list and order it by count? (python)

12944qwertyHow do I remove all duplicates from list and order it based on count? s = ["foo", "this", "lem", "foo", "lem"] #should return >>> ["foo", "lem", "this"] I currently have list(sorted(s,key=lambda y:-s.count(y))) Is there any way to get shorter? Please give answer in python

Please give answer in APL ;-)
 
11:58 AM
{(a b)←↓⍉{(≢⍵),⍺}⌸⍵⋄b[⍒a]}
 
@Adám i think my characters are pretty good at being self-describing - is "connecting" the single left thing each part of the right. remembering the name and how which is written may be harder, but that's a problem with many other APL builtins
 
ngn
@Adám codegolf?
 
what inspires people to make APL dialects
 
@Razetime for me, it's just fun to implement things (especially so if that thing is actually pretty useful)
 
yeah, thats a good reason
so APl doesn't have a framework for extending it?
or does the addition of new symbols cause problems that can only be dealt with by a different character set
 
12:12 PM
@Razetime Dyalog prefers to have full backwards compatibility, which means that once something's added, it cannot be removed, and over time things build up
 
@ngn Of course.
 
no, like external libraries
even those aren't alloweD?
 
ngn
@Adám ∪0~⍨,⍉⌽(0,⊣¨)⌸⎕
 
@ngn I've got proper functions at 11 for vanilla and 8 for Extended.
 
@Razetime libraries do exist, but cannot add new symbols, and there's not really any APL stdlib that could house things that don't deserve characters
 
ngn
12:14 PM
@Razetime sometime i wonder about that too
 
ngn/apl does allow you to add new symbols.
I think NARS2000 does too.
 
Yeah I've been rooting around on a lot of APL related pages
 
ngn
@Adám challenge accepted
 
I've seen like 3 NARS answers and the accounts which posted those are gone
 
@Razetime A great way to write better (and shorter) APL is to try to formulate the algorithm as a mathematical transformation rather than using flow-control.
 
12:27 PM
I'm finding it really hard to think like that haha
I'm gonna first get myself familiar with all the tools APL has and then go on to designing mathematical transformations
 
You don't need to know everything first. I highly recommend focusing on that, and on processing entire arrays, from the outset. Then you don't have to unlearn bad patterns later.
@Razetime Right, I understand that. Most languages are not very conducive to do so. But you can start with the basics. Use the fact that comparisons return numbers, which you can then further process into other numbers. Want some exercises for that?
 
sure
you have a question bank on your website right
 
Yeah, but not really for this. I'll make some up, so you can progress. Here, create a mathematical alternative to this: {⍵:¯1 ⋄ 1}
 
so it returns -1 for 1 and 1 for 0
 
Yes.
If you find that hard, I'm happy to go even more basic.
 
12:42 PM
I'm thinking of an arithmetic solution but it's not coming up
 
OK, let's go more basic. {⍵:2 ⋄ 0}
 
2⍵
sorry, 2×⍵
 
Good. How about {⍵:3 ⋄ 1} ?
 
3*⍵
 
Good. Now {⍵:¯1 ⋄ 1}
 
12:51 PM
¯1*⍵
 
Nice. Next is {⍵:'ab' ⋄ 'ba'}
 
⍵⌽'ba'
 
Nice.
@Razetime Want more?
 
No thank you
I have to do some homework
These were fun
 
Any time :-)
 
1:57 PM
@Adám {(∪⍵)[⍒{≢⍵}⌸⍵]} or (⊂∘(⍒{≢⍵}⌸)⌷∪) at 15, I think
never sure my code actually doing what I intend
 
ngn
@TessellatingHeckler the target is 11
@TessellatingHeckler also: {≢⍵} -> ⊢∘≢
 
@ngn yeah like I'm going to approach Adám 😅 just happy to have less than a 40. Also cheers, I was going to ask about {≢⍵} not working as ≢⌸ (because it is used dyadically?)
 
ngn
@TessellatingHeckler parens around trains usually aren't counted
 
@ngn In your linked comment you say "something seems wrong" - what is the wrong ness? Could someone make one which has no symbols that serve double monadic/dyadic duty?
 
ngn
@TessellatingHeckler yes, because dyadically
 
2:08 PM
user image
3
 
@ngn actually if I change {≢⍵} to ≢∘⊢ the results are different
 
@TessellatingHeckler Jelly?
@TessellatingHeckler Yeah, don't confuse f∘g for atop (even though it is equivalent to atop when applied monadically). f⍤g is atop.
 
@Adám I remember that it isn't; is ⍤ v18 only?
and then ⊂∘(⍒≢⍤⊢⌸)⌷∪ for 11 ?
 
@TessellatingHeckler Nice. I personally dislike parens, so I wrote ∪⌷⍨∘⊂∘⍒≢⍤⊢⌸ ― same thing.
 
ngn
@TessellatingHeckler it looks wrong to me that so many attempts are made, but none of them are really successful. i'm not sure what you mean by "monadic/dyadic" duty.
@Razetime haha :) adam looks sad, you should have edited his face in :)
 
2:20 PM
I'll make the edit in a bit
 
ngn
@TessellatingHeckler darn, i was close
 
⊢∘≢⌸⍒⍛⊇∪ in Extended.
 
@Adám do you mind if I edit it in?
 
@ngn Hey, Extended is actually quite successful in the sense that Dyalog has picked up several of its features.
@Razetime No. It is really hard to offend me. Feel free to try!
 
ngn
@Adám "extended" is just dyalog with a bit of preprocessing, isn't it? it's not a separate implementation. it's not even f/oss.
though getting a new squiggle or two into dyalog is a kind of political success, i guess..
 
2:31 PM
@ngn Right, but that's only due laziness/lack of programming skill on my behalf. Dyalog didn't actually look at my code, only at my proposed behavioural extensions.
 
lmao ok
 
3:31 PM
      {⍺⊢÷⍵}/⍳3
3
      {⍺⊢÷⍵}/⍳4
0.25
why is this?
 
@cannadayr Try to "unroll" the loop and you'll see. I.e. write the equivalent expression with {⍺⊢÷⍵} inserted between the elements of ⍳N.
 
ohhh
hah
because odd numbers its just getting inverted an even number of times
odd numbered major axis
thx
http://help.dyalog.com/17.0/Content/Language/Defined%20Functions%20and%20Operators/DynamicFunctions/Default%20Left%20Argument.htm

does dyalog set ⍺ to a tacit ⊢ if you call a dyadic operator like '/' with a monadic left function argument?

example {÷⍵}/⍳3
 
@cannadayr No. It has been proposed, but adding this now would break code that includes ⎕NC'⍺'. However, note that the statement ⍺←⊢ is safe to include. It will only ever execute if the function is called monadically.
@cannadayr (Btw, / is a monadic operator taking a dyadic operand.)
@cannadayr Actually, for / it is the minor (trailing) axis, not the major (leading) axis. You may want to get used to using unless you actually mean the trailing axis.
 
3:52 PM
thx
one terminology I get confused about, I get operand/operator when its a hof
÷/1 2 3
which can be written as
÷ {⍶ / ⍵} 1 2 3

but is this still an operator-operand?
÷ 1 2 3
÷ {⍶ ⍵}1 2 3
 
@cannadayr (What is a hof?) Yes, that's the "apply monadically" operator, which applies its operand to the right-argument, ignoring any left argument.
 
higher order function
 
where is the "apply" operator?
 
@TessellatingHeckler Sorry, fixed.
 
and an operand can be both a lambda and a value?
not at same time
 
3:55 PM
An operand can be any array or function.
For the uninitiated, cannadayr's {⍶ ⍵} would be {⍺⍺ ⍵} in Dyalog APL. It is actually quite a useful operator in trains, as it allows maintaining the parity order for monadic function applications.
 
(yea sry Im too used to ⍶ vs ⍺⍺)

how do you distinguish between operators/operands in something like this (×,÷ I think)
1 2 3 ×{(⍺ ⍶ ⍵),⍺ ⍹ ⍵}÷ 4 5 6
 
E.g. if M←{⍶ ⍵} (or M←{⍺⍺ ⍵} per your implementation) then {⍺,⍳≢⍴⍵} can be written as a train: ⊣,⍬⍳M⍬≢M⍴M
@cannadayr I'm not sure I understand what you're asking. (Also, if you post multiple messages in quick succession, SE chat will join them visually. This allows you to use backticks to quote code.)
@cannadayr {(⍺ ⍶ ⍵),⍺ ⍹ ⍵} is the operator. × and ÷ are its operands.
 
what are ⍺ ⍵ ?
 
The arguments.
@cannadayr What do you mean by "when its a higher order function"? All operators are higher order functions. Even if trivial.
 
so if the operands are an array not a value like
4 5 6 (×⍤1) 1 2 3

⍤ is the operator, × and 1 are the operands, and 4 5 6, 1 2 3 are the arguments
is there a way to distinguish between an array operand vs a function operand?
 
4:07 PM
@cannadayr You mean from inside the operator, how can the operator know what kind of operand it got?
 
i wasnt sure if an operator is always a hof (takes a function as an operand), or if an operator was something more general (like monadic application like {⍶ ⍵})
more as a way to talk about it than language implementation
 
@cannadayr Hm, Wikipedia's definition of a hof is odd. It would seem that a static entity, like {⍶/⍵} would indeterminably be a hof until runtime, because it can, but doesn't have to take a function as argument.
 
yea apl is ambiguous at compile time
 
@cannadayr i would probably call APL operators higher order functions, just that the "function" can be an array if need be
 
thats a good point that the traditional definitions dont exactly fit
for example ⍣ can take a scalar right operand or a function right operand
 
4:13 PM
@cannadayr Sure, but it always takes at least one function operand.
Huh, GNU APL is very strict. It doesn't seem to allow array operands at all.
So how can GNU APL have and
 
correct, i generally smuggle them with [] and X (chi actually but im on osx and cant type it rn)
because its implemented in the runtime
i think
vs 1 2 3 {⍶ ⍵} 4 5 6 stranding
 
Yeah. Well, Dyalog allows you to check the name class of the operands with ⎕NC'⍺⍺' and ⎕NC'⍵⍵'
 
i actually like the strictness in a lotve cases
it gets most annoying when I want to write ambivalent dfns and dyadic forks
then i end up w/ some hack or duplication
 
Wait, what‽ GNU APL has forks?
 
no i end up having to write something like
{(⍺ ⍶ ⍵) myfunc ⍺ ⍹ ⍵}
because I cant pass myfunc with axis notation
and it does not have forks
 
4:30 PM
<klg> no forks, but it does allow arrays as operands
 
klg: how so? 1 (2{⍺+⍶+⍵}) 10 seems to be an error
 
<klg> well... 1(2{⍺+⍶+⍹+⍵}3)10 isn't an error
 
4:46 PM
huh. for dyadic operators allowing an array operand is pretty valuable, but not allowing them for monadic operators is strange
 
<klg> it didn't allow any array operands initially and the motivation to add it was just for the right operand of ⍤ and ⍣, so I'm not sure whether it's even intentional that left one of the dyadic can be an array
 
Sounds very against the principles of APL, to generalise constructs.
 
Is GNU APL undergoing active development?
 
<klg> btw, can we get an URL or something useful for whatever the bot renders as " ()" on this side?
 
kind of hard to tell without knowing what that "whatever" is. you can look at the transcript: chat.stackexchange.com/transcript/message/55291949#55291949
 
4:52 PM
<klg> probably images
 
@xpqz some
 
<klg> and links
 
wow svn. never thought I'd see that again.
 
That's what Dyalog uses internally (for old pre-git things) too.
 
I used it a lot in previous lives.
 
5:00 PM
@cannadayr You can "implement" forks:
      _fk←{(⍺⍶↑⍵)⍹↑⌽⍵} ⋄ fk_←{⍺⍶⍵(⍺⍹⍵)}
      10 20(+_fk,fk_×)3 4
13 24 30 80
 
5:11 PM
Of course, a similar definition can be written for the monadic case; just take out the s.
 
 
3 hours later…
7:47 PM
@xpqz I dont think Jurgen as talked publicly about adding any additional features, but theres still semi-regular bug fixes and improvements. The mailing list is where most of it happens.
lots of maturation but not anything "new" at the language level
 
8:18 PM
@cannadayr Strange. The "dfns" seem like a prototype.
 
 
2 hours later…
9:53 PM
i believe the dfns in gnu apl are syntactic sugar over tradfns.
@Adám i like this
 
10:52 PM
Just checked my email, and...
> Congratulations, you won the prize for the best Professional Entrant!
Wow. Just wow.
 
Congrats!
 

« first day (1302 days earlier)      last day (1342 days later) »