« first day (1593 days earlier)      last day (1071 days later) » 

12:01 AM
can the input contain duplicates?
 
I guess.
 
does 'sorted in increasing order' mean your subsequence couldn't be 4 4 4?
 
@rak1507 If I read the reference impl. right, then yes.
I was actually looking for an implementation of the given algorithm.
 
I didn't look for it
I thought I had something nice but it turns out it doesn't work, oh well
 
12:27 AM
this would make a decent main challenge problem
 
@rak1507 Hm, actually looks like it is allowed.
 
they can't copyright a problem anyway surely
maybe the code
 
they can copyright the exact wording they have, but certainly not the idea of calculating the maximum sum of an increasing subsequence
 
Well, they explicitly allow reposting with attribution, so why not give them some credit?
 
12:49 AM
do you have a nice apl solution to it?
 
No.
I saw this written by another array programmer:
> I tried to implement this algorithm in an array language multiple times,
but ultimately failed:
 
lol
 
So I figured that TAO would be able…
 
I have something but it's certainly not efficient at all, slightly better than bruteforce but not good
 
1:25 AM
@Adám I have this for that O(n^2), assuming I transformed it correctly
 
I have a pretty fun solution, I think it's cubic but it solves it in imo an interesting way
instant for n=100, which admittedly is quite small but oh well
 
mine takes 0.40s for in CBQN the BQN equivalent of ?10000⍴100000
 
@dzaima you win
{⌈/∊(⊢⌈⌈.+⍨)⍣≡(-+/w)@(0=⊢)(∘.<⍨⍳≢w)∧w×⍤1∘.<⍨w←0,⍵} here's mine, it finds the longest path considering the list as a graph
 
@dzaima APL translation takes 0.14s in Dyalog
 
@dzaima Do you mind if I forward it? (I'll credit you, ofc.)
 
1:38 AM
cool solution, wonder if there's anything more apl-y
 
@Adám sure
@rak1507 it's already quite APL-y - the expensive operations are all on big arrays
 
true
 
that algorithm inherently requires some ¨iness as it acts on n different length loops, and it needs previous knowledge to calculate the next item
@dzaima down to 0.24s by implementing native i32 ⌈´ i32vec
 
that was quick
 
@rak1507 i mean, it's literally just this, and even that is mostly copied from another impl
 
1:44 AM
@dzaima I must have a faster computer than you. Takes under 70 ms for ?1e4⍴1e5 on mine.
 
@dzaima oh, fair enough
no fancy vectorisation magic
 
@Adám ?⍴⍨1e4 takes 60ms for me
 
@dzaima That takes under 50 ms for me.
 
ok well then you have a faster computer than me
 
all that professional code golfer cash
 
1:48 AM
@Adám apparently repetition changes a lot
 
The branch predictor is learning, I guess.
I do have the newest laptop at Dyalog. i7-10750H (2.6–5.0 GHz) with 16.0 GB RAM.
 
@Adám or the ⎕wa thing
@Adám and I'm at i3-4160 3.60GHz 8GB (desktop)
 
I should try it again while plugged in and switching on Alienware High-performance mode…
 
@dzaima (with that, 63% of time is spent in /, 15% in , and 7.7% in >)
 
@dzaima Well I've written up how to fix that one.
 
1:57 AM
@Marshall right, i did read that, but i think i want to leave too fancy things to after the core impl is actually somewhat finished (i guess left primarily is adding 8-bit/16-bit/1-bit arrays)
 
Meh, I don't know how to control the computer's priorities. Doesn't drop below 55 ms for ?1e4⍴1e5
 
@dzaima Converting booleans to 1-byte indices will never have to change, and Compress is pretty trivial given that as a utility function. So I think you could do that now if you wanted to. Definitely important to avoid accumulating too much code that has to be changed when there are more types though.
 
@dzaima i was thinking monadic would be quite fast, but it's actually still the runtime version. {m←↕0 ⋄ {s←𝕩⊑x ⋄ 1⊣m∾↩ s+ 0⌈´ m/˜ s>𝕩↑x}¨↕≠x←𝕩 ⋄ ⌈´m} gives 182ms
 
It's using ↕⊸⊏ instead of dyadic , because the provided doesn't have to handle a high-rank right argument.
 
with that, 85% of time is spent in / (followed by isum of 6.14%, which slash uses to compte the result length)
with -march=native, it's 90.3% in /, 3.43% in isum, 3.8% in > (but doesn't end up noticeably faster)
but imma go sleep (pushed the native ⌈⌊-folds)
 
 
4 hours later…
6:49 AM
@Razetime Well, clearly not copied from there, and requires much more checking.
 
7:09 AM
a bit more I guess
but it's the same concept otherwise
 
7:31 AM
should I avoid the above link if I'm participating dyalogcompetition?
 
@LdBeth Not yet, at least. For now, there's only a Jelly solution. Probably won't help you much, as the problem in the competition is really trivial, and is mostly just about knowing the primitives and how to combine them. Solutions in other languages will hardly help…
 
Well, not yet throughly read that solution, but the link does remind me I can came up a better one than my current answer. ;)
 
 
3 hours later…
10:22 AM
RIDE idea: when one RIDE window is opened, other RIDE windows are also brought to top.
 
@Razetime Opened or gets focus?
 
10:42 AM
@Adám hmm not sure if I'd necessarily say my solution was 'trivial', maybe I'm missing something
 
11:25 AM
@Adám gets focus
 
11:44 AM
@Razetime Maybe suggest it on GitHub as an option. I'm not sure it is universally desirable.
 
12:08 PM
@Adám after a bunch of clueless eight cllicking, there an optino in the right click menu in the title bar which says "Above session" which does the exact thing
 
@dzaima @rak1507 This looks ridiculously short (by ngn, of course): |/{x,|/(-1_y<*|y)*x+*|y}/,\
 
neat
 
12:24 PM
@Adám gives a different result to my solution to some random inputs
 
Huh. Using ngn/k?
 
@Adám yep
that should give 12 for 5+7
 
Hm.
 
prepending a 0 seems to fix it
@Adám I think the idea of that one is pretty much the same, just that a reduce is used instead of mutating a variable, and × is used instead of replicate (as the max-reduce afterwards doesn't care)
 
12:53 PM
comparisons of my old fn, a new one like ngn's, and versions where they multiply instead of compress:
https://dzaima.github.io/paste/#0vZK7TsNAEEX7fMU0KLb8yiQhpIKKv4AKOTbFUtggF8ENQRaYGPEQoocmBVKKQIOUxvmT@RJm1xsETZQHwlp5tTN377ljGUA@vYiyu77gFxVvQDeXYNDwyhMmUP4K/Vg1PigfJKqJXBU2FyG2oMFKKQbhUTGCeNdgqYMmZfdJWo6omND1S1I5pDWoeOIveLPn5WiBmk7eYcfKPB/QcErFp7Jnqf3LmQt6lnKMlD2yMPUMyi84rWlzhy/bBz8JYnWCSr@kf8iOe@i3qXhHf1sXD6Ozk9Nj4YNzBPVeBGGdN6G2oDoF8qTVGzw1@YNACJQ9QMfF/XLchHPZaGwB3T6tsRaAhAa13Z05yGm2VgEtniSYT4JuiwHIAAuxu@4kmy8VSnyHQh0KrG7nv0Lpr/MF#APL
 
1:08 PM
@Adám (for h:10000?100000 it takes 238ms in ngn/k, so slower than both Dyalog and CBQN (CBQN's at 41-42ms now, so faster than Dyalog for whatever reason))
 
Is CBQN using slices for ? Could be part of it.
 
@Marshall i'm comparing to my best function in CBQN, which doesn't use monadic
(but it is using slices for dyadic definitely)
 
I meant the dyadic one.
 
right. That probably explains why it can be faster than Dyalog
{-1_x}',\0,h alone is 150ms, but that still leaves 90ms on non-slice stuff
 
Also, 1e4 elements probably is small enough that constant overhead still matters some, and ∾↩ could be better than ,← somehow. They're both amortized constant, but maybe it reallocates less or does it quicker.
 
1:20 PM
oh right, and ngn's version probably doesn't do in-place appending at all
(i'm assuming ngn/k doesn't have an equivalent of LOCU)
 
1:35 PM
@RGS Thanks for your proofing notes.
 
RGS
1:56 PM
@xpqz np. You can react to them in the issues and I'll keep working on the next chapters.
 
@dzaima How slow is this? {v←s←⍬⋄⌈/s⊣{s,←⍵+⌈/0,(v>⍵)/s⋄v,←⍵}¨⌽⍵}
 
(and faster than CBQN D:)
what - is ⌈/0, an idiom?
 
@dzaima Not that I know of.
 
 
2 hours later…
4:33 PM
Announcement: APL Campfire in 90 minutes.
 
5:00 PM
What am i doing wrong: {⌊⍵,⍵-⌊⍵} 7.62 i get 7 0, expected 7 0.62
 
APL is right to left, so ⌊(⍵,⍵-⌊⍵)
 
also "We can use a name in the same line in which it is defined. In production code it is best to avoid this unless an expression is very short." why are sameline gets not recommended? and why are the appropriate for short expressions rather than long?
 
@0xACE if you do inline ← it's not as obvious where some variable declarations are if you're reading the code
 
oh i see, thanks
 
it's a matter of personal preference either way
 
5:04 PM
Nah i understand. i thought it was a runtime efficiency limitation and it didnt make sense to me why shorter expression were faster. But if it's only a readability thing I totally understand the point. I'd advise a comment is put there to indicate "... because it is difficult to tell the value of a variable in long expressions"
 
Pretty nice basic rundown of k syntax here on Hacker News
 
Damn i missed that apl campfire :(
 
I knew what it was before I even clicked
geocar is great
 
5:29 PM
{×/0≠(1+⍳⌊⍵÷2)|⍵}21 17 i expected this IsPrime to be a Monadic function but i get a RANK ERROR. What am i doing wrong?
 
@0xACE you forgot an ¨
 
Hmm, why is it required for my function, but not others?
would i have to ¨ all of my ⍵ in my functions?
 
look at what ⍳⌊21 17÷2 gives
 
@0xACE you don't need it for rank-agnostic functions (which are all your regular arithmetic functions), but here you're doing ⍳10 8, which isn't the same as ⍳¨10 8
 
{{×/0≠(1+⍳⌊⍵÷2)|⍵}¨⍵} 21 17 would this be a bad idea?
or is there a better approach?
(not referring to the isprime function, jsut the idea of applying `1 like that)
 
5:35 PM
@0xACE you could just {×/0≠(1+⍳⌊⍵÷2)|⍵}¨ 21 17
 
@0xACE No you didn't. About to start in 25 mins.
 
{…}¨ works exatly the same as {{…}¨⍵}
 
thing is i didnt understand "rank-agnostic functions" so I expected my function to work
@Adám oh, nice, I'll keep in in the background :)
 
alternatively, you could do {×/¨0≠(1+⍳¨⌊⍵÷2)|⍵} 21 17
 
That's the part i dont get, why does i and / need 1 ?
I tried your examples and noticed `i10 8 and `i`1 10 8 gave different results
 
5:39 PM
@0xACE because they don't act the same way on arrays and scalars
 
how are scalars and arrays differentiated in APL?
 
@0xACE They are not. Scalars are zero-dimensional arrays. See apl.wiki/scalar
 
@0xACE right, and that's just how is defined to be. On a single number argument it gives 1…n, and on a vector argument it creates an array containing all indices in that array
@Adám well, that's already a difference
 
?
 
(also, every time i said scalar, i probably meant simple scalar)
 
5:44 PM
@0xACE apl.wiki/Scalar_function may be useful reading.
 
I'll save both of those links for later, because I've overextended my timeslot for APL for today... deadlines, deadlines, deadlines...
 
@0xACE If you called a function with an argument of [1,2] in JS/Python/whatever, you won't necessarily necessarily get the same answer as calling it with 1 and 2 separately. Same in APL.
(but the difference is that, in APL, a given function is much more likely for a function to implicitly map than in other langs)
 
so in this particular case ⍳ and / map like "traditional programming langauge" funcitons?
it's going to be difficult for me to chat about all these glyphs unless i setup mapping on my keyboard
 
@0xACE For the chat, you could use abrudz.github.io/lb/apl
 
6:04 PM
@0xACE they're not pervasive, aka scalar functions. Which you could interpret as them being more "traditional"
 
 
1 hour later…
7:04 PM
Geez, that was fun @Adam, great initiative. Thank you :D
 
@0xACE You're very welcome.
 
7:19 PM
btw added '(d=>{let e=d.createElement("script");e.src="https://abrudz.github.io/lb/lb.js";d.body.appendChild(e)})(document)' as a grease monkey script to this chat. but now i can't type regular backticks at all, any ideas Adam (didnt want to highlight you as it's not that important)
 
@0xACE does tapping ` twice not work?
 
(⋄=2×/'backtick')
1
it produces a ⋄
 
oh right yeah
 
in dyalog it's 3 backticks and with the scrip its 2
 
backtick+space works apparently
 
7:22 PM
ah, nice catch, ty
another question, has anyone figured out rendering apl glyphs in the terminal? i bad with font config in linux
 
@0xACE what terminal?
 
im using st.suckless.org i have patched glyphs support for it but i dont think my font config is working correctly
they dont work in urxvt nor xterm for me... so it's likely a font config problem
 
i'm using gnome-terminal, where the default font (dejavu sans mono) works fine
 
oh i could try it out on one of the machines that are not setup as nerdly as mine and see if it's my config that way, good idea, thanks :D
 
 
1 hour later…
9:16 PM
@0xACE Works for me ootb on st (latest master) with all defaults (font = "Liberation Mono..."). Also in xterm with DejaVu Sans Mono. I know some terminals try to automagically fall back to some other font if the glyph isn't found in the main one, so idk if these fonts are actually being used.
LANG and LC_CTYPE & co are en_US.UTF-8 btw, if that makes any difference.
 
@goof yeah i think it's my font config that is messed up... font config on linux from scratch has always been a mystery... I have the same ENV variables...
 
 
1 hour later…
10:32 PM
@Adám Btw, would you say it makes sense to retag APL questions tagged or something else? As your old question says, it has no usage guidance and it's pretty ambiguous. What would you recommend?
(On SO, I mean)
 

« first day (1593 days earlier)      last day (1071 days later) »