« first day (1327 days earlier)      last day (750 days later) » 

1:25 AM
<phantomics> simd support is a goal, I'm looking at different options
<phantomics> simd support in Common Lisp is still a new field, and there are lots of different implementations, github.com/digikar99/numericals seems like a solid one but it's SBCL-only so far and designed to depend on NumPy for intensive calculations
 
 
5 hours later…
6:51 AM
{{⍵+3*⍨⍳3}¨⍵+3*⍨⍳3}¨3*⍨⍳3
I want to get all possible sums of cubes from 1 till n
the current approach looks a bit.. clunky. Is there a good way to do it with ⍣?
the one i've put up is for n=3
@DyalogAPL remember seeing this on github
 
 
1 hour later…
8:03 AM
f←{{(⍺+⍵*÷3)*÷3}/⍵/1}
is this correct for the expansion of cuberoot(1+cuberoot(1+cr(...)) n times?
 
@Razetime that is equivalent to ↓↓∘.+⍣2⍨3*⍨⍳3
@Razetime a way to dissect reduces (and scans and inner/outer products) is to get a string representation of what it is you are calculating, like so
⋄⎕←{{⊂∊⍕¨'('⍺'+'⍵'*÷3)*÷3'}/⍵/1}5
 
@user41805 (1+ (1+ (1+ (1+1*÷3)*÷3 *÷3)*÷3 *÷3)*÷3 *÷3)*÷3
 
8:22 AM
@Razetime you want to sum all possible combinations of three 3*⍨⍳3s - so ∘.+/3⍴⊂3*⍨⍳3
more like your original one - {(⊂⍵)+3*⍨⍳3}⍣3⊢0
 
@user41805 thanks a lot, I'll store that snippet
looks like I was making a mistake, only sums of two cubes are required
so +/2⍴⊂3*⍨⍳3 i think
 
@Razetime did you mean ∘.+ instead of +? because this sums the cube of n with itself
 
yes, ∘.+ added to that
⋄{2≤2÷⍨+/⍵=∊∘.+/2⍴⊂3*⍨⍳⍵}
 
8:41 AM
@Razetime Illegal code
 
now my function is this
⋄{2≤2÷⍨+/⍵=∊∘.+/2⍴⊂3*⍨⍳⍵}1729
 
@Razetime 1
 
13
Q: Am I a Secondary Taxicab?

DrQuariusBackground Ramanujan's number, 1729, is called a taxi-cab number due to the (possibly apocryphal) tale of Hardy boarding a cab to visit Ramanujan in hospital having this number, which seemed bland to him. It's since known as the most famous of a class of integers known as "taxicab numbers" whic...

 
@Razetime there's one very simple way to save 3 bytes
 
yes, remove 2÷⍨ and replace 2 with 4
 
8:56 AM
18 in dzaima/APL (ignore that enclosed simple scalar, that's been long fixed ._.)
 
<kritixilithos> @dzaima another trivial 3 bytes from yours
 
cool!
Do you mind if I post that?
 
go ahead
 
soo
how do I do the f←⍎⊃⍬⍴¯3↑⎕SRC⎕THIS thing in tio for dzaima/APL?
or is using ⎕← and encoding the input directly aalright?
 
9:06 AM
@Razetime you can just do f←(\n code \n)
 
like this?
 
@Razetime yeah, but for the input to be a REPL, you need to add a -s as a command-line argument
 
yup, worksss
 
 
7 hours later…
4:06 PM
Presenting APLcart's 3rd quiz: Filling in the obscured symbol
@TessellatingHeckler ^
 
 
1 hour later…
RGS
5:20 PM
@Adám what were the key combos that need to be used in order to trigger the keyboard shortcuts?
And IMHO "Reveal symbol" would be better than "Reveal obscured"
 
@RGS whatever your browser's access key is
 
RGS
btw looks really cool!
@dzaima yup, now I recall you once told me this. Thanks!
 
@RGS His̲tory :-(
 
RGS
@Adám ?
 
@RGS On Firefox, Alt+Shift+S opens the history menu.
 
RGS
5:30 PM
@Adám yeah, but I didn't understand why that was your reply/what it meant as a reply :/
 
@RGS "Reveal symbol" would need to have accesskey=s
 
RGS
ah! you replied to the "wrong" msg, that is why I was so lost
but I have seen plenty of time that the access keys fall on the 2nd, 3rd, or some other letter of the word
 
@RGS Oh, oops. Sorry.
 
RGS
You can still have the access key under the "o", for e.g.
 
@RGS Yeah, but that's so not mnemonic.
 
RGS
5:32 PM
@Adám but after 3 or 4 usages muscle memory will just kick in
also, you can always use your eyes and check for the _; it is still faster than dragging the mouse over there :D
or maybe "Reveal obscured symbol"... or would that be too long?
 
There's plenty of space, but three-word buttons look weird to me.
 
RGS
@Adám then "Reveal the obscured symbol" ,that's no longer 3 words :P
 
5:47 PM
Been thinking about two(!) new possible primitives for BQN: « and ». These would shift cells into an array from one side or the other while keeping the total length the same. The dyadic forms would be defined as {(≠𝕩)↑𝕨∾𝕩} for » (which seems to be the more common one) and {(-≠𝕩)↑𝕩∾𝕨} for «. Join to is like Catenate First.
Together these are used 18 times in the BQN compiler, which is nearly as much as Take and Drop together (22 times). I also remember Aaron commenting that ¯1↓0, is very common in Co-dfns, although I can't remember when. They're defined as Shl and Shr in md.bqn and used often there as well.
 
@Marshall So like ⊣⍪¯1↓⊢ and ⊣⍪⍨1↓⊢?
 
@Adám Yes.
 
Monadic form would push the prototype?
 
@Adám Was just getting there. It's called the fill in BQN and I am still putting off finishing the spec for it.
I think this is actually a better model than 2-wise reduction (or Windows in BQN) for doing an operation on pairs of elements most of the time. In APL it's common to write 2-˜/0,v on a vector v in order to keep the length the same; with shifts this would be -⟜».
Unlike any Catenate version, this makes it very obvious that the length stays the same, because there are no length-changing functions at all.
It seems to be used in a lot of different contexts, even though it's probably more common in text/stream processing like the compiler and markdown processor. For example (×`1»⊢)⌾⌽∘≢ gets strides (distances between elements along each axis) of an array.
 
Supposedly, and and could also be optimised to recognise that one operand is « or »?
@Marshall Try doubling your backticks?
 
5:59 PM
@Adám Yes, but -⟜» etc. would be fairly fast even without it, since you're only eliminating some data movement.
 
Wouldn't the optimisation double speed from two copies to one copy? And it could be made in-place if refcount permits.
 
@Adám Sounds about right, it's just that half of optimal for that combination is still very fast. Unlike for example unoptimized 2-⍨/ which is a disaster.
 
@Marshall would definitely make the ugly -˜´˘2↕ better (even when you want the decremented length)
(fwiw i've grown to like the fact that 2 f/ decrements the length)
 
I also think going from -⟜» to «⊸- to get difference-from-next instead or difference-from-previous is more intuitive than 2-⍨/0,v to 2-⍨/0,⍨v, and you can do some fancy stuff you couldn't with a two-wise operation like taking a symmetric difference with (»-«).
There is still some possible confusion in that after doing », the value in a position in the result was the previous in the argument, which looks backwards. This is because you're looking at the result-to-argument mapping while the glyph is chosen for the argument-to-result relationship.
@dzaima I think the position I've reached is that it's sometimes exactly what you want, but often there is a default value you want to include. Windows is very good for the former case and shifts are very good for the latter.
 
@Marshall unless i've missed something, windows isn't very good for the decremented length case either. -˜´˘2↕ it way too messy for me
 
6:11 PM
@dzaima I think you don't always want to actually do a reduction when decreasing the length.
 
@Marshall i've used (or at least i think i have) 2-⍨?/ or 2=/ or similar without re-appending things quite few times
 
@dzaima Not saying it never happens, but I think it's rare enough that -˜˝˘2↕ is not that much of an annoyance.
 
(another fwiw - i've actually thought about single-symbol 1↓ and/or ¯1↓ but considered them too simple to have their own characters)
 
What does ""»"abc" give?
 
@Adám i assume just "abc"
 
6:17 PM
@Adám Just "abc".
 
Why are you defining them in terms of instead of in terms of ?
 
@Adám shows the length invariance better imo
@dzaima (and that's incorrect too. correct expression would be ↓⍉↑ n,/⊂¨A)
 
If they were defined in terms of then it'd give the more interesting "bc"
 
@Adám would that allow for "12"»"abcde""12abc"?
 
Ah, no, I get it now. They can push multiple elements.
 
6:19 PM
Yep, that's the idea.
More precisely, multiple major cells.
 
What does "abc"»"de" give? "ab"?
 
@Adám Yeah, "ab".
 
Heh, Monadic »˜ is a fun no-op.
 
@Adám consider »⟨⟩, equivalent to ⟨0⟩»⟨⟩
 
What happens if the argument ranks differ?
 
6:22 PM
So dyadic »˜ is kind of an interesting way to write ≠⊸↑ if you know the left argument is shorter.
 
I can see these two being useful for golfing.
 
@Adám It follows the same rules as Join to, so the largest difference allowed is 1 and a lower-rank argument will be promoted. But I should probably add the requirement that the left argument can't have a higher rank than the right.
 
Why?
 
@Adám Because then the length in the definition is meaningless, because it corresponds to the second axis in the result.
Another subtle point is that the default left argument is not just a fill element but a major cell of fills 1↑0↑𝕩.
 
@Marshall Ah, right, but you could say that if the left rank is higher, then the take should be 1. I.e. {(⍴⍺)⍴⍵}.
 
6:28 PM
@Adám Seems very likely to be a programming error rather than intentional though. The shape of the result wouldn't match the shape of the argument even though it does in all other cases. And if you want to do that there's always »⟜≍.
Or even (𝕨»⊢)⌾≍ to bring the rank back down afterwards (that is, the first major cell of 𝕨, or 𝕩 if 𝕨 has length 0).
Seems like a fairly positive response? I'm a little worried about burning two primitives on something so simple. But I also expect the cost in terms of human memory, which is the main problem with adding new primitives, to be pretty low.
 
And ShiftLeft/ShiftRight is something programmers feel comfortable with.
 
Yes, the similarity to the C operators is nice.
 
Question is if it should be » or or even or
 
@Adám those have more of a resemblance with >, whereas » is slightly less so, which imo is preferrable
 
Well, if you want to resemble >>
 
6:40 PM
Also Latin-1 supplement is very good for font support.
I'm out of space on the <> keys so I don't want to make that too easy to confuse.
 
@Adám it resembles it beautifully in the shape (just scaled down), while decreasing the influence of >/digraphiness
 
Also wondering about good names for them. Shl and Shr in md.bqn are actually opposite so shift-left/shift-right in C because I used "shift in from the left/right" as a mnemonic, which suggests that the use of left and right is not so obvious.
 
@dzaima (and also imo it's good that it doesn't completely represent >>)
 
Shift and Shift Back could work.
 
How about Forward and Backward? Mnemonic of the » FF symbol on your media player?
 
6:45 PM
@Marshall i was also thinking about « having args swapped - 1‿2‿3«0 vs 0»1‿2‿3 become, imo, more "beautiful". extremely stupid for actual usage though
 
And obviously they will be typed as a backslash followed by the left shift or right shift key.
But actually maybe H and L? Really running out of space.
(Even space itself—the final frontier—is used!)
@Adám I like these, but they're kind of awkward as verbs. Maybe Forward and Backward for the monadic case and Forward With (By?) and Backward With for dyadic?
Kind of wanted to do Push and Shove, but they don't really give any hint as to the direction and Push is different from the typical array-based-stack operation.
 
@Marshall Hm, but it is really the "swap" of with/by, no? Forwards and Backwards? As in X forwards Y.
 
@Marshall "0 shifted in 1‿2‿3" / "0 shifted in back of (?) 1‿2‿3"
 
Push before and Push after?
 
@Adám push already means a pretty specific thing. though i like shifted [in] before/after
 
6:55 PM
@dzaima Shift Before/After is the best so far I think.
 
But that doesn't really click, imo. How about Shove before and Shove after? Imo, "shove" has more of the connotation of pushing something at the opposite end off the bench.
 
@Adám Shove is a little better, but not enough to offset the advantage of matching C terminology I think. To the thesaurus...
 
@Adám "shift 0 before 1‿2‿3" seems pretty clear to me. "shove" seems too strong :p
 
"Crowd" is nicely evocative, but definitely too strong. Sounds like all your data will get jumbled up!
 
@Marshall nudge before/after; (i think i still like shift better)
 
6:59 PM
Mash? No, shift is probably best due to established terms.
 
@dzaima It's so polite!
 
Scoot?
 
@dzaima i guess my problem with all the alternatives is they don't at all suggest the behavior of throwing the other end out, whereas shift's use in other langs does
 
Scoot is really good for that, but it's just really awkward somehow.
I guess partly because scooting is what the right argument cells do, but it doesn't say anything about the left argument.
Yeah, I'll go with Shift Before/After. Easy enough to change though.
 
@Marshall i mean, in the common case of a single 0 in a potentially million item vector it's a pretty insignificant request :p
 
7:05 PM
Displace is really precise but doesn't take directions well.
 
@Marshall One of the huge (imo) benefits of symbolic notation is the ability to ad-hoc name the symbols for the specific use case. (I'll keep saying scoot right and scoot left.)
 
@dzaima (nudge for the monadic case is fun)
 
@Adám Having the symbols is one of the big reasons I'm adding these. The names hardly matter.
 
 
1 hour later…
8:10 PM
Self-hosted and dzaima+reference BQN now support the shift functions « and »!
 
<eyepatchOwl> Well done!
 
Note that the JS version always fills with 0 at the moment.
For everything, not shifts in particular.
 
So 3↑"ab" is…?
'a'_'b'_0?
 
@Adám Yes, for now. It should be "ab "; dzaima/BQN gets it right.
There must be a way to golf string splitting a little further.
 
8:25 PM
Does seem like a strange and unusual transformation, though.
 
<eyepatchOwl> What is () string splitting?
 
≠⊆⊢ in APL.
 
@eyepatchOwl links to mlochbaum.github.io/BQN/… .
 
≠⊆⊢ in APL. So split on internal runs of spaces.
.trim().split(/ +/) in JS.
 
<moon-child> eyepatchOwl: 'string splitting' was a link, but for some reason my regex wasn't extracting it properly
 
8:30 PM
Except that BQN just has (mlochbaum.github.io/BQN/doc/group.html) to do the work of three APL primitives ⊂⊆⌸. is the one where it's not particularly convincing.
 
Actually, .replace(/^ +| +$/g,"").split(/ +/) to me more exact.
 
@Adám What's wrong with the trim version?
 
trim removes leading and trailing whitespace, not just spaces.
 
8:42 PM
Is there an equivalent expression for in J? Just dealing with a boolean left arg is fine, the ;. functions don't seem to do what I want but I'm a J noob...
 
@voidhawk I usually used ;._1 or similar and removed the empty boxes from the result. I don't think there's anything elegant.
 
9:01 PM
@Marshall Thanks, something like (a:-.~-.@[<;._1]) is close but misses runs of 1 at the beginning of the left arg
([:~.(a:-.~-.@[<;._2]),(a:-.~-.@[<;._1])) I guess? ⍨
 
@voidhawk You can add an element to the front of the right argument and a 0 to the left one.
 
Does J not have a regex library for something like .match(/[^ ]+/) a.k.a. '[^ ]+'⎕S'&'?
 
9:16 PM
I'm not sure, but I did just discover cut: ' '&$: :([: -.&a: <;._2@,~)
 

« first day (1327 days earlier)      last day (750 days later) »