« first day (1082 days earlier)      last day (1575 days later) » 

7:52 AM
]runtime -c "{p←(⊢~∘.×⍨)1+⍳⌊⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}10000" "{p←⎕SE.pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}10000"
 
@Sherlock9
* Command Execution Failed: VALUE ERROR
 
Nuts
⎕←⎕SE.pco⍳20
 
@Sherlock9
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71
 
]runtime -c "{(⊢~∘.×⍨)1+⍳⌊⍵*÷2}10000" "{⎕SE.pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2}10000"
 
@Sherlock9
* Command Execution Failed: VALUE ERROR
 
8:01 AM
]runtime "⎕se.pco⍳2"
 
@KritixiLithos

* Benchmarking "⎕se.pco⍳2"
* Command Execution Failed: VALUE ERROR
 
⋄p←⎕se.pco⋄]runtime "p⍳10"
 
@KritixiLithos
SYNTAX ERROR
 
8:18 AM
@Sherlock9 @KritixiLithos When using user commands, the bot doesn't have dfns in ⎕SE. However, dfns has cmpx which is a functional form of ]runtime -c:
⎕←⎕SE.cmpx'{p←(⊢~∘.×⍨)1+⍳⌊⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}10000' '{p←pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}10000'
 
@Adám
  {p←(⊢~∘.×⍨)1+⍳⌊⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}10000  → 5.1E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* {p←pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}10000 → 5.9E¯3 | +16% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
⎕←⎕SE.cmpx'{(⊢~∘.×⍨)1+⍳⌊⍵*÷2}10000' '{pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2}10000'
 
@Adám
  {(⊢~∘.×⍨)1+⍳⌊⍵*÷2}10000  → 2.9E¯5 |     0% ⎕
* {pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2}10000 → 9.9E¯4 | +3328% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
@Adám Hi :) Did an initial port of my morse program, and it's incredibly slow :( It can't even get to the second word within 60 seconds. Any idea why?
https://tio.run/##pVRbTxNBFE546/4FErMPxoHgTFuKgkQeDFFDBCF4jyip3YWurrtruwQbb0kxFQqLqGA08RYvkagJDxITH3xxn/wb80fqmd2dy7b4JNDtzLl95/vOWYqejY1a0XbnsXnbNx3DNFp0fWtskjY2chqcJsbhVNAMq@TDId8zlD9C1370oqszi336iI7QncK9u9FzhlQ92/JnemZ69yPInEaINt9Hic06Dbbvg@3s6OX@K3S5Cdek4lBO/72TZ0DHplB2oVrJ2m6paGdt61rWq/ll1ymQwWzV8k3sFUs3ivNmNXvdtO1alhWwXKdYqRGvhkSveY0uP5pujcKRFQ52Dw/Q5sf@Q4dp81NBj00DGBqAhGPnafAddQ@cCDdyNHhp0Po3hG793r4WbnlhoxzWZ7u7u7L9sxClexfhCUXDL@HPLrrW
The Java version does the entire song in under 5 seconds.
 
8:27 AM
@Adám Ahh, that makes sense
 
Dec 22 '19 at 14:53, by Sherlock9
And immediately after I ask, I find it in dfns XD
@Sherlock9 In any case, using user commands with the bot is problematic. It can't handle strings.
 
It didn't end up being exactly what I needed but that you all the same
Ah
 
But cmpx is a normal function, so doubling quotes inside the quoted expressions works fine.
 
⎕←⎕SE.cmpx'{(⊢~∘.×⍨)1+⍳⌊⍵*÷2}10000' '{pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2}10000' '{pco⍳¯1pco⍵}10000'
 
@Sherlock9
  {(⊢~∘.×⍨)1+⍳⌊⍵*÷2}10000  → 6.3E¯5 |       0%
* {pco⍳1+⌈(⊢÷⍟)⌈⍵*÷2}10000 → 1.3E¯3 |   +2000%
* {pco⍳¯1pco⍵}10000        → 2.1E¯1 | +330600% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
8:29 AM
oof
 
Looks like ¯1pco is terribly inefficient.
 
@Deadcode btw, ⌽1↓⌽word can be ¯1↓word
 
I'm also thinking about how to make the second part the Goldbach function I'm working with, i.e. the rest of the function after calculating the primes, work
 
with a negative left argument behaves similarly
 
@Deadcode Other than APL being bad at looping, no. I can ask my colleague Marshall, who is the performance expert (and resident genius), but it'll have to at least wait until later, possibly until Monday.
 
8:32 AM
⎕←{p←(⊢~∘.×⍨)1+⍳⌊⍵*÷2⋄(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}72
 
@Sherlock9
5 11 13 19 29 31 41 43 53 59 61 67
 
⎕←{p←(⊢~∘.×⍨)1+⍳⌊⍵*÷2⋄(⊢,¨⌽)(⊢∩⍵-⊢)p,1↓⍸∧/¨0≠(⊂p)|⍳⍵}72
 
@Sherlock9
┌────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬────┐
│5 67│11 61│13 59│19 53│29 43│31 41│41 31│43 29│53 19│59 13│61 11│67 5│
└────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴────┘
 
Ah wait, I could just calculate all the primes up to n there
Nope. Much slower
 
@Deadcode Btw, any particular reason you use ⎕ML←3?
 
8:37 AM
@Adám Thanks, I'd appreciate it! Until it can at least do the entire song in 60 seconds, I don't see much point in golfing it.
@Adám Yes, that's to allow that method of splitting the dictionary into words works.
Is there a better way of splitting?
Oh, also, is there a way of converting an array into a set, such that ∊ will be much faster (with hashing)?
Or is that already automatically done?
 
@Deadcode Firstly, the ⎕ML←3 definition of is available in default ⎕ML as
 
Ah, cool.
 
@Deadcode If you create a loop-up function ∊∘dict and re-use it each time, it will be hashed.
 
Oh, also, is there a way of escaping newlines within a string so that neither str1,⎕TC[1],str2 nor str1,(⎕UCS 10),str2 are necessary?
 
@Deadcode (It can't be automatic unless you do ^ for the value of dict may have changed. Such a change wouldn't affect a function derived from dict as that takes a "snapshot" of the variable at function definition time.)
 
8:42 AM
By loop-up function, do you just mean defined before the loop starts? Or is that something more specific?
 
@Deadcode Please don't use ⎕TC, just use ⎕UCS. If you just want a nested array of lines, I suggest using ⊃⎕NGET'filename'1
@Deadcode Sorry, typo: look-up function. But yes, defined before the loop starts.
 
Well if I'm golfing, ⎕UCS 10 is more bytes than ⎕TC[1]...
In the header/footer of course that doesn't matter, but what if it needs to be in the code?
 
7 mins ago, by Deadcode
@Adám Thanks, I'd appreciate it! Until it can at least do the entire song in 60 seconds, I don't see much point in golfing it.
 
(Or heck, even just enough of a fraction of the song to demonstrate that it really works.)
 
@Deadcode What KritixiLithos said wasn't just for golfiness. ¯1↓ is much faster than ⌽1↓⌽
 
8:48 AM
Still not nearly fast enough. And I did try another way (without having known that syntax)
 
@Deadcode Oh, hold on, try switching to regular Dyalog Unicode instead of Extended, which s very very slow.
 
Any way to import ⌂morse into that?
 
@Deadcode Yes, just do 'morse'⎕CY'dfns' or leave out the left argument for golfiness.
@Deadcode Now I get "you know"
 
But that's with the entire dictionary being those two words, right? Not with the dict lookup uncommented?
I'll try the look-up optimization you said
 
@Deadcode Yes, I was just making sure it'd run without my extensions.
 
8:57 AM
Wow, it got up to COMET
How do I print without a newline?
Got up to COMET:
https://tio.run/##pVRbbxtFFJby5v0Lkap5QEyiMOu9@RaRhyoqVUTSVKFcKgKR613HplvvYjsKVqFIKTKJmy2FNqhI3ESLqKBSHogq8cBL96l/Y/5IOGcvM7NO3vBlPXNu3/edOeNm6DN31PSD7VN@/2hlnY8fGJrbbQ1hYc7VzQY/fDFPP97cXSBLhNLb9hefJ89NfRD63eHm3Ob8axQyNyjlk9@SxMmYR8/ugO3a8ofmR3x/AtusYt0gL49NcK1dvErLO4N@2Q9aTb/sd2@Uw9GwE/RsvVYedIceC5utm81tb1D@xPP9URkLdINesz/SwxHV6K2gP/AQePk6ddu9AdVcqI9g@48xVuP7X2@c8uinZTAjZnRSdfjkqVWp8snvNklNDgNuUOTiezz6m846b8UPDB794PK955R@@vLZjfgojMedeG9rdnambG1BFAk/gCcUjf@M/5nhh5M34RuP42O3M8MnT/j@H@1dEr@Iv6ldKu3Ovc4fnYC/Unv1V3wcj1ff4dHRBR49@RJwbYC6x6NfttfiHy/H31@406I0fgQOqPbY49EB1bqoKfpZQx
 
@Deadcode You can't easily with stdout, but you can with stderr: ⍞←
 
Hehe, stderr output was actually the first kind I found, by accident
 
@Deadcode word←¯1↓wordword↓⍨←¯1 (not just for golf, for speed too)
@Deadcode Whenever you can, use instead of
 
I tried that with positive 1 and it didn't work
 
@Deadcode In what way didn't it work?
 
9:01 AM
Ah, guess it only works with the ⍨
Which I didn't think to try
 
@Deadcode Of course. It is the same function , so the arguments need to be on the right sides.
 
Well, it still only gets up to COMET
 
@Deadcode It is still very loopy conditiony code. I wonder if compiling it would help.
 
@Adám How can I get ⊃⎕NGET'filename'1 to work? It returns errors whenever I try to access the contents of the result
 
@Deadcode Works for me:
 
9:11 AM
Oh, I accidentally used ⊂ instead of ⊃
What about CPU share: 0.04 % - any idea what that's about?
Is TIO intentionally throttling APL programs?
 
@Deadcode No, but it may have been busy with other things, or it spends time waiting. No idea.
 
Java got CPU share: 128.63 %
Most things get nearly 100%.
 
Which doesn't sound quite right either.
 
Well Java is obviously doing multithreading. It runs even faster than the C++ version on TIO
(though another variance would be the type of hashing they use)
 
@Deadcode How could it parallelise this algorithm? Doesn't it all the time depend on everything previously computed, i.e. it needs a single thread?
 
9:23 AM
Yeah, that part doesn't make sense :) I was wondering the same.
The only thing I could think of is that maybe it parallelizes the set membership test. Each one individually.
 
@Deadcode Yay, compiling got me up to BLITZ!
 
Wow.
How do you do that on TIO?
 
@Deadcode One min, let me fix it up a bit.
 
Oh, and when I try ⎕FIX it says DOMAIN ERROR: The type of code in "rudolph.dyalog" could not be inferred
 
@Deadcode What does the first line of rudolph.dyalog look like?
 
9:29 AM
⎕IO←0
Oh, I moved some things around and now it says DOMAIN ERROR: There were errors processing the script
 
@Deadcode ⎕FIX requires that the file contains one or more APL "items" which could be functions, namespaces, etc. Insert a line at the tom saying :Namespace and one at the bottom saying :EndNamespace and it should work.
 
Maybe it needs a UTF-8 BOM
 
(TIO injects these lines around the Header/Code/Footer content)
 
Ahh
 
@Deadcode Here it is compiled, but this run didn't get BLITZ. Probably random variation in performance:
 
9:44 AM
@Adám Thank you very much... what part of that compiles it?
 
@Deadcode 400⌶
 
And what is dict R doing?
 
@Deadcode The compiler doesn't allow prompting for input, and doesn't like global variables, so I'm passing dict and i in as arguments.
 
I tried passing it d instead of dict and it won't work...
 
@Deadcode d is a function. Remember that functions can't take functions as arguments? However, we could make R an operator…
 
9:52 AM
Ah, right. What's the syntax for that?
 
@Deadcode The header is actually a "picture" of the calling syntax, using a parenthesis to isolate the operator name and its operand(s), so (d R) i:
 
Oh, also, I still haven't really got ⎕FIX to work locally. It doesn't give an error anymore, but I see no output when I run R
 
@Deadcode Can you Gist/PasteBin/something the file?
 
Well, the same thing happens if make the file something very simple, such as:

:Namespace
∇R
⎕←123456

:EndNamespace
 
@Deadcode You have to run R, not just define it.
 
9:59 AM
I'm running R on the immediate prompt...
It still makes no output if I put a line to run R in the file itself
 
@Deadcode Doesn't that give you an error? or do you have something else there called R? The namespace is anonymous, so it doesn't survive long. Try changing that to :Namespace mystuff and running mystuff.R
 
Oh, no, now it gives an error:
line(5,0) : error AC0008: error (VALUE ERROR) executing line "R"
^
Complete: 1 error.
@Adám Ohh, that works. :)
 
@Deadcode Alternatively, you can get a reference to the namespace upon import, with ref←⎕FIX'...' and then use ref.R
You can even call directly with (⎕FIX'...').R
 
Ahhhh, that makes sense :) Nice.
Is there a way to time a program? Like the equivalent of time on a *nix prompt.
 
@Deadcode from the immediate execution mode, prepend the statement with ]runtime (and enclose your statement in "" if it has spaces or quotes)
@ktye Well hello there. Fancy seeing you here!
 
10:08 AM
@Adám hi adam.
 
I though you'd gone all out K ;-)
 
i do pretty much so. but look around sometimes.
 
@Adám the default ⎕ML is 1, correct?
 
@rcabaco Yes.
 
i am asking because the tutorial uses a different (⎕ML←3) level
(i think it is 3)
 
10:13 AM
@Adám i just recently found that jay left dialog almost a year ago. he even mentioned iv on the on his good-bye post!
 
the differences i noticed so far are in ⊃ and ↑
 
@rcabaco Right. The tutorial was ported from a different APL.
 
ok, so i am not doing anything wrong. thanks
 
@rcabaco That's the most noticeable difference. But there are more.
 
@ktye but he misses it: github.com/jayfoad/aoc2019apl
if i can play with words a little :)
@Adám so ⎕ML is something to keep in mind, similar to ⎕IO, or is it changed rarely?
 
10:19 AM
@rcabaco that's cool. on a side note, one thing a took over from apl to k is the complex number notation 1i2 (not the classic 1J2) and also 1a30, which i have a lot more practical value for which is 1ad30 in nars2000
 
@rcabaco Like ⎕IO, if you trace into other people's code, then you need to keep it in mind, and if you write code for others to use as utilities, then you should localise ⎕ML←1 for yourself.
 
noted. thank you
 
@ktye I thought A and K didn't have complex numbers.
 
@Adám they don't. but mine has. i won't touch a language without.
 
@ktye Oh, so you had a typo? "one thing a took over from apl to k" should be "one thing i took over from apl to k". I see you've become a Ker, abandoning uppercase in English.
@ktye Interestingly, APL2 allows 1D2 and 1R2 in addition to 1J2 but Dyalog doesn't.
 
10:25 AM
@Adám yes that's right. I instead of A. and i still didn't disassemble the keyboard to remove shift and space bar.
What is D, degree?
 
@ktye Yes.
@ktye You need space in K much more than in APL (actually, in APL, you can always avoid spaces, I think).
 
FWIW, it's not much faster locally (it gets a bit farther in 1 minute though - to RECALL), and it takes 100% of one CPU core
 
@Deadcode I'll ask Marshall when I have a chance.
 
@Adám "space" for what? vector notation?
 
My current version:
https://tio.run/##pVTLbtNAFF3HXzELJKcqM36meamrqEKVoKCKDVJEFWKnNRg7SlyVCNhQVJrSVkCFxAqhigULJHbs2PAp/pFwr@15Jd2RNO7M3Nc5597xYBzTYDaI0/1Ffvl5@35@8sE2zOfpZBqacNB7ZAajZGoaQTTMwObUW047P/@9Zj7uH62TTWKaL73Xr4pnn03HcZT16/21Wxi7a5r52TEsdu5sPTStw@nEitPhILbi6Ik1nmUHaeKxpjWNspCOB8Nng/1waj0N43hmYbUoTQaTGRvPTMcIoHR@epaffkGLkZ@@qwdkd41E3V43SsaH2YN02h0epNEw3Iu6QTjODrpH6SToFkTuhkl3lB4mwT3cLXrIgzgucTaIu0Ech7ge8YlnE5c0iecQj7hNXLmkgSaPOPi1iddCZ/D1iA1218GV0yBt4kMmtLXx0SJugzhNiPF8cINAqIDZHI9sYDhEgwU8ffDzy5xeA84BTIt4HqRpOOWxi6GAE6LLWi3MgsAALmyhro1U0K/AYEMaOC/Q2eiN8GDdaCMpKNkkvg@OUKoNlhKPygTZ2qQ
 
10:29 AM
@ktye No, for disambiguating subtraction/negative, before comments (but who needs those…)
 
Took 326.7 seconds to finish
 
you could also write a:(1,(-2),3) just as well. it will be a unitype array at the end.
 
@ktye How do you write 5-2 without spaces? 5-(2)?
 
@Adám if you mean 3, you can write 5-2. If you mean 5 -2 you could use 5,(-2)
 
@ktye But nobody actually writes 5,(-2) right, so you need your spacebar? Also, English is much easier to read with spaces…
 
11:29 AM
That was the odd run out. The rest of them are 293.6 - 296.6 s
 
 
1 hour later…
12:35 PM
for the regex matching challenge, i've also been trying a solution without ⎕r by converting the regex into an adjacency table (3d-array) of an NFA (with which matching can be checked using simple matrix operations), what would be a good way to handle _-moves?
 
12:52 PM
@Deadcode OK, I spoke with Marshall. He says it seems to be an NP-hard problem for which APL isn't very suited. However, you might be able to get a significant improvement by first making the flattened Morse code for all the words in the dict, and then matching(+backtracking) with that.
 
@Adám Hmm, that might actually golf better too. But did he profile it or anything, to show which part is actually slowest?
 
@Deadcode No, I just spoke with him about it. You yourself can profile it using ]profile or profile from dfns.
 
Also, I notice that in Dyalog Unicode I need 64 64 64 64⊤A whereas in Extended it's 64⊤A. What's the best shortcut for that?
 
@Deadcode 64⊥⍣¯1 or (4⍴64)⊤
 
Thanks, and also, I can't use ¯1 as a left parameter to - is there any other way to do that without giving a specific number?
 
12:59 PM
@Deadcode No, you'll have to compute the specific number.
 
In 64⊥⍣¯1, where does the A go?
 
@Deadcode 64(⊥⍣¯1)A or 64⊥⍣¯1⊢A remember the thing about operands adjacent to arguments?
@Deadcode How did you get the Jelly dict offline?
 
Yep but I'll have to review that to really understand it. Okay, now the profiler - ]profile opened it up but it's unclear how to use it...
By cloning Jelly
 
@Deadcode Did you try the help: ]profile -? or have a look at the Application Tuning Guide
@Deadcode D'oh, it's right here
 
Sorry, you asked me how I did it, not how the quickest way for you to do it would be :)
but it's a lightweight clone
 
1:13 PM
@Deadcode No problem. Somehow I overlooked the file in the Jelly repo.
 
Well the profile results aren't a big surprise. If I understand correctly, 31% of the time spent doing dictionary lookup
Nah, actually just 2.7%.
@KritixiLithos I can't help you with that question but it's cool you're working on it :) in your plan, is it capable of doing backtracking?
 
1:52 PM
@Deadcode i didn't think i needed to because once i realised alternation didn't need backtracking, i thought the rest of the problem will resolve itself easily, but now i can't find a nice way to handle _-moves. maybe i will try finding all reachable states by manipulating the adjacency matrix for _-transitions, and apply it to the respective matrices for a and b-transitions
 
I don't recognize the terminology – what are _-moves?
 
_ is what the challenge uses for the empty string
so I meant transitions to other states that don't consume letters, i.e. transitions that consume _
so this isn't actual terminology, the right term would be en.wikipedia.org/wiki/Epsilon_transition
 
Ohhh, haha, I thought it was a technical term, but you were referring to a specific attribute of this challenge
So why doesn't alternation need backtracking?
 
2:27 PM
the nfa is stored as a 3-d adjacency table, so an adjacency table for each character. I can select which matrix I want (depending on the current letter of the input that I am processing) and multiply the adjacency matrices to get a new matrix that gives how many paths of length $(how many input letters processed) go from state i to state j
and alternation should present two different ways of reaching the local final node from the local starting node ("local", because the entire regex can be thought of as made up of subregexes)
so these transitions can happen simultaneously and I only need to check if there are any paths from the starting state to the ending state
oh wait, all the lowercase letters can be used as input and not just a and b
 
 
4 hours later…
6:15 PM
Well it works, but even with base 256 encoded word-division, it doesn't even beat @Adám 's base 64 encoded letter-division version in terms of byte length:
https://tio.run/##pVRbaxNBFEYUlu5fyIN5ECZBZzZJ7xQfJJEiWoUi0tJEGpOYbl2T0ERCqEWwJSbbbLG17ZsipWIgxQfrDaEvnaf8jfkj8WyyO5e0b26S3dlz5pzzfd85k3TJwtla2irme2zn4N4jVn8f0dHL4lo5h8AQX0TZ54Uy0hPgiIamotOs9SuMniarN4O3gwitj2687t@TpFyyzEoylAzfcAPnEWL2Jiwezt59jIxX5TXDKmbSlmGZz4xSrbJSLIySSaNsVnK4lM68SOdzZWM1Z1k1I2tmKmaxkF6rkVINRXXWeJcIzgfNmfhMtTcHOCDxeTt0y@ijDJ@3E2x7K@7aG3ZojDk/JsbCzD6OjU8w@8toMDYNpknMnDagufOEOadopdthzk96xpy/zD7S6GYgS/e7HXjSfY1@jFeLGj2OaN1
 
@Deadcode How long time does it need to complete?
 
A minute, locally.
 
@Deadcode Well, at least you learned some more APL. I hope you've had fun so far. Want some golfing tips on this latest code?
 
Yes please :) I know the goto statement can be, but what about the rest?
 
@Deadcode Right, the →2/⍨0≠≢i becomes →2/⍨×≢i and D[w]w⌷D but w⊃D gives a better output (in this case).
 
6:22 PM
Right, I would add the ⊃ for the final version, but the spaces between are illuminating for testing.
 
@Deadcode M←⊃¨(,/morse)¨M←∊∘morse¨
 
Ooh, nice.
So the i↓⍨←≢⊃M[w←(∊{⍸M⍷⍨⊂⍵↑i}¨⌽1↓⍳25)[⊃C]] becomes i↓⍨←≢⊃M[w←(⊃C)⌷∊{⍸M⍷⍨⊂⍵↑i}¨⌽1↓⍳25], though that only saves a byte.
 
6:37 PM
@Deadcode Since the number of elements you drop from the beginning of i is always a single number, you can count how many numbers that is (it always giving 1) and use that to drop from C: C↓⍨←≢i↓⍨←≢⊃M[w←(⊃C)⌷∊{⍸M⍷⍨⊂⍵↑i}¨⌽1↓⍳25]
 
Oops, forgot to declare one of the variables local to the function:
https://tio.run/##pVRNaxNBGEYUlu5fyMEchEmQmU3Sb4oHSaSIRqGItJhKYxLTrWsSmkgItQi2xHSbLba21YseSsVCigerVoReOqf8jfePxDfJ7sxs2pubZHf2/Zrned53ki5ZNFtLW8V8B7b27j6E@vuITl4Wl8s5gob4HMk@L5SJnkBHNDQRnYTm7zB5mqreDN4KErIyvPq6d0@xcskyK6lQKnyjmzhDCNhruHgwfecRMV6Vlw2rmElbhmU@M0q1ymKxMMzGjbJZydFSOvMinc@VjaWcZdWMrJmpmMVCernGSjUS1aHxLhGcCZpT8ankVLWTRCTQsKHxqYfy/CgBm@vxvjE0As7PsZEw2Iex0TGwvw4HY5NoGqfgHCGY24/BOSGL7RY4v/gZOH/BPtD4WiDLd9stfPJdjX@OV4saP4xo7Va7VdGg2VgZuv@mtoTRE/yYN/nOdb4ZuHolD41v4OzNBoz5PJbh32dRGi0z124NZQPgbPAf7dYE2Pt8/97CNU3D/I1YgW/
 
@Deadcode Not a byte saver, but I'd write ⌽1↓⍳25 as 24-⍳24 or -∘⍳⍨24
 
Ah, that's nice. I didn't like that it went 24..1 but had a 25 creating it.
 
@Deadcode One of the reasons to prefer ⎕IO←1 ;-)
 
Heh, well I feel the advantages of ⎕IO←0 outweigh that by far :) 1-based indexing just feels wrong to me.
 
6:42 PM
Ooh, I'm working on a big one…
@Deadcode Really, you want the prefixes of i in reverse:
⎕←⌽,\'hello'
 
@Adám
┌─────┬────┬───┬──┬─┐
│hello│hell│hel│he│h│
└─────┴────┴───┴──┴─┘
 
Ooooh
I suspected there was a shortcut for that!
 
@Deadcode only ever gives one "1", right?
 
Not sure what you're asking... but there are in many cases multiple dictionary words matching a morse string of a particular length
 
@Deadcode I think you can change representation in w. Instead of making it an index, you can make it a mask.
Compare:
⋄ ⎕←2⊃'Hello'
⋄ ⎕←0 1 0 0 0/'Hello'
 
6:50 PM
@Adám
e
e
 
Hmmm
 
Anyway, right now I'm trying to replace {⍸M⍷⍨⊂⍵↑i}¨⌽1↓⍳25 with something like ⍸¨⍷∘M¨⌽,\i
 
I applied your prefixes-in-reverse thing to get C↓⍨←≢i↓⍨←≢⊃M[w←(⊃C)⌷∊{⍸M⍷⍨⊂⍵}¨⌽,\24↑i]
(-1 byte)
But since ⍵ is at the end of the {...}, that can probably be golfed down further...
 
@Deadcode Even if it wasn't. I'm thinking ⍷∘M¨
@Deadcode Both of these should work:
C↓⍨←≢i↓⍨←≢⊃M[w←(⊃C)⌷∊⍸¨⍷∘M¨⊂¨⌽,\24↑i]
C↓⍨←≢i↓⍨←≢⊃M[w←(⊃C)⌷∊(⍸M⍷⍨⊂)¨⌽,\24↑i]
 
Aha! C↓⍨←≢i↓⍨←≢⊃M[w←(⊃C)⌷∊(⍸M⍷⍨⊂)¨⌽,\24↑i] is exactly what I was thinking
 
6:58 PM
@Deadcode Can you not use M⍳… to find them all in one go?
 
Doesn't that only find the first occurrence?
 
@Deadcode It does.
 
Well I need all the occurrences, so how does that help?
Does Dyalog APL have any compression built-ins? Like deflate or zlib?
There are a lot of zeroes in the list of choices
 
@Deadcode It does.
 
I think it'd compress very welll
@Adám what are they?
 
7:04 PM
@Deadcode You don't know about APLcart, do you? Try it!
 
Ahh, thanks, indeed did not know.
 
@Deadcode Hm, right, but ≡¨ could work…
 
Oh, to get a mask.
 
Right.
@Deadcode Ah, no, because we want to match prefixes, so we need no?
 
⊃¨(⊂'pre')⍷¨('abc' 'pre' 'pref' 'prefix' 'def')
How do you get the bot to respond?
 
7:14 PM
@Deadcode Prefix with ⎕← or ⍞←
 
⎕←⊃¨(⊂'pre')⍷¨('abc' 'pre' 'pref' 'prefix' 'def')
 
With or without backticks?
 
@Deadcode Also, it has a temper (and doesn't care about edits)
@Deadcode No backticks, but you can use four (or more) leading spaces for monospace font.
⎕←⊃¨(⊂'pre')⍷¨('abc' 'pre' 'pref' 'prefix' 'def')
 
@Adám
0 1 1 1 0
 
7:16 PM
@Deadcode But also:
⎕←⊃¨'pre'∘⍷¨('abc' 'pre' 'pref' 'prefix' 'def')
 
@Adám
0 1 1 1 0
 
But that doesn't apply, since the string we use will already be ⊆'ified, right?
 
@Deadcode I'm a bit confused about what exactly the data looks like now.
@Deadcode In any case ⊃M[]M⊃⍨
 
Hmmm, I thought I tried that and it didn't work. Guess it was something else I tried.
 
@Deadcode →2/⍨×≢i becomes →2⊣¨i
@Deadcode Will C not be exhausted simultaneously with i?
 
7:31 PM
It would, except for the packing I had to add one 0 element to the end.
@Adám Ooh, nice.
 
Actually. Maybe you don't need to check for a looping condition at all. The program will just error and quit when done ;-)
 
Hehe, good point.
Unless it never halts...
 
Ah, right, when C becomes empty, ⊃C becomes 0 which will select the first choice. If ⎕IO←1 it would error.
 
BTW, I really wish X⍳Y returned ¯1 for "not found".
 
@Deadcode Oh, but it is often very useful that it gives an index beyond the end.
 
7:36 PM
Or ⎕IO-1
Oh? How so?
Program is running in 50 seconds locally now
These golfs have optimized its speed a bit too!
 
Because then you can tack a fall-back value at the end:
⍞←'ABCDEX'['31415'⍳'1234']
 
@Adám BXAC
 
Hmmm
If it were ¯1, you could still tack the fallback at the beginning and increment the result of ⍳. Would cost 2 bytes for the increment, but that would be saved elsewhere where you could use a <0 comparison...
(I think)
I mean, it just seems there'd be many cases where you have to compare against the length, instead of comparing with 0, given the current behavior
 
@Deadcode Usually, you wouldn't use to check for membership, since there's
 
I mean when you're checking for both.
But maybe it almost always just works out. I mean, converting this morse program from a procedural to a more functional approach sure worked out.
Though still not better Kolmogorov complexity than the letter-partitioning method, for this song. But it'd win by far with something a bit longer...
 
7:45 PM
@Deadcode Using an index beyond the length also allows extension to negative indices selecting from the rear. (Though Dyalog APL doesn't have this — yet.)
 
7:55 PM
Can 'big'⎕CY'dfns' interface with base conversion?
What does this mean? aplcart.info/?q=huffman# "cmp←{cmp←1} dfns.packH exp"
 
@Deadcode I don't think so, but you may be able to persuade these people into adding it.
@Deadcode Every dfns member has an explanation at notes.membername. You can also access everything online.
 
 
3 hours later…
10:43 PM
@Adám Found a Unicode bug in Dyalog Extended. It isn't handling high-minus properly: tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qG@qp/…
And thanks again very much for your help!
 
@Deadcode Thanks, yeah, I know why. I'll have a look. But again, Extended is highly experimental.
 
Is there any way to use Extended locally?
 
@Deadcode Sure. Have you tried looking at the README.md?
 
Thanks.
So, I don't know if you want to use this, but this is your submission https://codegolf.stackexchange.com/a/197456/17216 to .-…--..---.-…--… the red-nosed reindeer modified to use base 256 instead of 64 (dropped from 188 to 150 bytes):
https://tio.run/##pVTPa1NBEMaT0H/BS/FgaessVj2rRaiIFO2l9OAlkKCHaoIR0ypWiJC@/HjS6NNYKzZii6FGQrSoh6rwvv9k/pG4Sd7uzia9ucl72d2Znfm@b2aTyq1Sej21mr1DmbWHmfvpTLrHL15fv8mlrXMTHGzmelyrcK14L/sgn@HwA1eKHLY4qMxxqa5ncWtuNu6c59IrvXeRK3sXZvX5@WUOv09x2N1A/fYNrv1F99IzNDnaeoTdW4tooLyA6nSGy80VfMN7HHHlOarYxmGKG9UlFPGTw/Iilz/mV@IfOhWCwiTexZ84aHEUocPR0RLeYIfDbTQ4@KwjIXhyArv4cxVfdCIc
It cost 2 bytes to work around the high-minus bug.
(The 3+)
 
@Deadcode It isn't valid because you use characters that are not in Extended's single byte character set. The following characters from ⎕AV cannot be used in Extended: ɫ¥£¢ý·€´§¶∣¿¡
 
10:52 PM
Is my use of this technique in Dyalog Unicode valid?
 
@Deadcode Only if you claim to actually use Classic, which means you can't use any of ⍤⍠⍸⊆⌺
 
Can't use them in code, you mean?
 
Right.
 
Why does it work if it's not valid?
 
@Deadcode Because TIO doesn't check adherence to the claimed character set.
 
10:58 PM
It works locally too though.
 
Of course. Dyalog APL doesn't check either. (How would the interpreter know what you claim online‽)
 
Oh, I see what you mean. It's more than 256 characters that can be used.
 
Yes. Dyalog allows you the full Unicode range.
 
@Adám Then why does TIO claim that this "code" is 5 bytes SBCS even though none of those characters are in the Atomic Vector?
 
@Deadcode Firstly, Extended doesn't rely on ⎕AV for code storage, but rather my own SBCS format. Secondly:
9 mins ago, by Adám
@Deadcode Because TIO doesn't check adherence to the claimed character set.
 
11:08 PM
Damn, that's really surprising... but that breaks lots of submissions on PPCG that claim to be N bytes...
Unless everybody is self-policing that they're adhering to the character set
 
@Deadcode You think? I have rarely seen such.
 
So everybody knows to avoid using ⍤⍠⍸⊆⌺?
was quite useful in my Morse program :\
 
@Deadcode You can use those, if you claim to use my SBCS, but then you can't use those otherwise unused characters. See:
46
Q: When can APL characters be counted as 1 byte each?

AdámPrompted by this. The question of APL's encoding often comes up, and many times a helpful soul links to Wikipedia's article on the APL EBCDIC codepage. However, each implementation of APL has its own encoding rules. What are they?

 
I don't suppose it's possible to call up a version of ⎕AV that doesn't contain £¢¥ýɫ· and does contain ⍤⍠⍸⊆⌺?
 
@Deadcode Not directly. While it is possible to change the content of ⎕AV, I have not done so for Extended. Could be done though:
⋄ ⎕←'⊆'∊⎕AV
⋄ ⎕←(¯1↑⎕AVU)←8838
⋄ ⎕←'⊆'∊⎕AV
 
11:21 PM
@Adám
0
8838
1
 
I suppose I could just do it in the header... that's probably fair
 
I guess, since that is the character set in use.
 
11:34 PM
0
Q: Is there a symbol to concatenate strings into one character scalar in APL?

Jaden RanzenbergerI'm new to APL and am aware that the , (catenate) function will catenate character vectors, and thus assigning I as the following (I am using the < character to represent the assignment FYI): I<'hello','world' will result in h being equal to hello world And each word can be indexed independe...

 
@Feeds @Bubbler How is the catenation even relevant for the question?
 
@Adám I know it isn't relevant, but it's true that it is incorrect.
 
I wasn't disagreeing, just expressing wonder.
@mondlos Hi there. Interested in APL among the other old computing artefacts?
 

« first day (1082 days earlier)      last day (1575 days later) »