« first day (1706 days earlier)      last day (1131 days later) » 

8:44 AM
@Leo Here's my gentle intro to APL: xpqz.github.io/learnapl
8:56 AM
For 2018 p8, Making a Good Argument, is {0::0⋄_←⍺⍉⍵⋄1} acceptable or cheating?
acceptable (can be golfed to 1⊣⍺⍉⍵ or if you're feeling fancy ≡⍨⍺⍉⍵)
9:25 AM
@rak1507 The guard part has always to be there, right?
yea I meant instead of _←⍺⍉⍵⋄1
@MasterQuiz yes
It feels like the whole point of the question was avoided. The model solution was:
{((≢⍺)=≢⍴⍵)∧((≢⍺)=+/⍺∊⍳≢⍴⍵)∧((×≢⍺)×⌈/⍺)=+/(⍳(×≢⍺)×⌈/⍺)∊⍺}
Quite
yeah, better to ask for forgiveness than permission in this case I think
10:00 AM
@xpqz I think we should disallow .
@Adám That certainly levels the playing field.
10:14 AM
{∧/⍺∊⍳⍴⍴⍵}∧{∧/⍺∊⍨⍳0⌈⌈/⍺}∧(≡⍥≢∘⍴) is my attempt
@xpqz It is not necessarily a "model" solution - it is a correct solution created by a student intern who was new to APL. You are welcome to submit a pull request with a more elegant test solution.
@RikedyP I only meant to highlight what seemed to be the intent, not to comment on the level of elegance (for which I'm clearly unqualified to comment). Using seemed like side-stepping the difficulty.
@xpqz I see what you mean - it should be possible (not soon, mind you) to disallow ⍉ in the solution
10:51 AM
@rak1507 I think you can remove the first clause entirely
11:21 AM
@RikedyP @xpqz (and to prevent tricks like ⍎⎕UCS 9033) prohibited now.
@Bubbler huh, maybe you can
(nvm, you can't, fails for 0 0 0⍉2 3 4⍴1)
@Adám That was quick.
 
2 hours later…
1:16 PM
@rak1507 Let me know if anything is missing from aplcart.info?q=unix time.
nice, thanks! that looks good so far but I'll let you know if I think of anything
huh, that's fun, 20 ¯1⎕DT works with negative numbers
@rak1507 How else would you represent dates before 1970?
you wouldn't with unix time
@Adám sorry, what's the relevance of 1904?
ah it's an epoch date
Yup. Default for Excel on MacOS.
> The Unix time number is zero at the Unix epoch, and increases by exactly 86400 per day since the epoch. Thus 2004-09-16T00:00:00Z, 12677 days after the epoch, is represented by the Unix time number 12677 × 86400 = 1095292800. This can be extended backwards from the epoch too, using negative numbers; thus 1957-10-04T00:00:00Z, 4472 days before the epoch, is represented by the Unix time number −4472 × 86400 = −386380800.
nice, I guess it makes sense I just never thought about it before
1:47 PM
Are there any resources or history on the design of ?? It seems to me like dyadic ? would have been better off as {⍵[⍺?≢⍵]} which makes current dyadic ? trivially ?∘⍳, and simplifies the above.
2:06 PM
@user9930855 Hi rabbitgrowth. If you want to chat here, please email [email protected]
@rak1507 ?∘⍳ would be horribly inefficient (possibly even not computable) for large right-arguments unless special-cased.
Also, what "above" do you refer to?
@Adám true, special case it then :P to me choosing from a list is more useful than choosing from a range
@Adám {⍵[⍺?≢⍵]}
Choosing from a list seems like merging two operations. Un-APLy, similar to combining grading and selecting.
@Adám I see your point, but haven't you yourself argued for sort to become a primitive? :P
Yes and no. I wouldn't so much want Sort if we had sane indexing.
going from sort to grade is a lot more difficult than going from {⍵[⍺?≢⍵]} to current ?
@Adám fair enough
2:15 PM
Another issue I have with ? is that both args have to be scalars. Very un-APLy.
maybe vec?scalar could be extended to mean vec⍴(×/vec)?scalar (wrong way round oops)
Makes sense.
and scalar?vec could be {(,⍳⍵)[⍺?×/⍵]} ? ie choose n from the result of ⍳, same as it as atm for s?s
2:30 PM
Yeah, that's nice too, and the combo works.
yep
so then you can do something like ?⍨2 3 to randomly shuffle ⍳2 3
?←{⍺⍴(,⍳⍵)[⍺?⍥(×/)⍵]} works for all 4 cases I think
3:01 PM
@rak1507 Seems right. I'd maybe write {(,⍳⍵)[⍺⍴⍺?⍥(×/)⍵]}. This is going into APLcart and maybe I can work it into Extended too.
@rak1507 Wait, this again has the issue of generating all of ⍳⍵. Better to use .
{⍺⍴,⌿1+⍵⊤⍺?⍥(×/)⍵} is shorter and should be much faster.
10 10{(,⍳⍵)[⍺⍴⍺?⍥(×/)⍵]}100 100 → 2.1E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
10 10{⍺⍴,⌿1+⍵⊤⍺?⍥(×/)⍵}100 100  → 1.3E¯5 | -95% ⎕⎕
@hyper-neutrino Can you give chat.stackexchange.com/users/525198/user9930855 access?
3:17 PM
@Adám done
Wow, speed record, methinks.
3:56 PM
@user9930855 Welcome to the Orchard. Since you're new to Stack Exchange chat, I highly recommend reading through apl.wiki/APL_Orchard#Features
Thanks so much!
Hi everyone - I'm an APL newbie who's been learning the language for a few months and I'm really enjoying it so far. I'll try to ask questions here if I get stuck :)
May I ask what materials you've been using for your studies?
I'm halfway through "Mastering Dyalog APL". I'm also trying to read "A History of APL in 50 Functions"
(and attempting to solve basic Project Euler and Advent of Code problems)
@user9930855 Nice. Are you aware of the WIP update?
You might also find additional useful things at apl.wiki/Learning_resources
4:14 PM
I didn't know about the update. Thanks for telling me!
APLcart is really useful. I was about to ask a question here about generating the Collatz sequence (I managed to write a function that works but I wasn't quite sure if it was the best way to do it) but then I found an entry on the website
Great to hear. If you find that anything you'd expect to be there is in fact missing, please do let me know.
Will do. Thanks again!
5:03 PM
@Adám yeah, nice, I actually thought of that on the way home but you beat me to it :) not sure how much it matters but {⍺⍴⊆⍣¯1,⌿⎕IO+⍵⊤⍺?⍥(×/)⍵} seems slightly better so it still works with scalar + scalar and works with ⎕IO properly

« first day (1706 days earlier)      last day (1131 days later) »