@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.
@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 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).
@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.
@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.
@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.
How 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
@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
@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
@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.
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?
@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 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?
@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 :)
@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.
@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.
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.
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.
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.
<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
@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