« first day (1539 days earlier)      last day (1108 days later) » 

4:55 AM
@RGS Thanks. Fixed.
 
 
2 hours later…
RGS
7:11 AM
Np, was it a bug in the code that generates the descriptions..? Or was it a typo in the every itself?
 
@RGS Just a typo in the entry.
 
 
3 hours later…
RGS
9:51 AM
This may be a dangerous place to ask such a question because there's plenty of golfers in here, but what are your favourite tacit functions? By "favourite" I mean tacit functions you just use often or that you find particularly elegant.
I'm particularly interested in things that are short.
For example, I like (⌈/-⌊/), (+,-) and ,⍥⊂ a lot.
 
⊢⍤/ also
often in the context of (f¨⊢⍤/⊢)
 
RGS
@dzaima So a type of filter statement?
 
@RGS yep
also i just realized that with reverse compose that can become f¨⍛/⍨
 
@RGS '+×⌈⌊×∨,⊢⊣'∘.,'/⌿\⍀'
Also ⊥⍣¯1
And ⊣@⊢
 
RGS
@Adám Yeah, that qualifies as an answer to my question :P
@Adám Is this to be used dyadically?
 
9:59 AM
@RGS Yes, obviously. E.g.:
      10 20 30⊣@⊢0 1 0 0 1 1 0
0 10 0 0 20 30 0
It is a rank-independent form of \
 
RGS
That's a neat one! Except I don't understand your statement "it is a rank-independent form of \"
 
@RGS +⍨ and ×⍨ and ?⍨
@RGS Same as 0 1 0 0 1 1 0\10 20 30 but try doing this with \:
      10 20 30⊣@⊢2 3⍴0 1 0 0 1 1
0 10  0
0 20 30
 
@Adám Why no ∧<≤≠ in the list of operands?
 
@Bubbler I don't use all of the combos with those nearly as often, but yeah, sure.
 
⍤⊣ and ⍤⊢ are sometimes useful for dyadic tacit fns, but often then a dfn is better
 
10:06 AM
@RGS ⊢∘≢⌸
@dzaima Those are not tacit functions, though.
 
i guess
 
RGS
I guess dzaima is just sharing part of the construct.
 
@RGS My personal favorites are (⊢,,¨)\ (from this) and -\⍣2⍳ (at the bottom of this). Not something used often, but mind-blowing.
 
@RGS both monadic and dyadic ,⍤0
@RGS Though I don't find it elegant, I often need ⌷⍨∘⊂
@RGS ⌽≡⊢ and ⍉≡+
@RGS ÷1⊥÷ and ⊥⍨
@RGS ∪⊢∨⍳ and (,÷∨)∘1
@RGS Not short, but super cool, imo: ⊃((+⌿÷≢),(×⌿*∘÷≢))⍣≡
I so wish we had as then the symmetry in this one would be so much neater: ⊃((+⌿÷≢),(≢√×⌿))⍣≡
 
RGS
10:24 AM
@Adám Is this computing that weird thingy with the arithmetic and geometric mean?
 
Ooh: ⊃(M,(M←+⌿÷≢)⍢⍟)⍣≡
In mathematics, the arithmetic–geometric mean (AGM) of two positive real numbers x and y is defined as follows: Call x and y a0 and g0: a 0 = x , g 0...
 
My favourite tacit: ∪⍳⊢
 
I never realised that the geometric mean is (+⌿÷≢)⍢⍟
@RGS Enough?
 
RGS
@Adám Think of the geometric mean as the arithmetic mean of the scales :)
 
Sure, same thing.
 
RGS
10:36 AM
@xpqz ⍳⍨ :)
@Adám Too many! Have to process all of this.
 
@Adám sent you the finished article.
@RGS hang on a second, what kind of voodoo is this?
 
@xpqz No, that isn't the same.
 
Ah, this is a test :)
 
           (∪⍳⊢)3 1 4 1 5
1 2 3 2 4
           ⍳⍨3 1 4 1 5
1 2 3 2 5
Notice the trailing element.
 
RGS
Ahhhhhh, annoying nice nuance there.
@Adám I thought I had understood that but apparently not. I thought this would ravel the scalars but instead it took ` (2 2⍴1) (2 2⍴2) (2 2⍴3)` and acted as , stacking them up in a column vector.
 
10:52 AM
@RGS It is identical to for vectors, but for all arrays, it adds a trailing axis.
 
RGS
Ugh I don't get why ,⍤0 changes the shape... I know what I'll be watching today while having lunch :P
 
@RGS All arrays are collections of scalars. ,⍤0 changes those scalars into vectors, which makes an array consist of vectors, i.e. its rank is bumped up by 1.
 
RGS
Of course, , is "promoting" the scalars....
Clever
 
@RGS Monadic is rather superfluous, it being ,⍤¯1. It would have been better if monadic was ↑⍤,⍤⊂ as then you could use ⍪⍤k to add an axis anywhere.
@RGS Are system functions allowed?
 
RGS
11:09 AM
@Adám Whatever floats your boat, I just wanted to take a look at cool tacit functions.
 
@RGS ≡⍥⎕C and ⍳⍥⎕C and ∊⍥⎕C and ⍋⍥⎕C etc.
 
RGS
Nice
 
 
1 hour later…
12:29 PM
Is there a way to compute one of these from the other?
begins←2</0,digits
ends←  2>/digits,1
 
RGS
Is digits binary? (just wondering)
 
Yes.
 
@Adám the two don't at all help with computing the other
 
@Marshall Hi, what is the fastest way to count how many unique numbers there are in a string with letters and digits? E.g. 'dfds12321afafdns012321ajfkbs12adjfndsja0012knfd0sjaknfsda' gives 3.
 
@Adám This is the question from the code_report video, right? I don't think I had any improvements on the solutions that were discussed here.
 
12:38 PM
It is. I was surprised that my flat solution wasn't faster than my best ≢∪ solution.
But then again, my flat solution huge. I'm probably doing something wrong.
My idea was to find the longest sequence of digits, then pad all digit sequences with 0 on the left until that length, remove all letters, and reshape into the width of the longest digit sequence.
 
RGS
@Adám That sounds like you are going over the whole string a little bit too much, no?
 
The padding part sounds slow, and of course if there's a very long number it will degenerate.
 
@Adám probably worth putting in a test case with trailing zeros
 
My actual test cases have a million elements with 50% digits, so there's a good chance of a trailing 0 somewhere.
 
RGS
What if you reverse the order of those operations?
Find the lengths of the digit sequences
Remove all letters
And then pad?
Would that help at all?
 
12:50 PM
BQN's number parser is the only time I have to do a scan or reduction by a non-primitive. It cuts numbers off at 17 digits, separates them with ¯1s, and uses (0⊸≤××⟜10⊸+)` to add them up. Which isn't even possible in APL because there's no linear scan.
 
RGS
      d
dfds12321afafdns012321ajfkbs12adjfndsja0012knfd0sjaknfsda

      ((1 0⍴⍨≢)⊢⍤/⊢)¯2-/⍸2≠/d∊⎕D
5 6 2 4 1
This gives the lengths of the digit sequences. You could then do smth like d/⍨d∊⎕D to get only the digits... and then work with the lengths..?
 
@RGS OK, so at indices 0,+\¯1↓5 6 2 4 1 I need to insert (⌈/-⊢)5 6 2 4 1 zeros…
@RGS Yes, this works. Let me measure.
 
RGS
@Adám I'm also trying to do something like your ⊣@⊢ today to take the digits d/⍨d∊⎕D and insert them directly in the correct matrix.
But I'm having a hard time doing that :P
 
What is the fastest way to do {⍵/0 1⍴⍨≢⍵}?
 
RGS
1:08 PM
Ah that's the construct I needed :P Looking forward to hearing if I was able to contribute with any good ideas :P
 
1:21 PM
@RGS Issue:
      d←'999dfds12321afafdns012321ajfkbs12adjfndsja0012knfd0sjaknfsda'
      ((1 0⍴⍨≢)⊢⍤/⊢)¯2-/⍸2≠/d∊⎕D
4 7 6 9 4
 
RGS
Pre-pad with 'a'?
 
That's expensive.
 
I think you need 1,⍨1,2≠/ to be completely safe. Shouldn't cost much though.
Other way around, and with zeros: 2≠/0,⍨0,.
 
RGS
↑ yeah
 
Now it works. Time to time.
@RGS Nice:
      Compare 1e6
  code_report t   → 7.4E¯1 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  regex t         → 3.5E¯1 | -54% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  tcnymex t       → 2.4E¯1 | -68% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  vfi t           → 1.4E¯1 | -81% ⎕⎕⎕⎕⎕⎕⎕⎕
  mkrom t         → 1.5E¯1 | -81% ⎕⎕⎕⎕⎕⎕⎕⎕
  compress t      → 1.4E¯1 | -81% ⎕⎕⎕⎕⎕⎕⎕⎕
  replicate t     → 1.4E¯1 | -81% ⎕⎕⎕⎕⎕⎕⎕⎕
  trim_find t     → 7.6E¯2 | -90% ⎕⎕⎕⎕
  trim_pairwise t → 4.9E¯2 | -94% ⎕⎕⎕
  porscan t       → 4.7E¯2 | -94% ⎕⎕⎕
  flat t          → 6.5E¯2 | -92% ⎕⎕⎕
 
RGS
1:27 PM
Can I see the impl?
 
 rgs←{
     ⎕IO←0
     digits←⍵∊⎕D
     lengths←m/⍨1 0⍴⍨≢m←¯2-/⍸2≠/0,digits,0
     maxLength←⌈/lengths
     pads←maxLength-lengths
     zip←,pads,⍪lengths
     count←≢lengths
     expansion←zip/0 1⍴⍨≢zip
     ≢∪count maxLength⍴'0'@{~expansion}expansion\digits/⍵
 }
Here's mine:
 flat←{
     digits←⍵∊⎕D
     cumSum←+⍀digits
     widths←¯2-⌿0⍪cumSum/⍨1,⍨2</digits
     maxWidth←⌈/widths
     expansionInds←1+0,+\¯1↓widths
     extra←maxWidth-widths
     expansionAmts←extra@expansionInds⊢0⍴⍨⊃⌽cumSum
     expansionVec←(+\∊⍨∘⍳+/)1+expansionAmts
     expanded←'0'@{~expansionVec}expansionVec\digits/⍵
     expanded⍴⍨←maxWidth,⍨≢extra
     ≢∪expanded
 }
 
You could also do less subtractions by reshaping the indices to n 2 and using plain -/, but ¯2-/ is probably faster because it's vectorized.
 
RGS
So flat and rgs are the only ones that are 100% flat?
 
Yes.
 
RGS
That's interesting. Maybe there's a clever way of putting some of flat's or rgs's ideas together with some nesting to make an even faster solution?
 
2:29 PM
@Adám do all of your solutions handle 0?
 
@rak1507 Yes.
 
just for fun can you compare this tradfn?
 r←f s;num;c;nums
 nums←⍬
 num←¯1
 :For c :In s
     :If c∊⎕D
         num←(10×0⌈num)+⍎c
     :Else
         nums,←num
         num←¯1
     :EndIf
 :EndFor
 r←1-⍨≢∪nums
 
@rak1507 In progress…
  code_report t   → 8.1E¯1 |    0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  regex t         → 3.6E¯1 |  -56% ⎕⎕⎕⎕⎕
  tcnymex t       → 1.8E¯1 |  -78% ⎕⎕⎕
  vfi t           → 1.4E¯1 |  -83% ⎕⎕
  mkrom t         → 1.4E¯1 |  -83% ⎕⎕
  compress t      → 1.2E¯1 |  -85% ⎕⎕
  replicate t     → 1.5E¯1 |  -81% ⎕⎕
  trim_find t     → 7.9E¯2 |  -91% ⎕
  trim_pairwise t → 5.6E¯2 |  -94% ⎕
  porscan t       → 5.6E¯2 |  -94% ⎕
  flat t          → 9.3E¯2 |  -89% ⎕
  rgs t           → 9.6E¯2 |  -89% ⎕
  rak1507 t       → 2.8E0  | +248% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
RGS
(☞゚ヮ゚)☞
 
lol
 
2:38 PM
Wooden spoon.
 
I wish there was a mode for cmpx to make the slowest entry as reference entry, and order all others descending.
 
yeah, that would be great
 
@JPeroutek Oh hi. Long time no see. Welcome back.
@Razetime About the prime prime test: I didn't realise the code had to sum to prime. Just include "dfns" in the language name, and you're good to go.
 
Hi @Adám
 
RGS
Hey @JPeroutek, I missed you!
Just kidding, I don't know who you are :'(
 
2:53 PM
:( I suppose I could say the same about everyone here though. We are all just internet names/faces
 
RGS
Yeah :/ Don't mind my initial remark, though, I just like being silly.
 
@JPeroutek Except that some of us actually know each other IRL.
 
True, true. I suppose that's more likely in rooms like this one where you're basically the universal APL reference
 
3:11 PM
@Adám alright, then.
@Adám I changed it
 
@Razetime OK. I've just started another bounty for you, so it'll have to wait until next time, though.
 
oh, ok.
 
 
1 hour later…
4:21 PM
Is there a good Basic guide to setting up APL projects? Like some kind of "APL projects for Dummies"?
 
5:05 PM
@JPeroutek @Adám might have better advice, but it seems like a lot of users just figure out their own system. If you are just playing around to start with then I'd just )SAVE workspaces with useful names. If you are planning to develop a proper project from scratch in 2021 then I'd recommend using github.com/dyalog/link which comes with the latest versions of Dyalog
 
@JPeroutek @MortenKromberg will be around later to answer you too.
 
Better documentation for ]Link is on the way, but for now you'll probably get by using ]Create # /path/to/project/folder which creates a bi-directional link between your file system and the active workspace (the place where the names are), with namespaces within your workspace becoming folders in the file system
 
cue macos-bore: bi-directional link requires .net core and realistically 18.1 on macos -- but it's wonderful!
 
My basic advice (as Adam said MKrom will probably give a better answer) is to keep data separate from code (and read/write as needed programmatically) and to use namespaces to separate concerns (a utilities namespace, a namespace for communicating with the outside world, a namespace for doing your computations etc.) - be warned that I haven't done really any large application architecting so this is basically my guess for what I would do - please take with a large pinch of salt
 
@RikedyP Please don't use SALT, though ;-)
 
5:11 PM
There are rumours that some APL developers live in one giant workspace with functions and data strewn about everywhere. Please don't do this.
@Adám LOL
And also Dyalog has OOP classes and stuff, which in some circumstances I'm sure can be useful for architecting a project (just don't rely on it for computation - do that with APL).
@xpqz It's rather nice not having to remember to save all the time
 
@xpqz We are getting an experimental file system crawler that can work without .NET.
 
or you could do what I do and code in the repl and copy paste things when they work into notepad ;)
 
@rak1507 Thats been my method so far, but I figured that there had to be a better way
 
 
2 hours later…
7:00 PM
@JPeroutek Hello... I presume you are using Dyalog v18.0 - have you been able to try Link ]Create yet?

You would think your simple question had a clear answer, but we are in a bit of a transition and Dyalog has been working on tools to move the user base from the traditional binary "workspaces" which are a bit like an Excel Workbook, containing all your data and code, to Unicode text based source files.

We're about to release a new version of Link which we hope will form the basis of future best practices, to be released with Dyalog 18.1 within the next 2-3 months.
 
@MortenKromberg I've not given it a try yet, but plan to this evening. Hopefully I can figure it out! The whole "workspace" thing has been a bit of an issue for me for a while, as it makes more intuitive sense to me to have a regular Unicode text file for Source.
 
@JPeroutek Can you tell me a little about the size of your project, the platform you are running on, and what your preferred editor is?
@JPeroutek Althought it doesn't match the Link that you have installed with 18.0 (or the code that is currently available in the master branch on GitHub), it might be worth reading the introductory sections of the draft documentation, which you can find at mkromberg.github.io/link. I'd be very interested in any feedback on whether it makes sense and is helpful.
 
Small stuff right now, was going to try some Finite Element method code adapted from Fortran as a first "bigger" (non code-golf) project. Windows 10 x64, usually use VS Code but open to other options.
@MortenKromberg I'll look it over after work, and get you some feedback for tomorrow. From an initial look, it does seem to be quite helpful
 
Is .NET available to you? The current version of Link uses the .NET file system watcher for instant integration of changes made via an external editor into the active APL workspace. Without that, you currently need to manually type a command to bring the latest code into APL.
 
Yep, I've got a few versions of the .NET runtime installed.
 
7:09 PM
My own preference would be to use the built-in APL editor, of course :-). If you do that, all changes made are immediately reflected in the text files.
OK, take a look at the docs and ping me when ready.
@JPeroutek Or rather, ping me when you need help :-)
 
8:15 PM
Dumb question time. I loaded up an old workspace of mine, and want to see the code for it a few of the DFNs. I can see they are there, as they show up in )fns. How do I view the code for the function?
 
if you enter the name, it should show the code
 
)ed functionName
 
alternatively )ed
 
@rak1507 Only with ]boxing on
 
oh yeah, wow, that's very strange
 
8:19 PM
@JPeroutek Another way you might like: Click the yellow folder with a magnifying glass, on the Tool menu:
 
Ah, i was under the impression that )ed was only for tradfns for some reason.
 
Then you can navigate the Workspace Tree: Expand the [Fns/Ops] and click a function name.
 
The Tool menu option is convenient too
 
8:55 PM
@JPeroutek you can edit anything! just sometimes it might crash, so be careful ;)
 

« first day (1539 days earlier)      last day (1108 days later) »