I am making so little progress on a non-yikes answer to that challenge
Was about to say I can get the acronym from the longest run of caps, which fits all the test cases - but just now thought of a case it won't handle. And that's ((⊃∘⍒≢∘⊃⍤0)⊃⊢)(⊢⊆⍨⎕A∊⍨⊢) which isn't particularly short.
Or I can get it from the first characters, which are bounded on the left by a space, with 2⊃¨((' ',⊢)⊂⍨' '=' ',⊢)s which is perhaps more reliable but the string needs preceding with a space to pick up the first one at the start of the string.
Or I can find the locations of the acronym in the string by the caps which are bounded on the left by a space, and on the right by another caps, OR-ing the bitmasks ⍸((1↓¯1⌽(' '(⊣=,)⊢))∧((1∘⌽∧⊢)(⎕A∊⍨⊢)))s which again isn't short
and I have no plan what to do next
other than the recursive approach, treating it like a tree structure; can't seem to make use of ⎕R to replace text with nested vectors, can't seem to use @ without getting things like PIPER Is PIPER Expanded Recursively│I│P│E│R│ │I│s│ where only the first letter is removed and the rest is kept - and all the letters turn into cells.
"The previous output @ the indices of the acronym ⍣ until count times" except power can't do something no times
Haven't tried partitioning into Acronym/Not-Acronym and pushing onto a stack, but can't see it being nice code or easy code
@TessellatingHeckler
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬──────────────────────────┐
│Y│o│u│r│Y│O│P│Y│ │O│w│n│ │P│e│r│s│o│n│a│l│ │YourYOPY Own Personal YOPY│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴──────────────────────────┘
@Bubbler
┌──────────────────────────────────────────────────────────────────┬──────────────┬──────────────────────────────────────────────────────────────────┐
│┌────────────────────────┬──────────────┬────────────────────────┐│ Own Personal │┌────────────────────────┬──────────────┬────────────────────────┐│
││┌──────────────────────┐│ Own Personal │┌──────────────────────┐││ ││┌──────────────────────┐│ Own Personal │┌──────────────────────┐││
│││YOPY Own Personal YOPY││ ││YOPY Own Personal YOPY│││ │││YOPY Own Personal YOPY││ ││YOPY Own P…
@Bubbler
┌──────────────────────────────────────────────────────────────────┬──────────────┬──────────────────────────────────────────────────────────────────┐
│┌────────────────────────┬──────────────┬────────────────────────┐│ Own Personal │┌────────────────────────┬──────────────┬────────────────────────┐│
││┌──────────────────────┐│ Own Personal │┌──────────────────────┐││ ││┌──────────────────────┐│ Own Personal │┌──────────────────────┐││
│││YOPY Own Personal YOPY││ ││YOPY Own Personal YOPY│││ │││YOPY Own Personal YOPY││ ││YOPY Own P…
@Adám I refactored my code following your advice, and did part 2. Even when trying to be more explicit (less "golfy"), the code is still remarkably compact compared with my previous (admittedly hacked-out-quick) solutions in other languages.
@xpqz Looks nice now. Dare I ask how you use that .dyalog file?
@xpqz Follow uses a default left argument of 0 0, right? Instead of specifying that when it is called, you can build it in by adding the line ⍺←0 0
@xpqz path1 {∪⍺∩⍵} path2 can be written as path1 (∪∩) path2 or simply ∪path1∩path2
@xpqz If DAY3 only has two rows, then path1←Pairs 0 0 Follow DAY3[0;] ⋄ path2←Pairs 0 0 Follow DAY3[1;] can become (path1 path2)←Pairs∘Follow¨↓DAY3 or you could even just batch them with paths←Pairs∘Follow¨↓DAY3 and then use crossings←1↓∪⊃∩/paths
@Adám I've not figured out how to run a dyalog "script" from the command line on macos (I assume it's possible somehow). At the moment that file is a cut-paste job from a Jupyter notebook.
Ok, handy to know. From what I can tell, Dyalog doesn't install itself in a "unixy" way on macos -- it would have been nice if it put a symlink or something in /usr/local/bin -- I can obviously do that myself, but not explored much beyond the jupyter kernel yet (which works wonderfully).
I'd love to be able to say #!/usr/local/bin/dyalog at the top of scripts
@xpqz The embarrassing reason is that it hasn't had proper support for scripts until now. The piping is really a hack. Rest assured, script support is coming…
@xpqz (… and tacit functions.) No, you should use whichever form is best for your purposes. If you're doing something functional, or for small inline helper-functions, dfns are best. Tradfns are good for larger structured functions and programs, especially if you have lots of conditionals and case statements etc. Tacit functions are good for tiny idiomatic things or to avoid a scope.
Basically, if you have a flow that splits based on some condition and then remerges, then I'd say go with a tradfn.
You usually don't want to let dfns have side effects, unless you're just using a tiny dfn as a helper to accumulate a variable.
@fftwj In order to speak here, you need 20 Stack Exchange reputation points or the grant of explicit write access. If you want access, email me: adam@ with the domain of www.dyalog.com
@fftwj My mistake, you should have explicit access already.
@user708821 The above ↑↑ does apply to you, however. Email me if you want in.
@Adám - Minor infelicity that I discovered yesterday: I installed Dyalog-for-Ubuntu on my Mint VM (running in VMWare under Windows 10). While for a "Linux-on-the-iron" installation, WinKey is a good choice for the APL key, on a Windows-hosted VM, there's the risk of conflict with Windows' own use of it. Specifically, using WinKey+G both input ∇ into Dyalog and opened the Windows GameBar.
(Also, is there a GUI for Dyalog/Linux, and/or a console UI for Dyalog/Windows?)
@Adám - Yeah, that's likely - or it'll do both, like WinKey+G did both. Which is why I mentioned it... I really wish the "Fn" key that seems to be common on pretty much all keyboards (for doubling up on the F-keys) was actually detectable by Windows, so it could be used as an application meta key.
@JeffZeitlin This is why I recommend AltGr (a.k.a. right-side Alt) for all platforms, at least for English keyboards. Alternatively, the backtick keyboard is an option, and I have an idea for an entirely different approach which doesn't use the traditional layout either.
Don't want to butt in, but does anyone have any tips for the 2016 counting challenge? It's seemed like a nice way to get used to the language, but I get a lot of bloat once I get to 10
@Adám - Hmmm... RIDE looks like it might be worth using on Linux... As far as AltGr, I default to using the US-International layout on my computers, which pre-empts AltGr (right-alt) to handle such characters as ß, ø, æ, and so on.
@famous1622 Think about how you can split the digits into multiple numbers, see if your target has a simple relationship to one of those numbers, then use the other to exploit the relationship.
@xpqz Largely a matter of taste. That being said, there is almost never a reason to use a trad function.
With control structures, you avoid naming many things, which of course is easier - naming is hard, but worth it. While it may seem that programming without control structures is a limitation, it can have huge benefits.
Control structures promote laziness and contribute to technical dept.
@famous1622 That's a really nice one. I had 20÷≢1 6. Another nice one is 2×0-1-6
@PaulMansour You'd still be entering the looping dfn for each element, even if the looping dfn drops stops early. With a :For that has a conditional :Leave, you avoid any further processing whatsoever.
@Adám Not sure what you mean by a "looping dfn". I generally think of looping in dfns as tail recursion, in which case the guard behaves just like :Leave, no?
@PaulMansour Let's say you want to find the first file that contains a certain pattern. You have a looping fn that is applied with ¨ to the file names, opens each and searches for the match, returning the match if found, and some placeholder value if not. Then you get the first non-placeholder value. Instead, with tradfn loop, you process the files in order until you find a match, save that, then quit the loop early.
@Adám OK, sure. Clearly in that case you don't want to use the each operator but tail recursion (if one is staying in dfns) which allows exiting early, no?
@Bubbler split on not-string at the start is something I'm kicking myself for not seeing; I was so focused on trying to split into (acronym) (not acronym) sections in one move, or trying to work with (space word) as the separator only. I can follow most of it; it's neat